зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1382077 part 2 - Move mUsesViewportUnits into nsStyleSet. r=heycam
MozReview-Commit-ID: DQ4ZoLLNPeN --HG-- extra : rebase_source : 789b1b58eb760e74802dfac1c5b4070f02e1185c
This commit is contained in:
Родитель
d8543d6975
Коммит
935b4c943f
|
@ -274,7 +274,6 @@ nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType)
|
|||
mIsGlyph(false),
|
||||
mUsesRootEMUnits(false),
|
||||
mUsesExChUnits(false),
|
||||
mUsesViewportUnits(false),
|
||||
mPendingViewportChange(false),
|
||||
mCounterStylesDirty(true),
|
||||
mPostedFlushCounterStyles(false),
|
||||
|
@ -2059,7 +2058,9 @@ nsPresContext::RebuildAllStyleData(nsChangeHint aExtraHint,
|
|||
|
||||
mUsesRootEMUnits = false;
|
||||
mUsesExChUnits = false;
|
||||
mUsesViewportUnits = false;
|
||||
if (nsStyleSet* styleSet = mShell->StyleSet()->GetAsGecko()) {
|
||||
styleSet->SetUsesViewportUnits(false);
|
||||
}
|
||||
mDocument->RebuildUserFontSet();
|
||||
RebuildCounterStyles();
|
||||
|
||||
|
@ -2122,18 +2123,6 @@ 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);
|
||||
}
|
||||
|
|
|
@ -1153,14 +1153,6 @@ 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
|
||||
|
@ -1467,8 +1459,6 @@ 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;
|
||||
|
|
|
@ -119,6 +119,13 @@ 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -471,10 +471,14 @@ nsRuleNode::ApplyMinFontSize(nsStyleFont* aFont,
|
|||
|
||||
static nsSize CalcViewportUnitsScale(nsPresContext* aPresContext)
|
||||
{
|
||||
// The caller is making use of viewport units, so notify the pres context
|
||||
// The caller is making use of viewport units, so notify the style set
|
||||
// that it will need to rebuild the rule tree if the size of the viewport
|
||||
// changes.
|
||||
aPresContext->SetUsesViewportUnits(true);
|
||||
// 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);
|
||||
}
|
||||
|
||||
// The default (when we have 'overflow: auto' on the root element, or
|
||||
// trivially for 'overflow: hidden' since we never have scrollbars in that
|
||||
|
|
|
@ -219,6 +219,7 @@ nsStyleSet::nsStyleSet()
|
|||
mInReconstruct(false),
|
||||
mInitFontFeatureValuesLookup(true),
|
||||
mNeedsRestyleAfterEnsureUniqueInner(false),
|
||||
mUsesViewportUnits(false),
|
||||
mDirty(0),
|
||||
mRootStyleContextCount(0),
|
||||
#ifdef DEBUG
|
||||
|
@ -2703,6 +2704,10 @@ 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -491,6 +491,10 @@ 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;
|
||||
|
@ -633,6 +637,8 @@ 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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче