Bug 1292432 part 3 - Add WillDirty and DidDirty to StyleSheet. r?heycam
MozReview-Commit-ID: 17O1vYVxuCk
--- a/layout/style/CSSStyleSheet.h
+++ b/layout/style/CSSStyleSheet.h
@@ -249,19 +249,16 @@ public:
if (mOwningNode) {
return dom::ParentObject(mOwningNode);
}
return dom::ParentObject(static_cast<nsIDOMCSSStyleSheet*>(mParent), mParent);
}
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
- // Changes to sheets should be inside of a WillDirty-DidDirty pair.
- // However, the calls do not need to be matched; it's ok to call
- // WillDirty and then make no change and skip the DidDirty call.
void WillDirty();
void DidDirty();
private:
CSSStyleSheet(const CSSStyleSheet& aCopy,
CSSStyleSheet* aParentToUse,
css::ImportRule* aOwnerRuleToUse,
nsIDocument* aDocumentToUse,
--- a/layout/style/ServoStyleSheet.h
+++ b/layout/style/ServoStyleSheet.h
@@ -53,16 +53,19 @@ public:
// nsIDOMStyleSheet interface
NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet) final;
NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia) final;
// nsIDOMCSSStyleSheet interface
NS_DECL_NSIDOMCSSSTYLESHEET
+ void WillDirty() {}
+ void DidDirty() {}
+
protected:
~ServoStyleSheet();
private:
void DropSheet();
RefPtr<RawServoStyleSheet> mSheet;
};
--- a/layout/style/StyleSheet.h
+++ b/layout/style/StyleSheet.h
@@ -142,16 +142,22 @@ public:
// nsIDOMStyleSheet interface
NS_IMETHOD GetType(nsAString& aType) final;
NS_IMETHOD GetDisabled(bool* aDisabled) final;
NS_IMETHOD SetDisabled(bool aDisabled) final;
NS_IMETHOD GetOwnerNode(nsIDOMNode** aOwnerNode) final;
NS_IMETHOD GetHref(nsAString& aHref) final;
NS_IMETHOD GetTitle(nsAString& aTitle) final;
+ // Changes to sheets should be inside of a WillDirty-DidDirty pair.
+ // However, the calls do not need to be matched; it's ok to call
+ // WillDirty and then make no change and skip the DidDirty call.
+ inline void WillDirty();
+ inline void DidDirty();
+
private:
// Get a handle to the various stylesheet bits which live on the 'inner' for
// gecko stylesheets and live on the StyleSheet for Servo stylesheets.
inline StyleSheetInfo& SheetInfo();
inline const StyleSheetInfo& SheetInfo() const;
protected:
nsString mTitle;
--- a/layout/style/StyleSheetInlines.h
+++ b/layout/style/StyleSheetInlines.h
@@ -199,16 +199,19 @@ StyleSheet::SizeOfIncludingThis(MallocSi
#ifdef DEBUG
void
StyleSheet::List(FILE* aOut, int32_t aIndex) const
{
FORWARD(List, (aOut, aIndex))
}
#endif
+void StyleSheet::WillDirty() { FORWARD(WillDirty, ()) }
+void StyleSheet::DidDirty() { FORWARD(DidDirty, ()) }
+
#undef FORWARD
#undef FORWARD_CONCRETE
inline void
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
RefPtr<StyleSheet>& aField,
const char* aName,
uint32_t aFlags = 0)