Changeset 125693 in webkit


Ignore:
Timestamp:
Aug 15, 2012 12:28:20 PM (12 years ago)
Author:
ojan@chromium.org
Message:

z-index should work without position on flexitems
https://bugs.webkit.org/show_bug.cgi?id=91405

Reviewed by Tony Chang.

Source/WebCore:

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.

LayoutTests:

  • 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.

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r125691 r125693  
     12012-08-10  Ojan Vafai  <ojan@chromium.org>
     2
     3        z-index should work without position on flexitems
     4        https://bugs.webkit.org/show_bug.cgi?id=91405
     5
     6        Reviewed by Tony Chang.
     7
     8        * css3/flexbox/z-index-expected.html: Added.
     9        * css3/flexbox/z-index.html: Added.
     10        Use a ref-test since we want to be sure that the elements get painted in the right order.
     11
    1122012-08-15  Scott Graham  <scottmg@chromium.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r125692 r125693  
     12012-08-10  Ojan Vafai  <ojan@chromium.org>
     2
     3        z-index should work without position on flexitems
     4        https://bugs.webkit.org/show_bug.cgi?id=91405
     5
     6        Reviewed by Tony Chang.
     7
     8        Require a layer on any RenderBox that has a non-auto z-index.
     9        Statically positioned, non-flex-item's have their z-index coerced to auto,
     10        so it's safe to check z-index unconditionally.
     11
     12        Test: css3/flexbox/z-index.html
     13
     14        * css/StyleResolver.cpp:
     15        (WebCore::StyleResolver::adjustRenderStyle):
     16        -Don't coerce z-index to auto on statically positioned flex-items.
     17        -Use the parentStyle to determine if the parent is a flexbox instead of
     18        looking at the element's parentNode's renderer.
     19        * rendering/RenderBox.h:
     20        -Add having a non-auto z-index to the list of things that require a layer.
     21
    1222012-08-15  Joanmarie Diggs  <jdiggs@igalia.com>
    223
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r125384 r125693  
    20682068}
    20692069
     2070static bool isDisplayFlexibleBox(EDisplay display)
     2071{
     2072#if ENABLE(CSS3_FLEXBOX)
     2073    return display == FLEX || display == INLINE_FLEX;
     2074#else
     2075    return false;
     2076#endif
     2077}
     2078
    20702079void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e)
    20712080{
     
    21552164            style->setWritingMode(TopToBottomWritingMode);
    21562165
    2157         if (e && e->parentNode() && e->parentNode()->renderer() && e->parentNode()->renderer()->isFlexibleBox()) {
     2166        if (isDisplayFlexibleBox(parentStyle->display())) {
    21582167            style->setFloating(NoFloat);
    21592168            style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), m_checker.strictParsing()));
     
    21622171
    21632172    // Make sure our z-index value is only applied if the object is positioned.
    2164     if (style->position() == StaticPosition)
     2173    if (style->position() == StaticPosition && !isDisplayFlexibleBox(parentStyle->display()))
    21652174        style->setHasAutoZIndex();
    21662175
  • trunk/Source/WebCore/rendering/RenderBox.h

    r125055 r125693  
    4343    virtual ~RenderBox();
    4444
    45     virtual bool requiresLayer() const OVERRIDE { return isRoot() || isOutOfFlowPositioned() || isRelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasMask() || hasReflection() || hasFilter() || style()->specifiesColumns(); }
     45    // hasAutoZIndex only returns true if the element is positioned or a flex-item since
     46    // position:static elements that are not flex-items get their z-index coerced to auto.
     47    virtual bool requiresLayer() const OVERRIDE { return isRoot() || isOutOfFlowPositioned() || isRelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasMask() || hasReflection() || hasFilter() || style()->specifiesColumns() || !style()->hasAutoZIndex(); }
    4648
    4749    // Use this with caution! No type checking is done!
Note: See TracChangeset for help on using the changeset viewer.