Bug 1417281 part 1 - Trigger subtree restyle when lwtheme / lwthemetextcolor attribute on root element of XUL document is changed. r?heycam
MozReview-Commit-ID: 2RM3ZkWKiSl
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -1417,24 +1417,31 @@ ServoRestyleManager::TakeSnapshotForAttr
if (influencesOtherPseudoClassState) {
snapshot.AddOtherPseudoClassState(aElement);
}
}
// For some attribute changes we must restyle the whole subtree:
//
// * <td> is affected by the cellpadding on its ancestor table
+// * lwtheme and lwthemetextcolor on root element of XUL document
+// affects all descendants due to :-moz-lwtheme* pseudo-classes
// * lang="" and xml:lang="" can affect all descendants due to :lang()
//
static inline bool
AttributeChangeRequiresSubtreeRestyle(const Element& aElement, nsAtom* aAttr)
{
if (aAttr == nsGkAtoms::cellpadding) {
return aElement.IsHTMLElement(nsGkAtoms::table);
}
+ if (aAttr == nsGkAtoms::lwtheme ||
+ aAttr == nsGkAtoms::lwthemetextcolor) {
+ return aElement.GetNameSpaceID() == kNameSpaceID_XUL &&
+ &aElement == aElement.OwnerDoc()->GetRootElement();
+ }
return aAttr == nsGkAtoms::lang;
}
void
ServoRestyleManager::AttributeChanged(Element* aElement, int32_t aNameSpaceID,
nsAtom* aAttribute, int32_t aModType,
const nsAttrValue* aOldValue)