Bug 1047928 patch 9 - Don't rerun selector matching for viewport units. r=bzbarsky

This commit is contained in:
L. David Baron 2014-10-08 14:27:03 -07:00
Родитель 58593a97a3
Коммит ec4c95d775
1 изменённых файлов: 18 добавлений и 10 удалений

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

@ -1885,19 +1885,27 @@ void
nsPresContext::MediaFeatureValuesChanged(StyleRebuildType aShouldRebuild, nsPresContext::MediaFeatureValuesChanged(StyleRebuildType aShouldRebuild,
nsChangeHint aChangeHint) nsChangeHint aChangeHint)
{ {
NS_ASSERTION(aShouldRebuild == eAlwaysRebuildStyle || aChangeHint == 0,
"If you don't know if we need a rebuild, how can you provide a hint?");
mPendingMediaFeatureValuesChanged = false; mPendingMediaFeatureValuesChanged = false;
// MediumFeaturesChanged updates the applied rules, so it always gets called. nsRestyleHint aRestyleHint = nsRestyleHint(0);
bool mediaFeaturesDidChange = mShell ? mShell->StyleSet()->MediumFeaturesChanged(this)
: false;
if (aShouldRebuild == eAlwaysRebuildStyle || if (aShouldRebuild == eAlwaysRebuildStyle) {
mediaFeaturesDidChange || // FIXME: Pass restyle hint from caller.
(mUsesViewportUnits && mPendingViewportChange)) { aRestyleHint |= eRestyle_Subtree;
RebuildAllStyleData(aChangeHint, eRestyle_Subtree); }
// MediumFeaturesChanged updates the applied rules, so it always gets called.
if (mShell && mShell->StyleSet()->MediumFeaturesChanged(this)) {
aRestyleHint |= eRestyle_Subtree;
}
if (mUsesViewportUnits && mPendingViewportChange) {
// Rebuild all style data without rerunning selector matching.
aRestyleHint |= eRestyle_ForceDescendants;
}
if (aRestyleHint || aChangeHint) {
RebuildAllStyleData(aChangeHint, aRestyleHint);
} }
mPendingViewportChange = false; mPendingViewportChange = false;