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,
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;
// MediumFeaturesChanged updates the applied rules, so it always gets called.
bool mediaFeaturesDidChange = mShell ? mShell->StyleSet()->MediumFeaturesChanged(this)
: false;
nsRestyleHint aRestyleHint = nsRestyleHint(0);
if (aShouldRebuild == eAlwaysRebuildStyle ||
mediaFeaturesDidChange ||
(mUsesViewportUnits && mPendingViewportChange)) {
RebuildAllStyleData(aChangeHint, eRestyle_Subtree);
if (aShouldRebuild == eAlwaysRebuildStyle) {
// FIXME: Pass restyle hint from caller.
aRestyleHint |= 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;