[CSS Exclusions] shape-inside does not properly handle padding or border
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 20:50:21 +0000 (20:50 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 20:50:21 +0000 (20:50 +0000)
commit683b9d918b1ef759af68c0ce11a71cccba7a5bd3
tree040397d109f4d0d9dff29cf9979fc88ef7b47bd9
parent4bf80b99b10da3d216a6527a4d45f8dbbec45ee1
[CSS Exclusions] shape-inside does not properly handle padding or border
https://bugs.webkit.org/show_bug.cgi?id=102715

Patch by Bear Travis <betravis@adobe.com> on 2013-02-07
Reviewed by David Hyatt.

Source/WebCore:

This patch positions the exclusion shape based on the value of the css box sizing
property. Geometry calculations happen in the shape coordinate space. For layout,
these coordinates are translated to the border-box coordinate system by adding
the appropriate offsets.

Test: fast/exclusions/shape-inside/shape-inside-box-sizing.html

* rendering/ExclusionShapeInfo.cpp:
(WebCore::::computedShape): Pass m_shapeLogicalWidth to the exclusion shape
geometry code.
* rendering/ExclusionShapeInfo.h:
(WebCore::ExclusionShapeInfo::setShapeSize): Adjust block layout dimensions to
shape dimensions when checking to see if the shape geometry must be recalculated.
(WebCore::ExclusionShapeInfo::shapeLogicalTop): Account for layout offsets.
(WebCore::ExclusionShapeInfo::shapeLogicalBottom): Ditto.
(WebCore::ExclusionShapeInfo::shapeLogicalLeft): Ditto.
(WebCore::ExclusionShapeInfo::shapeLogicalRight): Ditto.
(WebCore::ExclusionShapeInfo::logicalTopOffset): Return the offset from the logical
top of the border box to the logical top of the shape.
(WebCore::ExclusionShapeInfo::logicalLeftOffset): Return the offset from the logical
left of the border box to the logical left of the shape.
(ExclusionShapeInfo):
* rendering/ExclusionShapeInsideInfo.cpp:
(WebCore::ExclusionShapeInsideInfo::computeSegmentsForLine): Adjust line top to
be in shape coordinates.
(WebCore::ExclusionShapeInsideInfo::adjustLogicalLineTop): Ditto.
* rendering/ExclusionShapeInsideInfo.h:
(WebCore::ExclusionShapeInsideInfo::lineOverlapsShapeBounds): Use consistent
coordinate system (border box) to test for whether a line overlaps a shape.
(WebCore::ExclusionShapeInsideInfo::logicalLineTop): Include the logical offset
from the border box.
(WebCore::ExclusionShapeInsideInfo::logicalLineBottom): Ditto.

LayoutTests:

Test that borders and padding are properly accounted for when laying out text in
a shape inside.

* fast/exclusions/shape-inside/shape-inside-bottom-edge.html: Modified to no longer
use padding.
* fast/exclusions/shape-inside/shape-inside-box-sizing-expected.html: Added.
* fast/exclusions/shape-inside/shape-inside-box-sizing.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142164 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/exclusions/shape-inside/shape-inside-bottom-edge.html
LayoutTests/fast/exclusions/shape-inside/shape-inside-box-sizing-expected.html [new file with mode: 0644]
LayoutTests/fast/exclusions/shape-inside/shape-inside-box-sizing.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/ExclusionShapeInfo.cpp
Source/WebCore/rendering/ExclusionShapeInfo.h
Source/WebCore/rendering/ExclusionShapeInsideInfo.cpp
Source/WebCore/rendering/ExclusionShapeInsideInfo.h