-
commit-queue@webkit.org authored
https://bugs.webkit.org/show_bug.cgi?id=103327 Source/WebCore: Patch by Hans Muller <hmuller@adobe.com> on 2012-12-06 Reviewed by Levi Weintraub. If the first "word" in a line doesn't fit within the shape-inside when lineTop is the top of the shape's logical bounding box, adjust lineTop downwards to where the word fits. Currently only rounded rectangle shapes are supported. Added ExclusionShape::firstIncludedIntervalLogicalTop(). The new virtual method computes the topmost/leftmost location where a line segment with the specified minLogicalIntervalSize will fit within the exclusion shape and returns the corresponding logical Y coordinate. The result is additionally constrained to be at or below minLogicalIntervalTop. If the segment will not fit anywhere within the shape, then false is returned. During layout, minLogicalIntervalTop is the nominal top of the line being laid out within the exclusion shape. RenderBlock::layoutRunsAndFloatsInRange() now calls a new ExclusionShapeInsideInfo method, adjustLogicalLineTop(), which uses firstIncludedIntervalLogicalTop() to decide if the logical top of the line has to be moved downwards, for the first word to fit within the exclusion shape. Tests: fast/exclusions/shape-inside/shape-inside-rounded-rectangle-fit-001.html fast/exclusions/shape-inside/shape-inside-rounded-rectangle-fit-002.html * rendering/ExclusionPolygon.cpp: (WebCore::ExclusionPolygon::firstIncludedIntervalLogicalTop): This is a stub implementation. * rendering/ExclusionPolygon.h: * rendering/ExclusionRectangle.cpp: (WebCore::ellipseXIntercept): Added spaces to conform to webkit style and to be consistent with ellipseYIntercept() (WebCore::ellipseYIntercept): Compute an ellipse's Y intercept for an X coordinate. (WebCore::ExclusionRectangle::firstIncludedIntervalLogicalTop): See the description above. * rendering/ExclusionRectangle.h: * rendering/ExclusionShape.h: (ExclusionShape): (WebCore::ExclusionShape::logicalTopForMinY): Internal to logical coordinate conversion. * rendering/ExclusionShapeInsideInfo.cpp: (WebCore::ExclusionShapeInsideInfo::adjustLogicalLineTop): A new method that updates m_lineTop with firstIncludedIntervalPosition(). * rendering/ExclusionShapeInsideInfo.h: (ExclusionShapeInsideInfo): (WebCore::ExclusionShapeInsideInfo::logicalLineTop): This is just a cover for the private m_lineTop field. * rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlock::layoutRunsAndFloatsInRange): Added code that restarts the layout loop if it's necessary to adjust the line's logicalTop. (WebCore::RenderBlock::restartLayoutRunsAndFloatsInRange): Factored newly common code into this helper function. LayoutTests: Test the rounded rectangle support for adjusting the top of a line downwards when the first word doesn't fit within the shape. Patch by Hans Muller <hmuller@adobe.com> on 2012-12-06 Reviewed by Levi Weintraub. * fast/exclusions/shape-inside/shape-inside-rounded-rectangle-fit-001-expected.html: Added. * fast/exclusions/shape-inside/shape-inside-rounded-rectangle-fit-001.html: Added. * fast/exclusions/shape-inside/shape-inside-rounded-rectangle-fit-002-expected.html: Added. * fast/exclusions/shape-inside/shape-inside-rounded-rectangle-fit-002.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@136857 268f45cc-cd09-0410-ab3c-d52691b4dbfc
4055b2e0