From 49e9f0770be8d109b114ed36be7f3c94af779bc9 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Fri, 30 Nov 2012 00:13:23 -0800 Subject: [PATCH] Bug 808767: Put flex items' borders & backgrounds into the BlockBorderBackgrounds display-list, so that overlapping flex items & their contents will paint in the right order. r=dbaron --- layout/generic/nsFlexContainerFrame.cpp | 6 +- .../flexbox-paint-ordering-1-ref.xhtml | 76 ++++++++++++++++ .../flexbox/flexbox-paint-ordering-1.xhtml | 86 +++++++++++++++++++ layout/reftests/flexbox/reftest.list | 3 + 4 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 layout/reftests/flexbox/flexbox-paint-ordering-1-ref.xhtml create mode 100644 layout/reftests/flexbox/flexbox-paint-ordering-1.xhtml diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp index 0a9b036bc4f1..c5086a2eedd6 100644 --- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -8,6 +8,7 @@ /* rendering object for CSS "display: flex" */ #include "nsFlexContainerFrame.h" +#include "nsDisplayList.h" #include "nsLayoutUtils.h" #include "nsPresContext.h" #include "nsStyleContext.h" @@ -980,8 +981,11 @@ nsFlexContainerFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, nsresult rv = DisplayBorderBackgroundOutline(aBuilder, aLists); NS_ENSURE_SUCCESS(rv, rv); + // Our children are all block-level, so their borders/backgrounds all go on + // the BlockBorderBackgrounds list. + nsDisplayListSet childLists(aLists, aLists.BlockBorderBackgrounds()); for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) { - rv = BuildDisplayListForChild(aBuilder, e.get(), aDirtyRect, aLists, + rv = BuildDisplayListForChild(aBuilder, e.get(), aDirtyRect, childLists, GetDisplayFlagsForFlexItem(e.get())); NS_ENSURE_SUCCESS(rv, rv); } diff --git a/layout/reftests/flexbox/flexbox-paint-ordering-1-ref.xhtml b/layout/reftests/flexbox/flexbox-paint-ordering-1-ref.xhtml new file mode 100644 index 000000000000..c75547136781 --- /dev/null +++ b/layout/reftests/flexbox/flexbox-paint-ordering-1-ref.xhtml @@ -0,0 +1,76 @@ + + + + + + + + +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ + + diff --git a/layout/reftests/flexbox/flexbox-paint-ordering-1.xhtml b/layout/reftests/flexbox/flexbox-paint-ordering-1.xhtml new file mode 100644 index 000000000000..dc78884c7c92 --- /dev/null +++ b/layout/reftests/flexbox/flexbox-paint-ordering-1.xhtml @@ -0,0 +1,86 @@ + + + + + + + + + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ +
+ + +
+
+
+
+ + +
+
+
+
+ +
+ + +
+
+
+
+ + + diff --git a/layout/reftests/flexbox/reftest.list b/layout/reftests/flexbox/reftest.list index 6600ddbe15c6..d3ba78f9e1c3 100644 --- a/layout/reftests/flexbox/reftest.list +++ b/layout/reftests/flexbox/reftest.list @@ -100,6 +100,9 @@ test-pref(layout.css.flexbox.enabled,true) == flexbox-items-as-stacking-contexts test-pref(layout.css.flexbox.enabled,true) == flexbox-minSize-horiz-1.xhtml flexbox-minSize-horiz-1-ref.xhtml test-pref(layout.css.flexbox.enabled,true) == flexbox-minSize-vert-1.xhtml flexbox-minSize-vert-1-ref.xhtml +# Tests for the order in which we paint flex items +test-pref(layout.css.flexbox.enabled,true) == flexbox-paint-ordering-1.xhtml flexbox-paint-ordering-1-ref.xhtml + # Tests for handling of absolutely/fixed/relatively-positioned flex items. test-pref(layout.css.flexbox.enabled,true) == flexbox-position-absolute-1.xhtml flexbox-position-absolute-1-ref.xhtml test-pref(layout.css.flexbox.enabled,true) == flexbox-position-absolute-2.xhtml flexbox-position-absolute-2-ref.xhtml