Bug 1153757 - Tweak DoGetParentStyleContext to exclude pseudos with a non-primary frame from using a display:contents parent as the style context parent. r=heycam

This commit is contained in:
Mats Palmgren 2015-04-29 13:13:47 +00:00
parent a7e289a545
commit 73a634ff35
4 changed files with 30 additions and 1 deletions

View File

@ -7919,7 +7919,11 @@ nsFrame::DoGetParentStyleContext(nsIFrame** aProviderFrame) const
if (MOZ_LIKELY(parentContent)) {
nsIAtom* pseudo = StyleContext()->GetPseudo();
if (!pseudo || !mContent->IsElement() ||
!nsCSSAnonBoxes::IsAnonBox(pseudo) ||
(!nsCSSAnonBoxes::IsAnonBox(pseudo) &&
// Ensure that we don't return the display:contents style
// of the parent content for pseudos that have the same content
// as their primary frame (like -moz-list-bullets do):
mContent->GetPrimaryFrame() == this) ||
/* if next is true then it's really a request for the table frame's
parent context, see nsTable[Outer]Frame::GetParentStyleContext. */
pseudo == nsCSSAnonBoxes::tableOuter) {

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html style="margin:2em;">
<head>
<meta charset="UTF-8">
</head>
<body style="margin:0;padding:0"><li style="color:lime;">LI</body></html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html style="margin:2em;color:red">
<head>
<meta charset="UTF-8">
<script>
function boom()
{
document.documentElement.offsetHeight;
document.body.style.position = "fixed";
document.documentElement.offsetHeight;
document.documentElement.style.MozBoxSizing = "border-box";
document.documentElement.offsetHeight;
}
</script>
</head>
<body style="display: contents;" onload="boom();"><li style="color:lime">LI</body></html>

View File

@ -23,3 +23,4 @@ skip-if(B2G||Mulet) asserts(1) pref(layout.css.display-contents.enabled,true) ==
skip pref(layout.css.display-contents.enabled,true) == display-contents-xbl-4.xul display-contents-xbl-4-ref.xul # fails (not just asserts) due to bug 1089223
asserts(0-1) pref(layout.css.display-contents.enabled,true) == display-contents-fieldset.html display-contents-fieldset-ref.html # bug 1089223
skip-if(B2G||Mulet) asserts(1) pref(layout.css.display-contents.enabled,true) == display-contents-xbl-5.xul display-contents-xbl-3-ref.xul # bug 1089223 # Initial mulet triage: parity with B2G/B2G Desktop
pref(layout.css.display-contents.enabled,true) == display-contents-list-item-child.html display-contents-list-item-child-ref.html