Skip to content
  • commit-queue@webkit.org's avatar
    [CSS Exclusions] ExclusionShape API should use logical coordinates for input/output · 5678f008
    commit-queue@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=96156
    
    Patch by Hans Muller <hmuller@adobe.com> on 2012-09-24
    Reviewed by Dirk Schulze.
    
    Source/WebCore:
    
    Correct how ExclusionShapes deal with logical coordinates and enable
    shape-inside exclusion layout for vertical writing-modes.
    
    BasicShape's are defined in physical cooordinates, incoming line and box
    dimensions are logical coordinates, and the ExclusionShape internals assume
    that lines are aligned with the Y axis. The createExclusionShape() method
    is responsible for converting the BasicShape to the internal coordinate
    system when the writing-mode is vertical. Similarly, the getInclude,ExcludedIntervals()
    methods are responsible for converting their logical line parameters to Y
    values in the internal coordinate system. The min,maxYForLogicalLine()
    methods do the conversion, based on the WritingMode the ExclusionShape
    was created with. The getInclude,ExcludedIntervals() methods return the
    logical left and right edges of line segments. No transformation is needed for this.
    
    The ExclusionShape's internal coordinate system is essentially the
    "logical" one, except that top/bottom always map to Y, no matter what
    the writing-mode is.  This is just to simplify writing geometrical shape
    algorithms, notably the complex ones for polygons. The bug report includes a
    pair of diagrams that clarify how internal coordinates are related to logical
    and physical coordinates.
    
    Test: fast/exclusions/shape-inside/shape-inside-vertical-text.html
    
    * rendering/ExclusionRectangle.cpp:
    (WebCore::ExclusionRectangle::getExcludedIntervals): rename more accurately reflects return value
    (WebCore::ExclusionRectangle::getIncludedIntervals): rename for consistency with "excluded" version
    * rendering/ExclusionRectangle.h:
    * rendering/ExclusionShape.cpp:
    (WebCore):
    (WebCore::ExclusionShape::createExclusionShape):
    * rendering/ExclusionShape.h:
    (LineSegment):
    (WebCore::LineSegment::LineSegment): relocated from WrapShapeInfo.h
    (WebCore):
    (ExclusionShape):
    (WebCore::ExclusionShape::minYForLogicalLine):
    (WebCore::ExclusionShape::maxYForLogicalLine):
    (WebCore::ExclusionShape::internalToLogicalBoundingBox):
    * rendering/WrapShapeInfo.cpp:
    (WebCore::WrapShapeInfo::isWrapShapeInfoEnabledForRenderBlock):
    (WebCore::WrapShapeInfo::computeShapeSize): pass writingMode to createExclusionShape()
    (WebCore::WrapShapeInfo::computeSegmentsForLine): removed short-circuit for vertical writing-modes
    * rendering/WrapShapeInfo.h:
    (WebCore):
    
    LayoutTests:
    
    Verify that shape-inside respects the writing-mode, notably the vertical writing-modes.
    
    * fast/exclusions/shape-inside/shape-inside-vertical-text-expected.html: Added.
    * fast/exclusions/shape-inside/shape-inside-vertical-text.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129411 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    5678f008
ChangeLog 4.18 MiB