From b38b58369ff795df5e09a578dd855d07384b62f6 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Wed, 26 Feb 2014 13:36:36 -0800 Subject: [PATCH] Bug 976364: Make 'perspective' create a stacking context. r=mattwoodrow While it seems a little silly since 'perspective' doesn't require atomicity (rather, it adds an additional transformation to any 3-D descendants, which already require atomicity), the spec requires it, and it matches WebKit. --- layout/generic/nsFrame.cpp | 3 +++ layout/reftests/z-index/reftest.list | 2 ++ .../z-index/stacking-context-common.css | 26 +++++++++++++++++++ .../reftests/z-index/stacking-context-no.html | 11 ++++++++ .../z-index/stacking-context-perspective.html | 17 ++++++++++++ .../z-index/stacking-context-yes.html | 16 ++++++++++++ 6 files changed, 75 insertions(+) create mode 100644 layout/reftests/z-index/stacking-context-common.css create mode 100644 layout/reftests/z-index/stacking-context-no.html create mode 100644 layout/reftests/z-index/stacking-context-perspective.html create mode 100644 layout/reftests/z-index/stacking-context-yes.html diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 826d24dcce9..328a3f3efb5 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -2180,6 +2180,9 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder, const nsStylePosition* pos = child->StylePosition(); bool isVisuallyAtomic = child->HasOpacity() || child->IsTransformed() + // strictly speaking, 'perspective' doesn't require visual atomicity, + // but the spec says it acts like the rest of these + || disp->mChildPerspective.GetUnit() == eStyleUnit_Coord || disp->mMixBlendMode != NS_STYLE_BLEND_NORMAL || nsSVGIntegrationUtils::UsingEffectsForFrame(child); diff --git a/layout/reftests/z-index/reftest.list b/layout/reftests/z-index/reftest.list index 8c7fd4b4489..23105ade736 100644 --- a/layout/reftests/z-index/reftest.list +++ b/layout/reftests/z-index/reftest.list @@ -1,2 +1,4 @@ == 480053-1.html 480053-1-ref.html == z-index-1.html z-index-1-ref.html +!= stacking-context-yes.html stacking-context-no.html +== stacking-context-perspective.html stacking-context-yes.html diff --git a/layout/reftests/z-index/stacking-context-common.css b/layout/reftests/z-index/stacking-context-common.css new file mode 100644 index 00000000000..1f4f0938128 --- /dev/null +++ b/layout/reftests/z-index/stacking-context-common.css @@ -0,0 +1,26 @@ +.contain, .maybesc { + width: 100px; + height: 100px; +} +.contain, .maybesc { + position: relative; +} +.inner1, .inner3, .intruder { + position: absolute; + top: 0; left: 0; bottom: 0; right: 0; +} +.inner1 { + left: 5px; right: 30px; + background: rgba(0, 255, 255, 0.5); /* aqua */ + z-index: 1; +} +.inner3 { + left: 30px; right: 5px; + background: rgba(255, 255, 0, 0.5); /* yellow */ + z-index: 3; +} +.intruder { + top: 20px; bottom: 20px; + background: rgba(255, 0, 255, 0.5); /* fuchsia */ + z-index: 2; +} diff --git a/layout/reftests/z-index/stacking-context-no.html b/layout/reftests/z-index/stacking-context-no.html new file mode 100644 index 00000000000..168a1761de6 --- /dev/null +++ b/layout/reftests/z-index/stacking-context-no.html @@ -0,0 +1,11 @@ + + +Reference for things that do not create a stacking context + +
+
+
+
+
+
+
diff --git a/layout/reftests/z-index/stacking-context-perspective.html b/layout/reftests/z-index/stacking-context-perspective.html new file mode 100644 index 00000000000..a9b99c86fc3 --- /dev/null +++ b/layout/reftests/z-index/stacking-context-perspective.html @@ -0,0 +1,17 @@ + + +Does 'perspective' create a stacking context? + + +
+
+
+
+
+
+
diff --git a/layout/reftests/z-index/stacking-context-yes.html b/layout/reftests/z-index/stacking-context-yes.html new file mode 100644 index 00000000000..bdb9567b542 --- /dev/null +++ b/layout/reftests/z-index/stacking-context-yes.html @@ -0,0 +1,16 @@ + + +Reference for things that create a stacking context + + +
+
+
+
+
+
+