Bug 1457920: Remove DidDirty. r?xidorn
MozReview-Commit-ID: 54sVDiRkLze
--- a/layout/style/GroupRule.h
+++ b/layout/style/GroupRule.h
@@ -54,18 +54,17 @@ public:
int32_t StyleRuleCount() const { return mRuleList->Length(); }
Rule* GetStyleRuleAt(int32_t aIndex) const {
return mRuleList->GetRule(aIndex);
}
/*
* The next method should never be called unless you have first called
- * WillDirty() on the parent stylesheet. After it's called, DidDirty()
- * needs to be called on the sheet.
+ * WillDirty() on the parent stylesheet.
*/
nsresult DeleteStyleRuleAt(uint32_t aIndex) {
return mRuleList->DeleteRule(aIndex);
}
// non-virtual -- it is only called by subclasses
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override = 0;
--- a/layout/style/ServoStyleRule.cpp
+++ b/layout/style/ServoStyleRule.cpp
@@ -214,17 +214,16 @@ ServoStyleRule::SetSelectorText(const ns
// StyleRule lives inside of the Inner, it is unsafe to call WillDirty
// if sheet does not already have a unique Inner.
sheet->AssertHasUniqueInner();
sheet->WillDirty();
const RawServoStyleSheetContents* contents = servoSheet->RawContents();
if (Servo_StyleRule_SetSelectorText(contents, mRawRule, &aSelectorText)) {
- sheet->DidDirty();
sheet->RuleChanged(this);
}
}
}
uint32_t
ServoStyleRule::GetSelectorCount()
{
--- a/layout/style/ServoStyleSheet.cpp
+++ b/layout/style/ServoStyleSheet.cpp
@@ -266,17 +266,16 @@ ServoStyleSheet::ReparseSheet(const nsAS
DropRuleList();
ParseSheetSync(loader,
NS_ConvertUTF16toUTF8(aInput),
/* aLoadData = */ nullptr,
lineNumber,
&reusableSheets);
- DidDirty();
// Notify the stylesets about the new rules.
{
// Get the rule list (which will need to be regenerated after ParseSheet).
ServoCSSRuleList* ruleList = GetCssRulesInternal();
MOZ_ASSERT(ruleList);
uint32_t ruleCount = ruleList->Length();
--- a/layout/style/StyleSheet.cpp
+++ b/layout/style/StyleSheet.cpp
@@ -575,41 +575,38 @@ StyleSheet::GetContainingShadow() const
} \
current = current->mParent; \
} while (current); \
} while (0)
void
StyleSheet::RuleAdded(css::Rule& aRule)
{
- DidDirty();
mDirtyFlags |= MODIFIED_RULES;
NOTIFY(RuleAdded, (*AsServo(), aRule));
if (mDocument) {
mDocument->StyleRuleAdded(this, &aRule);
}
}
void
StyleSheet::RuleRemoved(css::Rule& aRule)
{
- DidDirty();
mDirtyFlags |= MODIFIED_RULES;
NOTIFY(RuleRemoved, (*AsServo(), aRule));
if (mDocument) {
mDocument->StyleRuleRemoved(this, &aRule);
}
}
void
StyleSheet::RuleChanged(css::Rule* aRule)
{
- DidDirty();
mDirtyFlags |= MODIFIED_RULES;
NOTIFY(RuleChanged, (*AsServo(), aRule));
if (mDocument) {
mDocument->StyleRuleChanged(this, aRule);
}
}
@@ -716,18 +713,16 @@ StyleSheet::SubjectSubsumesInnerPrincipa
if (!info.mComplete) {
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
return;
}
WillDirty();
info.mPrincipal = &aSubjectPrincipal;
-
- DidDirty();
}
bool
StyleSheet::AreRulesAvailable(nsIPrincipal& aSubjectPrincipal,
ErrorResult& aRv)
{
// Rules are not available on incomplete sheets.
if (!SheetInfo().mComplete) {
@@ -776,17 +771,16 @@ StyleSheet::ClearAssociatedDocument()
SetAssociatedDocument(nullptr, NotOwnedByDocument);
}
void
StyleSheet::PrependStyleSheet(StyleSheet* aSheet)
{
WillDirty();
PrependStyleSheetSilently(aSheet);
- DidDirty();
}
void
StyleSheet::PrependStyleSheetSilently(StyleSheet* aSheet)
{
MOZ_ASSERT(aSheet);
aSheet->mNext = SheetInfo().mFirstChild;
--- a/layout/style/StyleSheet.h
+++ b/layout/style/StyleSheet.h
@@ -108,17 +108,16 @@ public:
Inner()->mContents = aContents;
}
URLExtraData* URLData() const { return Inner()->mURLData; }
// FIXME(emilio): Remove.
StyleSheet* AsServo() { return this; }
const StyleSheet* AsServo() const { return this; }
- void DidDirty() {}
// nsICSSLoaderObserver interface
NS_IMETHOD StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate,
nsresult aStatus) final;
// Internal GetCssRules methods which do not have security check and
// completeness check.
ServoCSSRuleList* GetCssRulesInternal();
@@ -239,17 +238,17 @@ public:
void SetOwnerRule(dom::CSSImportRule* aOwnerRule) {
mOwnerRule = aOwnerRule; /* Not ref counted */
}
dom::CSSImportRule* GetOwnerRule() const { return mOwnerRule; }
void PrependStyleSheet(StyleSheet* aSheet);
- // Prepend a stylesheet to the child list without calling Will/DidDirty.
+ // Prepend a stylesheet to the child list without calling WillDirty.
void PrependStyleSheetSilently(StyleSheet* aSheet);
StyleSheet* GetFirstChild() const;
StyleSheet* GetMostRecentlyAddedChildSheet() const {
// New child sheet can only be prepended into the linked list of
// child sheets, so the most recently added one is always the first.
return GetFirstChild();
}
@@ -305,19 +304,17 @@ public:
void DeleteRule(uint32_t aIndex,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aRv);
// WebIDL miscellaneous bits
inline dom::ParentObject GetParentObject() const;
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) 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.
+ // Changes to sheets should be after a WillDirty call.
void WillDirty();
// Called when a rule changes from CSSOM.
//
// FIXME(emilio): This shouldn't allow null, but MediaList doesn't know about
// it's owning media rule, plus it's used for the stylesheet media itself.
void RuleChanged(css::Rule*);