зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1541126 - Invalidate ShadowRoot style data when the document's compat mode changes. r=heycam
This testcase triggers a case which I hoped I wouldn't need to handle: The presence of a shadow root in the tree already by the time our compatibility mode changes. Just invalidate ShadowRoot data when this happens the same way we invalidate the document style data. Differential Revision: https://phabricator.services.mozilla.com/D25928 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
0c34c4b04f
Коммит
216f9c90e5
|
@ -242,6 +242,7 @@ RestyleHint ServoStyleSet::MediumFeaturesChanged(
|
|||
}
|
||||
|
||||
if (rulesChanged) {
|
||||
// TODO(emilio): This could be more granular.
|
||||
return RestyleHint::RestyleSubtree();
|
||||
}
|
||||
|
||||
|
@ -933,31 +934,24 @@ void ServoStyleSet::MarkOriginsDirty(OriginFlags aChangedOrigins) {
|
|||
}
|
||||
|
||||
void ServoStyleSet::SetStylistStyleSheetsDirty() {
|
||||
// Note that there's another hidden mutator of mStylistState for XBL style
|
||||
// sets in MediumFeaturesChanged...
|
||||
//
|
||||
// We really need to stop using a full-blown StyleSet there...
|
||||
mStylistState |= StylistState::StyleSheetsDirty;
|
||||
|
||||
// We need to invalidate cached style in getComputedStyle for undisplayed
|
||||
// elements, since we don't know if any of the style sheet change that we
|
||||
// do would affect undisplayed elements.
|
||||
// elements, since we don't know if any of the style sheet change that we do
|
||||
// would affect undisplayed elements.
|
||||
//
|
||||
// We don't allow to call getComputedStyle in elements without a pres shell
|
||||
// yet, so it is fine if there's no pres context here.
|
||||
if (nsPresContext* presContext = GetPresContext()) {
|
||||
// XBL sheets don't have a pres context, but invalidating the restyle
|
||||
// generation in that case is handled by SetXBLStyleSheetsDirty in the
|
||||
// "master" stylist.
|
||||
presContext->RestyleManager()->IncrementUndisplayedRestyleGeneration();
|
||||
}
|
||||
}
|
||||
|
||||
void ServoStyleSet::SetStylistXBLStyleSheetsDirty() {
|
||||
mStylistState |= StylistState::XBLStyleSheetsDirty;
|
||||
|
||||
// We need to invalidate cached style in getComputedStyle for undisplayed
|
||||
// elements, since we don't know if any of the style sheet change that we
|
||||
// do would affect undisplayed elements.
|
||||
MOZ_ASSERT(GetPresContext());
|
||||
GetPresContext()->RestyleManager()->IncrementUndisplayedRestyleGeneration();
|
||||
if (nsPresContext* presContext = GetPresContext()) {
|
||||
presContext->RestyleManager()->IncrementUndisplayedRestyleGeneration();
|
||||
}
|
||||
}
|
||||
|
||||
void ServoStyleSet::RuleAdded(StyleSheet& aSheet, css::Rule& aRule) {
|
||||
|
@ -1142,6 +1136,16 @@ void ServoStyleSet::ClearCachedStyleData() {
|
|||
void ServoStyleSet::CompatibilityModeChanged() {
|
||||
Servo_StyleSet_CompatModeChanged(mRawSet.get());
|
||||
SetStylistStyleSheetsDirty();
|
||||
bool anyShadow = false;
|
||||
EnumerateShadowRoots(*mDocument, [&](ShadowRoot& aShadowRoot) {
|
||||
if (auto* authorStyles = aShadowRoot.GetServoStyles()) {
|
||||
anyShadow = true;
|
||||
Servo_AuthorStyles_ForceDirty(authorStyles);
|
||||
}
|
||||
});
|
||||
if (anyShadow) {
|
||||
SetStylistXBLStyleSheetsDirty();
|
||||
}
|
||||
}
|
||||
|
||||
void ServoStyleSet::ClearNonInheritingComputedStyles() {
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<html class="reftest-wait">
|
||||
<script>
|
||||
function eh1() {
|
||||
a.selectionEnd = 1
|
||||
}
|
||||
function eh2() {
|
||||
var d = c.contentDocument.createRange()
|
||||
d.cloneRange().insertNode(b)
|
||||
requestAnimationFrame(() => {
|
||||
requestAnimationFrame(() => {
|
||||
document.documentElement.className = "";
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<textarea id="a" onselect="eh2()">
|
||||
</textarea>
|
||||
<video id="b" controls=""></video>
|
||||
<iframe id="c" srcdoc=""></iframe>
|
||||
<details ontoggle="eh1()" open="">
|
|
@ -301,3 +301,4 @@ load 1514086.html
|
|||
pref(layout.css.moz-binding.content.enabled,false) load 1517319.html
|
||||
load 1533891.html
|
||||
load 1533783.html
|
||||
load 1541126.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче