Bug 1290276 Part 4 - Make ServoStyleSet::RawSet() return a pointer.
In next part, we'll use ServoStyleSet to host XBL stylesheets. The raw set
is not available until the resources are loaded, so it's easier to tell that
by checking whether the pointer is nullptr or not.
MozReview-Commit-ID: Hqydd55FPO9
--- a/layout/style/ServoMediaList.cpp
+++ b/layout/style/ServoMediaList.cpp
@@ -77,14 +77,15 @@ ServoMediaList::Delete(const nsAString&
return NS_OK;
}
return NS_ERROR_DOM_NOT_FOUND_ERR;
}
bool
ServoMediaList::Matches(nsPresContext* aPresContext) const
{
- const RawServoStyleSet& rawSet =
+ const RawServoStyleSet* rawSet =
aPresContext->StyleSet()->AsServo()->RawSet();
- return Servo_MediaList_Matches(mRawList, &rawSet);
+ MOZ_ASSERT(rawSet, "The RawServoStyleSet should be valid!");
+ return Servo_MediaList_Matches(mRawList, rawSet);
}
} // namespace mozilla
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -137,17 +137,19 @@ public:
return StylistNeedsUpdate();
}
bool MediumFeaturesChanged() const;
void InvalidateStyleForCSSRuleChanges();
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
- const RawServoStyleSet& RawSet() const { return *mRawSet; }
+ const RawServoStyleSet* RawSet() const {
+ return mRawSet.get();
+ }
bool GetAuthorStyleDisabled() const;
nsresult SetAuthorStyleDisabled(bool aStyleDisabled);
void BeginUpdate();
nsresult EndUpdate();
already_AddRefed<nsStyleContext>