mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 1357461: Cache effective media query results. r=heycam
And implement a function that returns whether they changed, to be shared with Servo. MozReview-Commit-ID: 8gnAdJaEfZC
This commit is contained in:
parent
6c8bd009b6
commit
f87691e784
@ -2070,18 +2070,8 @@ nsPresContext::MediaFeatureValuesChanged(nsRestyleHint aRestyleHint,
|
||||
mPendingMediaFeatureValuesChanged = false;
|
||||
|
||||
// MediumFeaturesChanged updates the applied rules, so it always gets called.
|
||||
if (mShell) {
|
||||
// XXXheycam ServoStyleSets don't support responding to medium
|
||||
// changes yet.
|
||||
if (mShell->StyleSet()->IsGecko()) {
|
||||
if (mShell->StyleSet()->AsGecko()->MediumFeaturesChanged()) {
|
||||
aRestyleHint |= eRestyle_Subtree;
|
||||
}
|
||||
} else {
|
||||
NS_WARNING("stylo: ServoStyleSets don't support responding to medium "
|
||||
"changes yet. See bug 1290228.");
|
||||
aRestyleHint |= eRestyle_Subtree;
|
||||
}
|
||||
if (mShell && mShell->StyleSet()->MediumFeaturesChanged()) {
|
||||
aRestyleHint |= eRestyle_Subtree;
|
||||
}
|
||||
|
||||
if (mUsesViewportUnits && mPendingViewportChange) {
|
||||
|
@ -54,6 +54,8 @@ SERVO_BINDING_FUNC(Servo_StyleSet_Clear, void,
|
||||
RawServoStyleSetBorrowed set)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_RebuildData, void,
|
||||
RawServoStyleSetBorrowed set)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_MediumFeaturesChanged, bool,
|
||||
RawServoStyleSetBorrowed set)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_Drop, void, RawServoStyleSetOwned set)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_AppendStyleSheet, void,
|
||||
RawServoStyleSetBorrowed set,
|
||||
|
@ -133,6 +133,12 @@ ServoStyleSet::InvalidateStyleForCSSRuleChanges()
|
||||
mPresContext->RestyleManager()->AsServo()->PostRestyleEventForCSSRuleChanges();
|
||||
}
|
||||
|
||||
bool
|
||||
ServoStyleSet::MediumFeaturesChanged() const
|
||||
{
|
||||
return Servo_StyleSet_MediumFeaturesChanged(mRawSet.get());
|
||||
}
|
||||
|
||||
size_t
|
||||
ServoStyleSet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
|
@ -137,6 +137,8 @@ public:
|
||||
return StylistNeedsUpdate();
|
||||
}
|
||||
|
||||
bool MediumFeaturesChanged() const;
|
||||
|
||||
void InvalidateStyleForCSSRuleChanges();
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
@ -158,6 +158,7 @@ public:
|
||||
inline void RecordShadowStyleChange(mozilla::dom::ShadowRoot* aShadowRoot);
|
||||
inline bool StyleSheetsHaveChanged() const;
|
||||
inline void InvalidateStyleForCSSRuleChanges();
|
||||
inline bool MediumFeaturesChanged();
|
||||
inline already_AddRefed<nsStyleContext>
|
||||
ProbePseudoElementStyle(dom::Element* aParentElement,
|
||||
mozilla::CSSPseudoElementType aType,
|
||||
|
@ -239,7 +239,11 @@ StyleSetHandle::Ptr::StyleSheetsHaveChanged() const
|
||||
{
|
||||
FORWARD(StyleSheetsHaveChanged, ());
|
||||
}
|
||||
|
||||
bool
|
||||
StyleSetHandle::Ptr::MediumFeaturesChanged()
|
||||
{
|
||||
FORWARD(MediumFeaturesChanged, ());
|
||||
}
|
||||
void
|
||||
StyleSetHandle::Ptr::InvalidateStyleForCSSRuleChanges()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user