Implement absolutely positioned flex items
authortony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Sep 2012 19:29:51 +0000 (19:29 +0000)
committertony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Sep 2012 19:29:51 +0000 (19:29 +0000)
commit4550b292e70a25e9f00fb9c40d1f2592d413ef70
tree9e5b08cc37f2942e90d8f3b61060cbe7c9ad02bc
parent3bd8656901a48f4b6deea635999a0369ab75cedf
Implement absolutely positioned flex items
https://bugs.webkit.org/show_bug.cgi?id=93798

Reviewed by Ojan Vafai.

Source/WebCore:

Previously, we treated absolutely positioned flex items as a 0x0 placeholder element.
Now we position the 0x0 placeholder where the next item would go. This causes the
following changes:
- justify-content: space-{around,between} no longer change due to the existence of absolutely positioned flex items.
- alignment doesn't change the placement of absolutely positioned flex items.
- auto margins in the alignment direction don't do anything on absolutely positioned flex items.

Test: css3/flexbox/position-absolute-children.html

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::availableAlignmentSpaceForChild): Absolutely positioned flex items should not use this.
(WebCore::RenderFlexibleBox::updateAutoMarginsInCrossAxis): Absolutely positioned flex items should not use this.
(WebCore::initialJustifyContentOffset): If there are no flex items, space-around should center an absolutely positioned flex item.
(WebCore::RenderFlexibleBox::numberOfInFlowPositionedChildren): Helper method for helping to compute space-between and space-around.
(WebCore::RenderFlexibleBox::layoutAndPlaceChildren): Fix spacing when space-between or space-around.
(WebCore::RenderFlexibleBox::layoutColumnReverse): Fix spacing when space-between or space-around.
(WebCore::RenderFlexibleBox::alignChildren): Treat absolutely positioned children like flex-start.
* rendering/RenderFlexibleBox.h: numberOfInFlowPositionedChildren method.

LayoutTests:

Fix position of absolute flex items and add some additional tests.

* css3/flexbox/align-absolute-child-expected.txt:
* css3/flexbox/align-absolute-child.html: New test cases and update expectations.
* css3/flexbox/position-absolute-child.html: Update expectations.
* css3/flexbox/position-absolute-children-expected.txt: Added.
* css3/flexbox/position-absolute-children.html: Added. Tests having only absolutely positioned children.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129154 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/css3/flexbox/align-absolute-child-expected.txt
LayoutTests/css3/flexbox/align-absolute-child.html
LayoutTests/css3/flexbox/position-absolute-child.html
LayoutTests/css3/flexbox/position-absolute-children-expected.txt [new file with mode: 0644]
LayoutTests/css3/flexbox/position-absolute-children.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderFlexibleBox.cpp
Source/WebCore/rendering/RenderFlexibleBox.h