Bug 1449089 part 1 - Make :-moz-native-anonymous and :-moz-use-shadow-tree-root matches in Rust code. r=emilio

:-moz-native-anonymous can just use is_in_native_anonymous_subtree()
which is an existing function duplicating IsInNativeAnonymousSubtree().

IsRootOfUseElementShadowTree() in C++ code only has a single reference
from nsCSSPseudoClasses::MatchesElement() so we can just move it to the
Rust side. And actually Rust code has existing duplicate logic for
blocks_ancestor_combinators().

MozReview-Commit-ID: 8M1hHrYJT6Y

--HG--
extra : rebase_source : bf53ac7d8b15b0d1f7447a6056986d89b1cb4e57
This commit is contained in:
Xidorn Quan 2018-03-28 09:41:04 +11:00
Родитель 8543cb7090
Коммит 5e4279ed26
2 изменённых файлов: 0 добавлений и 12 удалений

Просмотреть файл

@ -246,14 +246,6 @@ public:
return IsInNativeAnonymousSubtree() || (!IsInShadowTree() && GetBindingParent() != nullptr);
}
/*
* Return true if this node is the shadow root of an use-element shadow tree.
*/
bool IsRootOfUseElementShadowTree() const {
return GetParent() && GetParent()->IsSVGElement(nsGkAtoms::use) &&
IsRootOfAnonymousSubtree();
}
/**
* Return true iff this node is in an HTML document (in the HTML5 sense of
* the term, i.e. not in an XHTML/XML document).

Просмотреть файл

@ -295,10 +295,6 @@ nsCSSPseudoClasses::StringPseudoMatches(const mozilla::dom::Element* aElement,
nsCSSPseudoClasses::MatchesElement(Type aType, const dom::Element* aElement)
{
switch (aType) {
case CSSPseudoClassType::mozNativeAnonymous:
return Some(aElement->IsInNativeAnonymousSubtree());
case CSSPseudoClassType::mozUseShadowTreeRoot:
return Some(aElement->IsRootOfUseElementShadowTree());
case CSSPseudoClassType::mozTableBorderNonzero: {
if (!aElement->IsHTMLElement(nsGkAtoms::table)) {
return Some(false);