Changeset 170474 in webkit


Ignore:
Timestamp:
Jun 26, 2014 12:30:01 AM (10 years ago)
Author:
Manuel Rego Casasnovas
Message:

[CSS Grid Layout] Properly support for z-index on grid items
https://bugs.webkit.org/show_bug.cgi?id=103329

Reviewed by Benjamin Poulain.

From Blink r157620 by <jchaffraix@chromium.org> and r172402 by
<wangxianzhu@chromium.org>.

Source/WebCore:
The specification says that grid should match flexbox and force
grid items to be stacking context if z-index is set, regardless
of 'position'. After this change, this is what happens.

Previously z-index changes of static positioned objects were ignored.
However, z-index is applicable for some static positioned objects,
such as grid items. Ignoring them makes the object not to be properly
painted on z-index change.

As StyleResolver has ensured that z-index is non-auto only if
applicable, RenderStyle::changeRequiresLayerRepaint() should not check
again (with inconsistent conditions).

Tests: fast/css-grid-layout/grid-item-z-index-change-repaint.html

fast/css-grid-layout/grid-item-z-index-stacking-context.html
fast/css-grid-layout/grid-item-z-index-support.html

  • css/StyleResolver.cpp:

(WebCore::isDisplayFlexibleOrGridBox): Add new method to check if parent
display is flexbox or grid.
(WebCore::StyleResolver::adjustRenderStyle): Use new method in z-index
condition.

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::changeRequiresLayerRepaint): Move z-index checks
out of non-static positioned objects if.

LayoutTests:

  • css3/blending/repaint/blend-mode-turn-off-isolation-expected.txt: Test rebaseline.
  • fast/css-grid-layout/grid-item-z-index-change-repaint-expected.html: Added.
  • fast/css-grid-layout/grid-item-z-index-change-repaint.html: Added.
  • fast/css-grid-layout/grid-item-z-index-stacking-context-expected.html: Added.
  • fast/css-grid-layout/grid-item-z-index-stacking-context.html: Added.
  • fast/css-grid-layout/grid-item-z-index-support-expected.txt: Added.
  • fast/css-grid-layout/grid-item-z-index-support.html: Added.
Location:
trunk
Files:
6 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r170454 r170474  
     12014-06-26  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [CSS Grid Layout] Properly support for z-index on grid items
     4        https://bugs.webkit.org/show_bug.cgi?id=103329
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        From Blink r157620 by <jchaffraix@chromium.org> and r172402 by
     9        <wangxianzhu@chromium.org>.
     10
     11        * css3/blending/repaint/blend-mode-turn-off-isolation-expected.txt: Test rebaseline.
     12        * fast/css-grid-layout/grid-item-z-index-change-repaint-expected.html: Added.
     13        * fast/css-grid-layout/grid-item-z-index-change-repaint.html: Added.
     14        * fast/css-grid-layout/grid-item-z-index-stacking-context-expected.html: Added.
     15        * fast/css-grid-layout/grid-item-z-index-stacking-context.html: Added.
     16        * fast/css-grid-layout/grid-item-z-index-support-expected.txt: Added.
     17        * fast/css-grid-layout/grid-item-z-index-support.html: Added.
     18
    1192014-06-25  Myles C. Maxfield  <mmaxfield@apple.com>
    220
  • trunk/LayoutTests/css3/blending/repaint/blend-mode-turn-off-isolation-expected.txt

    r168465 r170474  
    22
    33(repaint rects
     4  (rect 8 68 100 100)
    45  (rect 58 68 100 100)
     6  (rect 58 68 100 100)
     7  (rect 8 68 100 100)
    58)
    69
  • trunk/Source/WebCore/ChangeLog

    r170469 r170474  
     12014-06-26  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [CSS Grid Layout] Properly support for z-index on grid items
     4        https://bugs.webkit.org/show_bug.cgi?id=103329
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        From Blink r157620 by <jchaffraix@chromium.org> and r172402 by
     9        <wangxianzhu@chromium.org>.
     10
     11        The specification says that grid should match flexbox and force
     12        grid items to be stacking context if z-index is set, regardless
     13        of 'position'. After this change, this is what happens.
     14
     15        Previously z-index changes of static positioned objects were ignored.
     16        However, z-index is applicable for some static positioned objects,
     17        such as grid items. Ignoring them makes the object not to be properly
     18        painted on z-index change.
     19
     20        As StyleResolver has ensured that z-index is non-auto only if
     21        applicable, RenderStyle::changeRequiresLayerRepaint() should not check
     22        again (with inconsistent conditions).
     23
     24        Tests: fast/css-grid-layout/grid-item-z-index-change-repaint.html
     25               fast/css-grid-layout/grid-item-z-index-stacking-context.html
     26               fast/css-grid-layout/grid-item-z-index-support.html
     27
     28        * css/StyleResolver.cpp:
     29        (WebCore::isDisplayFlexibleOrGridBox): Add new method to check if parent
     30        display is flexbox or grid.
     31        (WebCore::StyleResolver::adjustRenderStyle): Use new method in z-index
     32        condition.
     33        * rendering/style/RenderStyle.cpp:
     34        (WebCore::RenderStyle::changeRequiresLayerRepaint): Move z-index checks
     35        out of non-static positioned objects if.
     36
    1372014-06-25  Dean Jackson  <dino@apple.com>
    238
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r170435 r170474  
    11371137}
    11381138
     1139static bool isDisplayFlexibleOrGridBox(EDisplay display)
     1140{
     1141    return isDisplayFlexibleBox(display) || isDisplayGridBox(display);
     1142}
     1143
    11391144#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
    11401145static bool isScrollableOverflow(EOverflow overflow)
     
    12291234            style.setWritingMode(TopToBottomWritingMode);
    12301235
    1231         if (isDisplayFlexibleBox(parentStyle.display()) || isDisplayGridBox(parentStyle.display())) {
     1236        if (isDisplayFlexibleOrGridBox(parentStyle.display())) {
    12321237            style.setFloating(NoFloat);
    12331238            style.setDisplay(equivalentBlockDisplay(style.display(), style.isFloating(), !document().inQuirksMode()));
     
    12361241
    12371242    // Make sure our z-index value is only applied if the object is positioned.
    1238     if (style.position() == StaticPosition && !isDisplayFlexibleBox(parentStyle.display()))
     1243    if (style.position() == StaticPosition && !isDisplayFlexibleOrGridBox(parentStyle.display()))
    12391244        style.setHasAutoZIndex();
    12401245
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r169407 r170474  
    674674bool RenderStyle::changeRequiresLayerRepaint(const RenderStyle* other, unsigned& changedContextSensitiveProperties) const
    675675{
     676    // StyleResolver has ensured that zIndex is non-auto only if it's applicable.
     677    if (m_box->zIndex() != other->m_box->zIndex() || m_box->hasAutoZIndex() != other->m_box->hasAutoZIndex())
     678        return true;
     679
    676680    if (position() != StaticPosition) {
    677         if (m_box->zIndex() != other->m_box->zIndex()
    678             || m_box->hasAutoZIndex() != other->m_box->hasAutoZIndex()
    679             || visual->clip != other->visual->clip
     681        if (visual->clip != other->visual->clip
    680682            || visual->hasClip != other->visual->hasClip)
    681683            return true;
Note: See TracChangeset for help on using the changeset viewer.