Bug 1382077 part 1 - Have StyleSet::MediumFeaturesChanged return nsRestyleHint rather than a bool. r=heycam

MozReview-Commit-ID: 5g3mHU8pxXP

--HG--
extra : rebase_source : aff51be14395850620fe43d814c49e30a3048be5
This commit is contained in:
Xidorn Quan 2017-07-24 11:27:08 +10:00
Родитель f54d2052b3
Коммит d8543d6975
7 изменённых файлов: 23 добавлений и 16 удалений

Просмотреть файл

@ -2117,8 +2117,9 @@ nsPresContext::MediaFeatureValuesChanged(nsRestyleHint aRestyleHint,
mPendingMediaFeatureValuesChanged = false;
// MediumFeaturesChanged updates the applied rules, so it always gets called.
if (mShell && mShell->StyleSet()->MediumFeaturesChanged()) {
aRestyleHint |= eRestyle_Subtree;
if (mShell) {
aRestyleHint |= mShell->
StyleSet()->MediumFeaturesChanged(mPendingViewportChange);
}
if (mPendingViewportChange &&

Просмотреть файл

@ -113,10 +113,13 @@ ServoStyleSet::InvalidateStyleForCSSRuleChanges()
mPresContext->RestyleManager()->AsServo()->PostRestyleEventForCSSRuleChanges();
}
bool
ServoStyleSet::MediumFeaturesChanged() const
nsRestyleHint
ServoStyleSet::MediumFeaturesChanged(bool aViewportChanged) const
{
return Servo_StyleSet_MediumFeaturesChanged(mRawSet.get());
if (Servo_StyleSet_MediumFeaturesChanged(mRawSet.get())) {
return eRestyle_Subtree;
}
return nsRestyleHint(0);
}
size_t

Просмотреть файл

@ -115,7 +115,7 @@ public:
return StylistNeedsUpdate();
}
bool MediumFeaturesChanged() const;
nsRestyleHint MediumFeaturesChanged(bool aViewportChanged) const;
void InvalidateStyleForCSSRuleChanges();

Просмотреть файл

@ -160,7 +160,7 @@ public:
inline void RecordShadowStyleChange(mozilla::dom::ShadowRoot* aShadowRoot);
inline bool StyleSheetsHaveChanged() const;
inline void InvalidateStyleForCSSRuleChanges();
inline bool MediumFeaturesChanged();
inline nsRestyleHint MediumFeaturesChanged(bool aViewportChanged);
inline already_AddRefed<nsStyleContext>
ProbePseudoElementStyle(dom::Element* aParentElement,
mozilla::CSSPseudoElementType aType,

Просмотреть файл

@ -256,10 +256,10 @@ StyleSetHandle::Ptr::StyleSheetsHaveChanged() const
{
FORWARD(StyleSheetsHaveChanged, ());
}
bool
StyleSetHandle::Ptr::MediumFeaturesChanged()
nsRestyleHint
StyleSetHandle::Ptr::MediumFeaturesChanged(bool aViewportChanged)
{
FORWARD(MediumFeaturesChanged, ());
FORWARD(MediumFeaturesChanged, (aViewportChanged));
}
void
StyleSetHandle::Ptr::InvalidateStyleForCSSRuleChanges()

Просмотреть файл

@ -2674,8 +2674,8 @@ nsStyleSet::HasAttributeDependentStyle(Element* aElement,
return data.mHint;
}
bool
nsStyleSet::MediumFeaturesChanged()
nsRestyleHint
nsStyleSet::MediumFeaturesChanged(bool aViewportChanged)
{
NS_ASSERTION(mBatching == 0, "rule processors out of date");
@ -2700,7 +2700,10 @@ nsStyleSet::MediumFeaturesChanged()
stylesChanged = stylesChanged || thisChanged;
}
return stylesChanged;
if (stylesChanged) {
return eRestyle_Subtree;
}
return nsRestyleHint(0);
}
bool

Просмотреть файл

@ -380,10 +380,10 @@ class nsStyleSet final
/*
* Do any processing that needs to happen as a result of a change in
* the characteristics of the medium, and return whether style rules
* may have changed as a result.
* the characteristics of the medium, and return restyle hint needed
* for the change.
*/
bool MediumFeaturesChanged();
nsRestyleHint MediumFeaturesChanged(bool aViewportChanged);
// APIs to manipulate the style sheet lists. The sheets in each
// list are stored with the most significant sheet last.