Bug 1298588 part 4, gecko piece. Recreate the default computed values for a document as needed. r=bholley

This commit is contained in:
Boris Zbarsky 2017-01-04 14:52:27 -05:00
Родитель 6104ba14f9
Коммит 9f8934b143
4 изменённых файлов: 27 добавлений и 0 удалений

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

@ -87,6 +87,18 @@ ServoRestyleManager::RebuildAllStyleData(nsChangeHint aExtraHint,
nsRestyleHint aRestyleHint)
{
NS_WARNING("stylo: ServoRestyleManager::RebuildAllStyleData not implemented");
// That said, we do know that rebuilding all style data in Gecko would get rid
// of the old ruletree, and hence of the cached-on-the-root default computed
// styles. So we know we need to clear them here. I think this is the only
// way they could get cleared, in fact, though not _all_ calls that come
// through here may need to clear them in practice.
//
// We probably need to do some actual restyling here too, though. And figure
// out whether it actually matters that we may be recomputing the default
// styles in too many cases. For one thing, we do a bunch of eager work here,
// whereas we should really just set a bit that says to recompute the default
// computed styles before the next time we restyle anything!
StyleSet()->RecomputeDefaultComputedStyles();
}
void

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

@ -51,6 +51,9 @@ SERVO_BINDING_FUNC(Servo_StyleSheet_HasRules, bool,
SERVO_BINDING_FUNC(Servo_StyleSheet_GetRules, ServoCssRulesStrong,
RawServoStyleSheetBorrowed sheet)
SERVO_BINDING_FUNC(Servo_StyleSet_Init, RawServoStyleSetOwned, RawGeckoPresContextBorrowed pres_context)
SERVO_BINDING_FUNC(Servo_StyleSet_RecomputeDefaultStyles, void,
RawServoStyleSetBorrowed set,
RawGeckoPresContextBorrowed pres_context)
SERVO_BINDING_FUNC(Servo_StyleSet_Drop, void, RawServoStyleSetOwned set)
SERVO_BINDING_FUNC(Servo_StyleSet_AppendStyleSheet, void,
RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet, bool flush)

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

@ -550,3 +550,9 @@ ServoStyleSet::AssertTreeIsClean()
}
}
#endif
void
ServoStyleSet::RecomputeDefaultComputedStyles()
{
Servo_StyleSet_RecomputeDefaultStyles(mRawSet.get(), mPresContext);
}

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

@ -162,6 +162,12 @@ public:
void AssertTreeIsClean() {}
#endif
/**
* Recompute our default computed styles. This will eagerly create a new set
* of default computed style structs.
*/
void RecomputeDefaultComputedStyles();
private:
already_AddRefed<nsStyleContext> GetContext(already_AddRefed<ServoComputedValues>,
nsStyleContext* aParentContext,