[CSS Grid Layout] Relayout whenever Box Alignment properties change
authorjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Sep 2015 09:13:35 +0000 (09:13 +0000)
committerjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Sep 2015 09:13:35 +0000 (09:13 +0000)
commit5fa6422b4a46782df4001fd25488ab63bb1be6da
tree3809d038eabaeadbb6cecaba5fa479d4c9870a87
parent03787aae1405d08b3237e69798a8dac6c3b0e224
[CSS Grid Layout] Relayout whenever Box Alignment properties change
https://bugs.webkit.org/show_bug.cgi?id=148070

Reviewed by Darin Adler.

Source/WebCore:

We were Reattaching the styles to the RenderTree whenever Content Alignment
properties (align-items and justify-items) changed their values, since the
Self Alignment properties depend on such values to resolve 'auto' values
during layout.

This patch removes such restriction, since we resolve the auto values
whenever we access the alignment properties. The only thing we need to
do is to mark a grid item for layout whenever the Default Alignment
properties change from/to stretch, since it implies a resize of the grid
items using 'auto' values for the Self Alignment properties.

Tests: fast/css-grid-layout/relayout-align-items-changed.html
       fast/css-grid-layout/relayout-align-self-changed.html
       fast/css-grid-layout/relayout-justify-items-changed.html
       fast/css-grid-layout/relayout-justify-self-changed.html
       fast/repaint/align-items-change.html
       fast/repaint/align-items-overflow-change.html
       fast/repaint/align-self-change.html
       fast/repaint/align-self-overflow-change.html
       fast/repaint/justify-items-change.html
       fast/repaint/justify-items-legacy-change.html
       fast/repaint/justify-items-overflow-change.html
       fast/repaint/justify-self-change.html
       fast/repaint/justify-self-overflow-change.html

* rendering/RenderGrid.cpp:
(WebCore::defaultAlignmentIsStretch):
(WebCore::RenderGrid::styleDidChange):
* rendering/RenderGrid.h:
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::resolveAlignmentOverflow):
(WebCore::RenderStyle::changeRequiresLayout):
* style/StyleResolveTree.cpp:
(WebCore::Style::determineChange): Deleted.

LayoutTests:

Tests to verify we force a layout of grid container or grid items, as appropriated,
whenever Box Alignment properties change their value.

This patch also adds some repaint tests, so we can ensure we generate the correct
repaint rects as well.

* fast/css-grid-layout/relayout-align-items-changed-expected.txt: Added.
* fast/css-grid-layout/relayout-align-items-changed.html: Added.
* fast/css-grid-layout/relayout-align-self-changed-expected.txt: Added.
* fast/css-grid-layout/relayout-align-self-changed.html: Added.
* fast/css-grid-layout/relayout-justify-items-changed-expected.txt: Added.
* fast/css-grid-layout/relayout-justify-items-changed.html: Added.
* fast/css-grid-layout/relayout-justify-self-changed-expected.txt: Added.
* fast/css-grid-layout/relayout-justify-self-changed.html: Added.
* fast/repaint/align-items-change-expected.txt: Added.
* fast/repaint/align-items-change.html: Added.
* fast/repaint/align-items-overflow-change-expected.txt: Added.
* fast/repaint/align-items-overflow-change.html: Added.
* fast/repaint/align-self-change-expected.txt: Added.
* fast/repaint/align-self-change.html: Added.
* fast/repaint/align-self-overflow-change-expected.txt: Added.
* fast/repaint/align-self-overflow-change.html: Added.
* fast/repaint/justify-items-change-expected.txt: Added.
* fast/repaint/justify-items-change.html: Added.
* fast/repaint/justify-items-legacy-change-expected.txt: Added.
* fast/repaint/justify-items-legacy-change.html: Added.
* fast/repaint/justify-items-overflow-change-expected.txt: Added.
* fast/repaint/justify-items-overflow-change.html: Added.
* fast/repaint/justify-self-change-expected.txt: Added.
* fast/repaint/justify-self-change.html: Added.
* fast/repaint/justify-self-overflow-change-expected.txt: Added.
* fast/repaint/justify-self-overflow-change.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189910 268f45cc-cd09-0410-ab3c-d52691b4dbfc
32 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/relayout-align-items-changed-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/relayout-align-items-changed.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/relayout-align-self-changed-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/relayout-align-self-changed.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/relayout-justify-items-changed-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/relayout-justify-items-changed.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/relayout-justify-self-changed-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/relayout-justify-self-changed.html [new file with mode: 0644]
LayoutTests/fast/repaint/align-items-change-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/align-items-change.html [new file with mode: 0644]
LayoutTests/fast/repaint/align-items-overflow-change-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/align-items-overflow-change.html [new file with mode: 0644]
LayoutTests/fast/repaint/align-self-change-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/align-self-change.html [new file with mode: 0644]
LayoutTests/fast/repaint/align-self-overflow-change-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/align-self-overflow-change.html [new file with mode: 0644]
LayoutTests/fast/repaint/justify-items-change-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/justify-items-change.html [new file with mode: 0644]
LayoutTests/fast/repaint/justify-items-legacy-change-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/justify-items-legacy-change.html [new file with mode: 0644]
LayoutTests/fast/repaint/justify-items-overflow-change-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/justify-items-overflow-change.html [new file with mode: 0644]
LayoutTests/fast/repaint/justify-self-change-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/justify-self-change.html [new file with mode: 0644]
LayoutTests/fast/repaint/justify-self-overflow-change-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/justify-self-overflow-change.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderGrid.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/style/StyleResolveTree.cpp