Bug 1417281 part 1 - Trigger subtree restyle when lwtheme / lwthemetextcolor attribute on root element of XUL document is changed. r?heycam draft
authorXidorn Quan <me@upsuper.org>
Tue, 14 Nov 2017 17:53:11 -0800
changeset 697959 fecabc23f36e98c5a6efed9c9dd3b6efff029597
parent 697958 36a7a9157821cdd34cb0f2f91183bf1fd22c9a6d
child 697960 41408a3858911424707f918e5aeeefbb6106beb5
push id89152
push userxquan@mozilla.com
push dateWed, 15 Nov 2017 01:55:26 +0000
reviewersheycam
bugs1417281
milestone59.0a1
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
layout/base/ServoRestyleManager.cpp
--- 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)