Bug 1374247: Keep the hack working on late beta and release, so we can land this a little earlier. r=bz,xidorn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 03 Nov 2017 01:18:22 +0100
changeset 443290 9edca0017ec435f03f3550f6277390d514a7b2d4
parent 443289 5c4cb77d75e5848fbbcf191d78b9110274f26761
child 443291 f62bd9c2b794f18f7a0eea222a592fa53d191258
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, xidorn
bugs1374247
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1374247: Keep the hack working on late beta and release, so we can land this a little earlier. r=bz,xidorn As Xidorn mentions, if the plan is stylo-in-chrome for 59, we really should land this assertion pretty much now. This ensures that we don't ship 58 without this hack. MozReview-Commit-ID: JXol2r3BMtC
layout/style/nsCSSRuleProcessor.cpp
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -2346,20 +2346,17 @@ static bool
 SelectorMatchesTree(Element* aPrevElement,
                     nsCSSSelector* aSelector,
                     TreeMatchContext& aTreeMatchContext,
                     SelectorMatchesTreeFlags aFlags)
 {
   MOZ_ASSERT(!aSelector || !aSelector->IsPseudoElement());
   nsCSSSelector* selector = aSelector;
   Element* prevElement = aPrevElement;
-
-#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
   bool xblChildrenMatched = false;
-#endif
 
   while (selector) { // check compound selectors
     NS_ASSERTION(!selector->mNext ||
                  selector->mNext->mOperator != char16_t(0),
                  "compound selector without combinator");
 
     // If after the previous selector match we are now outside the
     // current style scope, we don't need to match any further.
@@ -2401,33 +2398,39 @@ SelectorMatchesTree(Element* aPrevElemen
         if (aTreeMatchContext.mForScopedStyle) {
           // We are moving up to the parent element; tell the
           // TreeMatchContext, so that in case this element is the
           // style scope element, selector matching stops before we
           // traverse further up the tree.
           aTreeMatchContext.PopStyleScopeForSelectorMatching(element);
         }
 
-#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
         // Compatibility hack: First try matching this selector as though the
         // <xbl:children> element wasn't in the tree to allow old selectors
         // were written before <xbl:children> participated in CSS selector
         // matching to work.
         if (selector->mOperator == '>' && element->IsActiveChildrenElement()) {
           Element* styleScope = aTreeMatchContext.mCurrentStyleScope;
           xblChildrenMatched |=
             SelectorMatchesTree(element, selector, aTreeMatchContext, aFlags);
 
+#ifndef EARLY_BETA_OR_EARLIER
+          if (xblChildrenMatched) {
+            // It matched, don't try matching on the <xbl:children> element at
+            // all.
+            return true;
+          }
+#endif
+
           // We want to reset mCurrentStyleScope on aTreeMatchContext
           // back to its state before the SelectorMatchesTree call, in
           // case that call happens to traverse past the style scope element
           // and sets it to null.
           aTreeMatchContext.mCurrentStyleScope = styleScope;
         }
-#endif
       }
     }
     if (!element) {
       ASSERT_XBL_CHILDREN_HACK();
       return false;
     }
     if ((aFlags & eMatchOnConditionalRestyleAncestor) &&
         element->HasFlag(ELEMENT_IS_CONDITIONAL_RESTYLE_ANCESTOR)) {