Bug 1418433 - move the implementation of SetStylistStyleSheetsDirty to .cpp file. draft
authorJeremy Chen <jeremychen@mozilla.com>
Wed, 29 Nov 2017 10:56:15 +0000
changeset 705194 fbac96bd4f376e62452565a33183c120e824a1ae
parent 705193 72697b3578b34f97690755c114b3ca44c8afd7c9
child 705195 5ab7dac85cb97c686af337e0de76d40900fae4ee
push id91391
push userbmo:jeremychen@mozilla.com
push dateWed, 29 Nov 2017 16:17:22 +0000
bugs1418433
milestone59.0a1
Bug 1418433 - move the implementation of SetStylistStyleSheetsDirty to .cpp file. This is a pre-patch for the real fix of Bug 1418433. In the real fix, we'll add a IncrementUndisplayedRestyleGeneration() call into SetStylistStyleSheetsDirty(). However, the IncrementUndisplayedRestyleGeneration() call needs get through some deep structures in nsPresContext, RestyleManager,... etc., and doing so means we need to move bunches of related include files, forward declarations, from .cpp file to .h file, which doesn't make sense. Instead, we move the implementation parts of SetStylistStyleSheetsDirty() to .cpp file (since it is now a bit more complicated than it was), so we can use the existing include files in the .cpp file to add IncrementUndisplayedRestyleGeneration() call (this is in a following patch). MozReview-Commit-ID: 3Vp9qyCf8NA
layout/style/ServoStyleSet.cpp
layout/style/ServoStyleSet.h
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -1021,16 +1021,28 @@ ServoStyleSet::MarkOriginsDirty(OriginFl
 {
   SetStylistStyleSheetsDirty();
   Servo_StyleSet_NoteStyleSheetsChanged(mRawSet.get(),
                                         mAuthorStyleDisabled,
                                         aChangedOrigins);
 }
 
 void
+ServoStyleSet::SetStylistStyleSheetsDirty()
+{
+  mStylistState |= StylistState::StyleSheetsDirty;
+}
+
+void
+ServoStyleSet::SetStylistXBLStyleSheetsDirty()
+{
+  mStylistState |= StylistState::XBLStyleSheetsDirty;
+}
+
+void
 ServoStyleSet::RecordStyleSheetChange(
     ServoStyleSheet* aSheet,
     StyleSheet::ChangeType aChangeType)
 {
   switch (aChangeType) {
     case StyleSheet::ChangeType::RuleAdded:
     case StyleSheet::ChangeType::RuleRemoved:
     case StyleSheet::ChangeType::RuleChanged:
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -549,25 +549,19 @@ private:
    * changed since the last.  Calling this will ensure that the Stylist
    * rebuilds its selector maps.
    */
   void MarkOriginsDirty(OriginFlags aChangedOrigins);
 
   /**
    * Note that the stylist needs a style flush due to style sheet changes.
    */
-  void SetStylistStyleSheetsDirty()
-  {
-    mStylistState |= StylistState::StyleSheetsDirty;
-  }
+  void SetStylistStyleSheetsDirty();
 
-  void SetStylistXBLStyleSheetsDirty()
-  {
-    mStylistState |= StylistState::XBLStyleSheetsDirty;
-  }
+  void SetStylistXBLStyleSheetsDirty();
 
   bool StylistNeedsUpdate() const
   {
     return mStylistState != StylistState::NotDirty;
   }
 
   /**
    * Update the stylist as needed to ensure style data is up-to-date.