[CSS Grid Layout] Grid items must set a new formatting context.
authorjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Dec 2014 19:13:16 +0000 (19:13 +0000)
committerjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Dec 2014 19:13:16 +0000 (19:13 +0000)
commit01e9d7c8d4ac871e6f68edaee24a15b5867fe8fb
tree258432fb58309bfc28ecc4f02ba6ca150c2786af
parent385696ad1925f2293ff361fc63b80eaf1dbe8b85
[CSS Grid Layout] Grid items must set a new formatting context.
https://bugs.webkit.org/show_bug.cgi?id=139150

Reviewed by David Hyatt.

Source/WebCore:

Grid item's margins must not collapse even when they may be adjoining to
its content's margins. Also, setting a new formatting context prevents any
'float' protruding content on the adjoining grid items.

This patch also renames the expandsToEncloseOverhangingFloats to be more generic now,
determining whether a new formatting context is set or not. This affects not only to
how floats behave, but whether margins should collapse or not.

Tests: fast/css-grid-layout/float-not-protruding-into-next-grid-item.html
       fast/css-grid-layout/grid-item-margins-not-collapse.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::avoidsFloats): Using the new createsNewFormattingContext function.
(WebCore::RenderBlock::expandsToEncloseOverhangingFloats): Deleted.
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::MarginInfo::MarginInfo): Using the new createsNewFormattingContext function.
(WebCore::RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats): Using the new createsNewFormattingContext function.
(WebCore::RenderBlockFlow::layoutBlock): Using the new createsNewFormattingContext function.
(WebCore::RenderBlockFlow::computeOverflow): Using the new createsNewFormattingContext function.
(WebCore::RenderBlockFlow::addOverhangingFloats): Using the new createsNewFormattingContext function.
(WebCore::RenderBlockFlow::needsLayoutAfterRegionRangeChange): Using the new createsNewFormattingContext function.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::createsNewFormattingContext): Added.
(WebCore::RenderBox::avoidsFloats): Removed checks already defined in the new createsNewFormattingContext function.
* rendering/RenderBox.h:
(WebCore::RenderBox::isGridItem): Added.

LayoutTests:

Test to verify that grid items's margin don't collapese with its parent's margin
and there is no 'float' protruding content on the adjoining grid items.

I had to rebaseline the form-hides-table.html test because table-caption, which
is supposed to establish a new formatting context, does not allow margins collapsing.

* fast/css-grid-layout/float-not-protruding-into-next-grid-item-expected.html: Added.
* fast/css-grid-layout/float-not-protruding-into-next-grid-item.html: Added.
* fast/css-grid-layout/grid-item-margins-not-collapse-expected.html: Added.
* fast/css-grid-layout/grid-item-margins-not-collapse.html: Added.
* platform/gtk/fast/forms/form-hides-table-expected.txt: Rebaseline needed.
* platform/mac/fast/forms/form-hides-table-expected.txt: Rebaseline needed.
* platform/efl/TestExpectations: Mark fast/forms/form-hides-table-expected as failure.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176957 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/float-not-protruding-into-next-grid-item-expected.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/float-not-protruding-into-next-grid-item.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-item-margins-not-collapse-expected.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-item-margins-not-collapse.html [new file with mode: 0644]
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/fast/forms/form-hides-table-expected.txt
LayoutTests/platform/mac/fast/forms/form-hides-table-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderBlockFlow.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h