Avoid a second layout of flex items in layoutAndPlaceChildren()
authortony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 2 Dec 2012 10:39:51 +0000 (10:39 +0000)
committertony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 2 Dec 2012 10:39:51 +0000 (10:39 +0000)
commite6bb2d32c43e73aa4dbe8a69c9906a66265f091f
tree9dc692282f8a2bccbf9bcf1b967d6180e7dcabb6
parent18a731d10effe2498aa50c56c8099602246c864d
Avoid a second layout of flex items in layoutAndPlaceChildren()
https://bugs.webkit.org/show_bug.cgi?id=102352

Reviewed by Ojan Vafai.

Source/WebCore:

Avoid doing a second layout if we're going to get the same size as before.
This prevents us from doing an exponential number of layouts in some
common cases.

Test: css3/flexbox/stretch-after-sibling-size-change.html

* html/shadow/SliderThumbElement.cpp:
(WebCore::RenderSliderContainer::layout): Force a layout of the track, which positions the thumb.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::needToStretchChild): Determine if a child is going to stretch.
(WebCore::RenderFlexibleBox::resetAutoMarginsAndLogicalTopInCrossAxis): Makes sure we're in a consistent state before
we apply auto margins.
(WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
* rendering/RenderFlexibleBox.h: Add needToStretchChild.

LayoutTests:

Add a test case to make sure we relayout when a sibling is stretching.

* css3/flexbox/stretch-after-sibling-size-change-expected.txt: Added.
* css3/flexbox/stretch-after-sibling-size-change.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/css3/flexbox/stretch-after-sibling-size-change-expected.txt [new file with mode: 0644]
LayoutTests/css3/flexbox/stretch-after-sibling-size-change.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/shadow/SliderThumbElement.cpp
Source/WebCore/rendering/RenderFlexibleBox.cpp
Source/WebCore/rendering/RenderFlexibleBox.h