Bug 1230466. Make sure to update our scrollbar styles when a <body> is removed from the DOM, since we might now need to propagate from some other element. r=roc

This commit is contained in:
Boris Zbarsky 2015-12-08 14:55:50 -05:00
parent 7891e4b101
commit 76d78ff09a
4 changed files with 25 additions and 0 deletions

View File

@ -7895,6 +7895,13 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
*aDestroyedFramesFor = aChild;
}
if (aChild->IsHTMLElement(nsGkAtoms::body) ||
(!aContainer && aChild->IsElement())) {
// This might be the element we propagated viewport scrollbar
// styles from. Recompute those.
mPresShell->GetPresContext()->UpdateViewportScrollbarStylesOverride();
}
// XXXldb Do we need to re-resolve style to handle the CSS2 + combinator and
// the :empty pseudo-class?

View File

@ -1634,6 +1634,11 @@ GetPropagatedScrollbarStylesForViewport(nsPresContext* aPresContext,
nsIDocument* document = aPresContext->Document();
Element* docElement = document->GetRootElement();
// docElement might be null if we're doing this after removing it.
if (!docElement) {
return nullptr;
}
// Check the style on the document root element
nsStyleSet *styleSet = aPresContext->StyleSet();
RefPtr<nsStyleContext> rootStyle;

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<body>
<script>
var b = document.createElement("body");
b.style.overflow = "scroll";
var h = document.documentElement;
h.insertBefore(b, h.firstChild);
b.offsetWidth;
b.remove();
</script>
</html>

View File

@ -1943,3 +1943,4 @@ fuzzy(1,74) fuzzy-if(gtkWidget,6,79) == 1174332-1.html 1174332-1-ref.html
== 1209994-4.html 1209994-4-ref.html
== 1222226-1.html 1222226-1-ref.html
pref(layout.css.overflow-clip-box.enabled,true) == 1226278.html 1226278-ref.html
== 1230466.html about:blank