Backed out changeset 972821835d48 (bug 1382077)

This commit is contained in:
Carsten "Tomcat" Book 2017-07-25 12:17:16 +02:00
parent 28e9645f51
commit c7741ea7ea
6 changed files with 26 additions and 27 deletions

View File

@ -274,6 +274,7 @@ nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType)
mIsGlyph(false),
mUsesRootEMUnits(false),
mUsesExChUnits(false),
mUsesViewportUnits(false),
mPendingViewportChange(false),
mCounterStylesDirty(true),
mPostedFlushCounterStyles(false),
@ -2058,9 +2059,7 @@ nsPresContext::RebuildAllStyleData(nsChangeHint aExtraHint,
mUsesRootEMUnits = false;
mUsesExChUnits = false;
if (nsStyleSet* styleSet = mShell->StyleSet()->GetAsGecko()) {
styleSet->SetUsesViewportUnits(false);
}
mUsesViewportUnits = false;
mDocument->RebuildUserFontSet();
RebuildCounterStyles();
@ -2123,6 +2122,18 @@ nsPresContext::MediaFeatureValuesChanged(nsRestyleHint aRestyleHint,
StyleSet()->MediumFeaturesChanged(mPendingViewportChange);
}
if (mPendingViewportChange &&
(mUsesViewportUnits || mDocument->IsStyledByServo())) {
// Rebuild all style data without rerunning selector matching.
//
// FIXME(emilio, bug 1328652): We don't set mUsesViewportUnits in stylo yet,
// so assume the worst.
//
// Also, in this case we don't need to do a rebuild of the style data, only
// post a restyle.
aRestyleHint |= eRestyle_ForceDescendants;
}
if (aRestyleHint || aChangeHint) {
RebuildAllStyleData(aChangeHint, aRestyleHint);
}

View File

@ -1153,6 +1153,14 @@ public:
mUsesExChUnits = aValue;
}
bool UsesViewportUnits() const {
return mUsesViewportUnits;
}
void SetUsesViewportUnits(bool aValue) {
mUsesViewportUnits = aValue;
}
// true if there are OMTA transition updates for the current document which
// have been throttled, and therefore some style information may not be up
// to date
@ -1459,6 +1467,8 @@ protected:
unsigned mUsesRootEMUnits : 1;
// Does the associated document use ex or ch units?
unsigned mUsesExChUnits : 1;
// Does the associated document use viewport units (vw/vh/vmin/vmax)?
unsigned mUsesViewportUnits : 1;
// Has there been a change to the viewport's dimensions?
unsigned mPendingViewportChange : 1;

View File

@ -119,13 +119,6 @@ ServoStyleSet::MediumFeaturesChanged(bool aViewportChanged) const
if (Servo_StyleSet_MediumFeaturesChanged(mRawSet.get())) {
return eRestyle_Subtree;
}
if (aViewportChanged) {
// Rebuild all style data without rerunning selector matching.
//
// FIXME(emilio, bug 1328652): We don't set mUsesViewportUnits in stylo yet,
// so assume the worst.
return eRestyle_ForceDescendants;
}
return nsRestyleHint(0);
}

View File

@ -471,14 +471,10 @@ nsRuleNode::ApplyMinFontSize(nsStyleFont* aFont,
static nsSize CalcViewportUnitsScale(nsPresContext* aPresContext)
{
// The caller is making use of viewport units, so notify the style set
// The caller is making use of viewport units, so notify the pres context
// that it will need to rebuild the rule tree if the size of the viewport
// changes.
// It is possible for this to be called on a Servo-styled document,from
// media query evaluation outside stylesheets.
if (nsStyleSet* styleSet = aPresContext->StyleSet()->GetAsGecko()) {
styleSet->SetUsesViewportUnits(true);
}
aPresContext->SetUsesViewportUnits(true);
// The default (when we have 'overflow: auto' on the root element, or
// trivially for 'overflow: hidden' since we never have scrollbars in that

View File

@ -219,7 +219,6 @@ nsStyleSet::nsStyleSet()
mInReconstruct(false),
mInitFontFeatureValuesLookup(true),
mNeedsRestyleAfterEnsureUniqueInner(false),
mUsesViewportUnits(false),
mDirty(0),
mRootStyleContextCount(0),
#ifdef DEBUG
@ -2704,10 +2703,6 @@ nsStyleSet::MediumFeaturesChanged(bool aViewportChanged)
if (stylesChanged) {
return eRestyle_Subtree;
}
if (aViewportChanged && mUsesViewportUnits) {
// Rebuild all style data without rerunning selector matching.
return eRestyle_ForceDescendants;
}
return nsRestyleHint(0);
}

View File

@ -491,10 +491,6 @@ class nsStyleSet final
// of CSS sheet types.
static bool IsCSSSheetType(mozilla::SheetType aSheetType);
void SetUsesViewportUnits(bool aValue) {
mUsesViewportUnits = aValue;
}
private:
nsStyleSet(const nsStyleSet& aCopy) = delete;
nsStyleSet& operator=(const nsStyleSet& aCopy) = delete;
@ -637,8 +633,6 @@ private:
unsigned mInReconstruct : 1;
unsigned mInitFontFeatureValuesLookup : 1;
unsigned mNeedsRestyleAfterEnsureUniqueInner : 1;
// Does the associated document use viewport units (vw/vh/vmin/vmax)?
unsigned mUsesViewportUnits : 1;
unsigned mDirty : int(mozilla::SheetType::Count); // one bit per sheet type
uint32_t mRootStyleContextCount;