[CSS Shapes] Use the float height to determine position in shape-inside
authorzoltan@webkit.org <zoltan@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Sep 2013 03:27:35 +0000 (03:27 +0000)
committerzoltan@webkit.org <zoltan@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Sep 2013 03:27:35 +0000 (03:27 +0000)
commit270615c9d65c0c1b42480c85d580f809540214aa
tree655f800902e81033b6115feb6417976d00dfafce
parent84a2d470407e994d637d613fd7f7ef0906bc7d4c
[CSS Shapes] Use the float height to determine position in shape-inside
https://bugs.webkit.org/show_bug.cgi?id=102846

Reviewed by Darin Adler.

Float positioning inside shape-inside has been working only for simple cases when the float boundaries didn't overlap with the shape.
This patch fixes the behavior for left floats and shapes with inline content. I want to add this work step by step, therefore the next
step would be to add support for block content with inline content (e.g. paragraphs) then cover cases with right floats.

Source/WebCore:

Tests: fast/shapes/shape-inside/shape-inside-left-float-in-lower-left-triangle-inline-content.html
       fast/shapes/shape-inside/shape-inside-left-float-in-lower-right-triangle-inline-content.html
       fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-inline-content.html
       fast/shapes/shape-inside/shape-inside-left-float-in-upper-right-triangle-inline-content.html

* rendering/LineWidth.cpp:
(WebCore::LineWidth::LineWidth): Use the new updateCurrentShapeSegment member function.
(WebCore::LineWidth::updateCurrentShapeSegment): We need a function to update the current line segment's reference, since we use it multiple places.
* rendering/LineWidth.h: Add new member function.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeLogicalLocationForFloat): Fix positioning of a floating element.
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::updateShapeAndSegmentsForCurrentLine): Use updateSegmentsForLine instead of computeSegmentsForLine.
(WebCore::RenderBlock::updateShapeAndSegmentsForCurrentLineInFlowThread): Use updateSegmentsForLine instead of computeSegmentsForLine.
(WebCore::RenderBlock::adjustLogicalLineTopAndLogicalHeightIfNeeded):
(WebCore::updateSegmentsForShapes): After our float is positioned, we need to adjust the current lineTop and update the logical height to be able to wrap around the float.
(WebCore::RenderBlock::LineBreaker::nextSegmentBreak): If we have a float in our line we might need to adjust our lineTop and logicalHeight.
* rendering/shapes/ShapeInfo.cpp:
(WebCore::::computeSegmentsForLine): Add new const function to compute the segments. I'd like make this function static later if possible.
(WebCore::::updateSegmentsForLine): Old computeSegmentsForLine, change name to indicate that it is actually changing things.
* rendering/shapes/ShapeInfo.h: Update function names, add declaration.
(WebCore::ShapeInfo::clearSegments):
(WebCore::ShapeInfo::logicalLineBottom):
(WebCore::ShapeInfo::lineOverlapsShapeBounds):
* rendering/shapes/ShapeInsideInfo.cpp:
(WebCore::ShapeInsideInfo::computeFirstFitPositionForFloat): Compute the first fit position below the current line position inside shapes. I called this function
this way, because currently we use it only for shapes.
* rendering/shapes/ShapeInsideInfo.h: Update function names.
* rendering/shapes/ShapeOutsideInfo.cpp: Update function names.
(WebCore::ShapeOutsideInfo::computeSegmentsForContainingBlockLine):
(WebCore::ShapeOutsideInfo::updateSegmentsForLine):
* rendering/shapes/ShapeOutsideInfo.h: Update function names.

LayoutTests:

* fast/shapes/shape-inside/shape-inside-left-float-in-lower-left-triangle-inline-content-expected.html: Added.
* fast/shapes/shape-inside/shape-inside-left-float-in-lower-left-triangle-inline-content.html: Added.
* fast/shapes/shape-inside/shape-inside-left-float-in-lower-right-triangle-inline-content-expected.html: Added.
* fast/shapes/shape-inside/shape-inside-left-float-in-lower-right-triangle-inline-content.html: Added.
* fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-inline-content-expected.html: Added.
* fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-inline-content.html: Added.
* fast/shapes/shape-inside/shape-inside-left-float-in-upper-right-triangle-inline-content-expected.html: Added.
* fast/shapes/shape-inside/shape-inside-left-float-in-upper-right-triangle-inline-content.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156022 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/shapes/shape-inside/shape-inside-left-float-in-lower-left-triangle-inline-content-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-inside/shape-inside-left-float-in-lower-left-triangle-inline-content.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-inside/shape-inside-left-float-in-lower-right-triangle-inline-content-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-inside/shape-inside-left-float-in-lower-right-triangle-inline-content.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-inline-content-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-inline-content.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-inside/shape-inside-left-float-in-upper-right-triangle-inline-content-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-inside/shape-inside-left-float-in-upper-right-triangle-inline-content.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/LineWidth.cpp
Source/WebCore/rendering/LineWidth.h
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlockLineLayout.cpp
Source/WebCore/rendering/shapes/ShapeInfo.cpp
Source/WebCore/rendering/shapes/ShapeInfo.h
Source/WebCore/rendering/shapes/ShapeInsideInfo.cpp
Source/WebCore/rendering/shapes/ShapeInsideInfo.h
Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp
Source/WebCore/rendering/shapes/ShapeOutsideInfo.h