Bug 1418433 - move the implementation of SetStylistStyleSheetsDirty to .cpp file. draft
authorJeremy Chen <jeremychen@mozilla.com>
Tue, 28 Nov 2017 16:17:23 +0800
changeset 704087 b62e22ad29e47e6c56661205b732be6c062e6a94
parent 704086 1a529c3baa1a2a97d2131dba6cb9759cabdce1ba
child 704088 0f61e7d7dd7eb2795cd0905ad950a74fb0f84ea2
child 704089 771e58324d2c38f124bd5587e15606c0de2830af
push id91070
push userbmo:jeremychen@mozilla.com
push dateTue, 28 Nov 2017 08:39:45 +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.