Bug 1343078 part 2. Restrict the "is a root" blockification behavior in nsStyleContext to non-pseudos and a limited set of anonymous boxes that want the behavior. r?dbaron
MozReview-Commit-ID: IdUKYbM1i8F
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -860,17 +860,28 @@ nsStyleContext::ApplyStyleFixups(bool aS
// CSS2.1 section 9.2.4 specifies fixups for the 'display' property of
// the root element. We can't implement them in nsRuleNode because we
// don't want to store all display structs that aren't 'block',
// 'inline', or 'table' in the style context tree on the off chance
// that the root element has its style reresolved later. So do them
// here if needed, by changing the style data, so that other code
// doesn't get confused by looking at the style data.
- if (!mParent) {
+ if (!mParent &&
+ // We don't want to blockify various anon boxes that just happen to not
+ // inherit from anything. So restrict blockification only to actual
+ // elements, the viewport (which should be block anyway, but in SVG
+ // document's isn't because we lazy-load ua.css there), and the ::backdrop
+ // pseudo-element. This last is explicitly allowed to have any specified
+ // display type in the spec, but computes to a blockified display type per
+ // various provisions of
+ // https://fullscreen.spec.whatwg.org/#new-stacking-layer
+ (!mPseudoTag ||
+ mPseudoTag == nsCSSAnonBoxes::viewport ||
+ mPseudoTag == nsCSSPseudoElements::backdrop)) {
auto displayVal = disp->mDisplay;
if (displayVal != mozilla::StyleDisplay::Contents) {
nsRuleNode::EnsureBlockDisplay(displayVal, true);
} else {
// http://dev.w3.org/csswg/css-display/#transformations
// "... a display-outside of 'contents' computes to block-level
// on the root element."
displayVal = mozilla::StyleDisplay::Block;