Optimize FloatIntervalSearchAdapter::collectIfNeeded
authorbjonesbe@adobe.com <bjonesbe@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Aug 2013 21:35:35 +0000 (21:35 +0000)
committerbjonesbe@adobe.com <bjonesbe@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Aug 2013 21:35:35 +0000 (21:35 +0000)
commit0d9d19c54eb9573f3fb647eccc7e35f87dfb690f
treee6c9f689ded0fc158f537f84b23ad516f4d9652b
parent5b541cbb77c9025caf6e1ec738ec1346910c18fc
Optimize FloatIntervalSearchAdapter::collectIfNeeded
https://bugs.webkit.org/show_bug.cgi?id=120237

Reviewed by David Hyatt.

Source/WebCore:

This is a port of 3 Blink patches:
https://codereview.chromium.org/22463002 (By shatch@chromium.org)
https://chromiumcodereview.appspot.com/22909005 (By me)
https://chromiumcodereview.appspot.com/23084002 (By me)

shatch optimized FloatIntervalSearchAdapter by having it store the
outermost float instead of making a bunch of calls to
logical(Left/Right/Bottom)ForFloat, and then only making that call
once when heightRemaining needs to be computed.

I noticed that now we were storing both the last float encountered and
the outermost float, and that the behavior for shape-outside wasn't
significantly changed by using the outermost float instead of the last
float encountered (and in most cases, using the outermost float gives
more reasonable behavior). Since this isn't covered in the spec yet, I
changed shape-outside to use the outermost float, making it so that we
only need to store one float pointer when walking the placed floats
tree, and keeping the performance win.

Also while changing updateOffsetIfNeeded, removed const, since that is
a lie. Nothing about that method is const.

Test: fast/shapes/shape-outside-floats/shape-outside-floats-outermost.html

* rendering/RenderBlock.cpp:
(WebCore::::updateOffsetIfNeeded):
(WebCore::::collectIfNeeded):
(WebCore::::getHeightRemaining):
(WebCore::RenderBlock::logicalLeftFloatOffsetForLine):
(WebCore::RenderBlock::logicalRightFloatOffsetForLine):
* rendering/RenderBlock.h:
(WebCore::RenderBlock::FloatIntervalSearchAdapter::FloatIntervalSearchAdapter):
(WebCore::RenderBlock::FloatIntervalSearchAdapter::outermostFloat):

LayoutTests:

Test shape-outside behavior when there is more than one float on a
given line.

* fast/shapes/shape-outside-floats/shape-outside-floats-outermost-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-outermost.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154641 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-outermost-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-outermost.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h