[CSS Grid Layout] Properly support for z-index on grid items
authorrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jun 2014 07:30:01 +0000 (07:30 +0000)
committerrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jun 2014 07:30:01 +0000 (07:30 +0000)
commitf12cbf1f11f450ab1faa7ff0ff36a58d8d930f4e
treeae1ff4611cda5ddffe045993e9d47a293ead28ff
parent8e1df8764a30ed4f7718b0517bf1c5f325523ce2
[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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170474 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/css3/blending/repaint/blend-mode-turn-off-isolation-expected.txt
LayoutTests/fast/css-grid-layout/grid-item-z-index-change-repaint-expected.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-item-z-index-change-repaint.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-item-z-index-stacking-context-expected.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-item-z-index-stacking-context.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-item-z-index-support-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-item-z-index-support.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/rendering/style/RenderStyle.cpp