diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index c9d28f227be0021ca42958ad2128f7f08f960297..7e3ed846515ab0b947f62c2b0c1c2fa4f51fc912 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,14 @@ +2012-08-10 Ojan Vafai + + z-index should work without position on flexitems + https://bugs.webkit.org/show_bug.cgi?id=91405 + + Reviewed by Tony Chang. + + * css3/flexbox/z-index-expected.html: Added. + * css3/flexbox/z-index.html: Added. + Use a ref-test since we want to be sure that the elements get painted in the right order. + 2012-08-15 Scott Graham Rename window.internals.fastMallocStatistics to mallocStatistics diff --git a/LayoutTests/css3/flexbox/z-index-expected.html b/LayoutTests/css3/flexbox/z-index-expected.html new file mode 100644 index 0000000000000000000000000000000000000000..2404e99507161ee5ad41a308336297f68d0944f3 --- /dev/null +++ b/LayoutTests/css3/flexbox/z-index-expected.html @@ -0,0 +1,28 @@ + + +
This tests that z-index on non-positioned flex-items works. The green boxes should be above the orange boxes, which should be above the purple boxes, which are above the salmon boxes.
+
+
+
+
+
+
+
+ + + + +
diff --git a/LayoutTests/css3/flexbox/z-index.html b/LayoutTests/css3/flexbox/z-index.html new file mode 100644 index 0000000000000000000000000000000000000000..952a413254427ee789a831207233e215ab12d36f --- /dev/null +++ b/LayoutTests/css3/flexbox/z-index.html @@ -0,0 +1,30 @@ + + +
This tests that z-index on non-positioned flex-items works. The green boxes should be above the orange boxes, which should be above the purple boxes, which are above the salmon boxes.
+
+
+
+
+
+
+
+
+
+
+ + +
+ + +
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 7738d8ab275ca6846f41b3993f7a6eb0d73753d1..b7e1f52f7cf765bffba76086ad0fb99be8182012 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,24 @@ +2012-08-10 Ojan Vafai + + z-index should work without position on flexitems + https://bugs.webkit.org/show_bug.cgi?id=91405 + + Reviewed by Tony Chang. + + Require a layer on any RenderBox that has a non-auto z-index. + Statically positioned, non-flex-item's have their z-index coerced to auto, + so it's safe to check z-index unconditionally. + + Test: css3/flexbox/z-index.html + + * css/StyleResolver.cpp: + (WebCore::StyleResolver::adjustRenderStyle): + -Don't coerce z-index to auto on statically positioned flex-items. + -Use the parentStyle to determine if the parent is a flexbox instead of + looking at the element's parentNode's renderer. + * rendering/RenderBox.h: + -Add having a non-auto z-index to the list of things that require a layer. + 2012-08-15 Joanmarie Diggs [Gtk] atk_text_set_caret_offset() fails for table cells diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp index b1edfd02b1f843112aec28d0b35d6fe277a84b17..9b6f291a773bc640b3ea664f0c8fec36755c776c 100644 --- a/Source/WebCore/css/StyleResolver.cpp +++ b/Source/WebCore/css/StyleResolver.cpp @@ -2067,6 +2067,15 @@ static bool doesNotInheritTextDecoration(RenderStyle* style, Element* e) || style->isFloating() || style->isOutOfFlowPositioned(); } +static bool isDisplayFlexibleBox(EDisplay display) +{ +#if ENABLE(CSS3_FLEXBOX) + return display == FLEX || display == INLINE_FLEX; +#else + return false; +#endif +} + void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e) { ASSERT(parentStyle); @@ -2154,14 +2163,14 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty if (style->writingMode() != TopToBottomWritingMode && (style->display() == BOX || style->display() == INLINE_BOX)) style->setWritingMode(TopToBottomWritingMode); - if (e && e->parentNode() && e->parentNode()->renderer() && e->parentNode()->renderer()->isFlexibleBox()) { + if (isDisplayFlexibleBox(parentStyle->display())) { style->setFloating(NoFloat); style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), m_checker.strictParsing())); } } // Make sure our z-index value is only applied if the object is positioned. - if (style->position() == StaticPosition) + if (style->position() == StaticPosition && !isDisplayFlexibleBox(parentStyle->display())) style->setHasAutoZIndex(); // Auto z-index becomes 0 for the root element and transparent objects. This prevents diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h index 2dcc3cdc7cb04b28e9500ed847508ce33c8abee9..7ff86a07c4049e6bfda52ef773db65788c8696da 100644 --- a/Source/WebCore/rendering/RenderBox.h +++ b/Source/WebCore/rendering/RenderBox.h @@ -42,7 +42,9 @@ public: RenderBox(Node*); virtual ~RenderBox(); - virtual bool requiresLayer() const OVERRIDE { return isRoot() || isOutOfFlowPositioned() || isRelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasMask() || hasReflection() || hasFilter() || style()->specifiesColumns(); } + // hasAutoZIndex only returns true if the element is positioned or a flex-item since + // position:static elements that are not flex-items get their z-index coerced to auto. + virtual bool requiresLayer() const OVERRIDE { return isRoot() || isOutOfFlowPositioned() || isRelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasMask() || hasReflection() || hasFilter() || style()->specifiesColumns() || !style()->hasAutoZIndex(); } // Use this with caution! No type checking is done! RenderBox* firstChildBox() const;