diff --git a/layout/reftests/dom/reftest.list b/layout/reftests/dom/reftest.list index 6a8c8c2e5bb..859c2a8f879 100644 --- a/layout/reftests/dom/reftest.list +++ b/layout/reftests/dom/reftest.list @@ -48,3 +48,5 @@ skip-if(B2G) == multipleinsertionpoints-insertmultiple.xhtml multipleinsertionpo == multipleappendwithxul.xhtml multipleappendwithxul-ref.xhtml == multipleappendwithinput.xhtml multipleappendwithinput-ref.xhtml == multipleappendwitheditable.xhtml multipleappendwitheditable-ref.xhtml + +skip-if(B2G) == xbl-children-1.xhtml xbl-children-1-ref.xhtml diff --git a/layout/reftests/dom/xbl-children-1-ref.xhtml b/layout/reftests/dom/xbl-children-1-ref.xhtml new file mode 100644 index 00000000000..db526e90142 --- /dev/null +++ b/layout/reftests/dom/xbl-children-1-ref.xhtml @@ -0,0 +1,16 @@ + + + + + +
text
+ + + diff --git a/layout/reftests/dom/xbl-children-1.xhtml b/layout/reftests/dom/xbl-children-1.xhtml new file mode 100644 index 00000000000..6d065b61a77 --- /dev/null +++ b/layout/reftests/dom/xbl-children-1.xhtml @@ -0,0 +1,39 @@ + + + + + + + + + + + TEXT + + + + + + + + + + + + + +
+ + diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index 140b19af8f8..85a6ca0156b 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -2287,6 +2287,27 @@ static bool SelectorMatchesTree(Element* aPrevElement, // traverse further up the tree. aTreeMatchContext.PopStyleScopeForSelectorMatching(element); } + + // Compatibility hack: First try matching this selector as though the + // element wasn't in the tree to allow old selectors + // were written before participated in CSS selector + // matching to work. + if (selector->mOperator == '>' && + element->NodeInfo()->Equals(nsGkAtoms::children, + kNameSpaceID_XBL)) { + Element* styleScope = aTreeMatchContext.mCurrentStyleScope; + if (SelectorMatchesTree(element, selector, aTreeMatchContext, + aLookForRelevantLink)) { + // It matched, don't try matching on the element at + // all. + return true; + } + // 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; + } } } if (!element) {