From 73a634ff35fff1bf7a6a359bc07f85f6b07aa2c0 Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Wed, 29 Apr 2015 13:13:47 +0000 Subject: [PATCH] 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 --- layout/generic/nsFrame.cpp | 6 +++++- .../display-contents-list-item-child-ref.html | 6 ++++++ .../display-contents-list-item-child.html | 18 ++++++++++++++++++ layout/reftests/css-display/reftest.list | 1 + 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 layout/reftests/css-display/display-contents-list-item-child-ref.html create mode 100644 layout/reftests/css-display/display-contents-list-item-child.html diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 6bc4e810c4a..dd078eff43c 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -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) { diff --git a/layout/reftests/css-display/display-contents-list-item-child-ref.html b/layout/reftests/css-display/display-contents-list-item-child-ref.html new file mode 100644 index 00000000000..25a9d3fe533 --- /dev/null +++ b/layout/reftests/css-display/display-contents-list-item-child-ref.html @@ -0,0 +1,6 @@ + + + + + +
  • LI diff --git a/layout/reftests/css-display/display-contents-list-item-child.html b/layout/reftests/css-display/display-contents-list-item-child.html new file mode 100644 index 00000000000..8a4916e5a44 --- /dev/null +++ b/layout/reftests/css-display/display-contents-list-item-child.html @@ -0,0 +1,18 @@ + + + + + + +
  • LI diff --git a/layout/reftests/css-display/reftest.list b/layout/reftests/css-display/reftest.list index fb6420bf955..cfe1254409a 100644 --- a/layout/reftests/css-display/reftest.list +++ b/layout/reftests/css-display/reftest.list @@ -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