From a46c92c8b7f2da7e80cb423f402d1ca93219bc3a Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Sat, 14 Oct 2017 12:32:50 +0200 Subject: [PATCH] Backed out changeset f66cb1530f75 (bug 1407952) for build failure (bug 1408622). r=backout a=backout MozReview-Commit-ID: 3h4oDHbvmes --HG-- extra : amend_source : 9e9e1bb348b7e2434f3388cf97580172348e769a --- dom/base/Element.cpp | 51 +++++++++++++-------------------- layout/style/ServoBindingList.h | 2 -- 2 files changed, 20 insertions(+), 33 deletions(-) diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index 6c25ced773c2..8672d8ec5185 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -3467,38 +3467,27 @@ Element::GetTokenList(nsAtom* aAtom, Element* Element::Closest(const nsAString& aSelector, ErrorResult& aResult) { - return WithSelectorList( - aSelector, - aResult, - [&](const RawServoSelectorList* aList) -> Element* { - if (!aList) { - return nullptr; - } - return const_cast(Servo_SelectorList_Closest(this, aList)); - }, - [&](nsCSSSelectorList* aList) -> Element* { - if (!aList) { - // Either we failed (and aError already has the exception), or this - // is a pseudo-element-only selector that matches nothing. - return nullptr; - } - TreeMatchContext matchingContext(false, - nsRuleWalker::eRelevantLinkUnvisited, - OwnerDoc(), - TreeMatchContext::eNeverMatchVisited); - matchingContext.SetHasSpecifiedScope(); - matchingContext.AddScopeElement(this); - for (nsINode* node = this; node; node = node->GetParentNode()) { - if (node->IsElement() && - nsCSSRuleProcessor::SelectorListMatches(node->AsElement(), - matchingContext, - aList)) { - return node->AsElement(); - } - } - return nullptr; + nsCSSSelectorList* selectorList = ParseSelectorList(aSelector, aResult); + if (!selectorList) { + // Either we failed (and aResult already has the exception), or this + // is a pseudo-element-only selector that matches nothing. + return nullptr; + } + TreeMatchContext matchingContext(false, + nsRuleWalker::eRelevantLinkUnvisited, + OwnerDoc(), + TreeMatchContext::eNeverMatchVisited); + matchingContext.SetHasSpecifiedScope(); + matchingContext.AddScopeElement(this); + for (nsINode* node = this; node; node = node->GetParentNode()) { + if (node->IsElement() && + nsCSSRuleProcessor::SelectorListMatches(node->AsElement(), + matchingContext, + selectorList)) { + return node->AsElement(); } - ); + } + return nullptr; } bool diff --git a/layout/style/ServoBindingList.h b/layout/style/ServoBindingList.h index 4aec6a5a77d9..007f7566a3ca 100644 --- a/layout/style/ServoBindingList.h +++ b/layout/style/ServoBindingList.h @@ -136,8 +136,6 @@ SERVO_BINDING_FUNC(Servo_SelectorList_Parse, const nsACString* selector_list) SERVO_BINDING_FUNC(Servo_SelectorList_Matches, bool, RawGeckoElementBorrowed, RawServoSelectorListBorrowed) -SERVO_BINDING_FUNC(Servo_SelectorList_Closest, RawGeckoElementBorrowedOrNull, - RawGeckoElementBorrowed, RawServoSelectorListBorrowed) SERVO_BINDING_FUNC(Servo_StyleSet_AddSizeOfExcludingThis, void, mozilla::MallocSizeOf malloc_size_of, mozilla::MallocSizeOf malloc_enclosing_size_of,