RenderGrid children should always be RenderBoxes
authortony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Aug 2012 21:32:03 +0000 (21:32 +0000)
committertony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Aug 2012 21:32:03 +0000 (21:32 +0000)
commit6b7cbd44433077f38d19c7db2aa5f0e35c2096b8
tree8d81ab25443704909f269d74ca9e7a0bbf7c6239
parent2835b1ea849cfd0692a556c3d016882d6f72d80e
RenderGrid children should always be RenderBoxes
https://bugs.webkit.org/show_bug.cgi?id=94305

Reviewed by Abhishek Arya.

Source/WebCore:

During RenderGrid::layout, we assume all the children are RenderBoxes.
When removing children, if the last child is an anonymous block, we don't
want to remove the anonymous block for grids. Ensure this doesn't happen
by adding canCollapseAnonymousBlockChild to RenderBlock (flexboxen and
grid can override this method).

Test: fast/css-grid-layout/should-not-collapse-anonymous-blocks.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::removeChild): Check canCollapseAnonymousBlockChild().
* rendering/RenderBlock.h:
(WebCore::RenderBlock::canCollapseAnonymousBlockChild):
(RenderBlock):
* rendering/RenderDeprecatedFlexibleBox.h: canCollapseAnonymousBlockChild returns false.
* rendering/RenderFlexibleBox.h: canCollapseAnonymousBlockChild returns false.
* rendering/RenderGrid.h: canCollapseAnonymousBlockChild returns false.

LayoutTests:

Add test case from fuzzer.

* fast/css-grid-layout/should-not-collapse-anonymous-blocks-expected.txt: Added.
* fast/css-grid-layout/should-not-collapse-anonymous-blocks.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126071 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/should-not-collapse-anonymous-blocks-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/should-not-collapse-anonymous-blocks.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h
Source/WebCore/rendering/RenderFlexibleBox.h
Source/WebCore/rendering/RenderGrid.h