Changeset 148582 in webkit


Ignore:
Timestamp:
Apr 16, 2013 5:09:49 PM (11 years ago)
Author:
hmuller@adobe.com
Message:

[CSS Exclusions] polygon shape-inside layout fails
https://bugs.webkit.org/show_bug.cgi?id=114402

Source/WebCore:

Reviewed by Dirk Schulze.

The firstIncludedIntervalLogicalTop() method's implementation relied on optimistic
assumptions about floating point accuracy which, in rare cases, caused it to discard
first-fit locations based on the intersection of the minLogicalIntervalTop offset edge
and a polygon offset edge. Now: we do not verify that first-fit locations based on the
intersection of an offset edge and the minLogicalIntervalTop offset edge are below
the horizontal minLogicalIntervalTop line. They're essentially below the line "by definition".

Test: fast/exclusions/shape-inside/shape-inside-polygon-layout.html

  • rendering/ExclusionPolygon.cpp:

(WebCore::ExclusionPolygon::firstIncludedIntervalLogicalTop): Avoid floating point problems

when checking intersections with the offset edge based on minLogicalIntervalTop.

  • rendering/ExclusionPolygon.h:

(WebCore::OffsetPolygonEdge::OffsetPolygonEdge): Initialize the basis field.
(WebCore::OffsetPolygonEdge::basis): Report what the offset edge is "based on": a polygon

edge, the top of the line, or a (reflex) vertex.

(OffsetPolygonEdge): Added the Basis enum to enable tracking what the geometry of

an offset edge is based on.

LayoutTests:

Verify that subsequent polygon shape-inside lines are vertically adjacent.

Reviewed by Dirk Schulze.

  • fast/exclusions/shape-inside/shape-inside-polygon-layout-expected.txt: Added.
  • fast/exclusions/shape-inside/shape-inside-polygon-layout.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r148581 r148582  
     12013-04-16  Hans Muller  <hmuller@adobe.com>
     2
     3        [CSS Exclusions] polygon shape-inside layout fails
     4        https://bugs.webkit.org/show_bug.cgi?id=114402
     5
     6        Verify that subsequent polygon shape-inside lines are vertically adjacent.
     7
     8        Reviewed by Dirk Schulze.
     9
     10        * fast/exclusions/shape-inside/shape-inside-polygon-layout-expected.txt: Added.
     11        * fast/exclusions/shape-inside/shape-inside-polygon-layout.html: Added.
     12
    1132013-04-16  Michelangelo De Simone  <michelangelo@webkit.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r148579 r148582  
     12013-04-16  Hans Muller  <hmuller@adobe.com>
     2
     3        [CSS Exclusions] polygon shape-inside layout fails
     4        https://bugs.webkit.org/show_bug.cgi?id=114402
     5
     6        Reviewed by Dirk Schulze.
     7
     8        The firstIncludedIntervalLogicalTop() method's implementation relied on optimistic
     9        assumptions about floating point accuracy which, in rare cases, caused it to discard
     10        first-fit locations based on the intersection of the minLogicalIntervalTop offset edge
     11        and a polygon offset edge. Now: we do not verify that first-fit locations based on the
     12        intersection of an offset edge and the minLogicalIntervalTop offset edge are below
     13        the horizontal minLogicalIntervalTop line. They're essentially below the line "by definition".
     14
     15        Test: fast/exclusions/shape-inside/shape-inside-polygon-layout.html
     16
     17        * rendering/ExclusionPolygon.cpp:
     18        (WebCore::ExclusionPolygon::firstIncludedIntervalLogicalTop): Avoid floating point problems
     19            when checking intersections with the offset edge based on minLogicalIntervalTop.
     20        * rendering/ExclusionPolygon.h:
     21        (WebCore::OffsetPolygonEdge::OffsetPolygonEdge): Initialize the basis field.
     22        (WebCore::OffsetPolygonEdge::basis): Report what the offset edge is "based on": a polygon
     23            edge, the top of the line, or a (reflex) vertex.
     24        (OffsetPolygonEdge): Added the Basis enum to enable tracking what the geometry of
     25            an offset edge is based on.
     26
    1272013-04-16  Jer Noble  <jer.noble@apple.com>
    228
  • trunk/Source/WebCore/rendering/ExclusionPolygon.cpp

    r148139 r148582  
    488488                FloatPoint potentialFirstFitLocation(offsetEdgesIntersection.x() - dx, offsetEdgesIntersection.y() - dy);
    489489                FloatRect potentialFirstFitRect(potentialFirstFitLocation, minLogicalIntervalSize);
    490                 if ((potentialFirstFitLocation.y() >= minLogicalIntervalTop)
     490                if ((offsetEdges[i].basis() == OffsetPolygonEdge::LineTop
     491                    || offsetEdges[j].basis() == OffsetPolygonEdge::LineTop
     492                    || potentialFirstFitLocation.y() >= minLogicalIntervalTop)
    491493                    && (!firstFitFound || aboveOrToTheLeft(potentialFirstFitRect, firstFitRect))
    492494                    && polygon.contains(offsetEdgesIntersection)
  • trunk/Source/WebCore/rendering/ExclusionPolygon.h

    r147384 r148582  
    3939class OffsetPolygonEdge : public VertexPair {
    4040public:
     41    enum Basis {
     42        Edge,
     43        Vertex,
     44        LineTop
     45    };
     46
    4147    OffsetPolygonEdge(const FloatPolygonEdge& edge, const FloatSize& offset)
    4248        : m_vertex1(edge.vertex1() + offset)
    4349        , m_vertex2(edge.vertex2() + offset)
    4450        , m_edgeIndex(edge.edgeIndex())
     51        , m_basis(Edge)
    4552    {
    4653    }
     
    5057        , m_vertex2(reflexVertex + offset2)
    5158        , m_edgeIndex(-1)
     59        , m_basis(Vertex)
    5260    {
    5361    }
     
    5765        , m_vertex2(FloatPoint(polygon.boundingBox().maxX(), minLogicalIntervalTop) + offset)
    5866        , m_edgeIndex(-1)
     67        , m_basis(LineTop)
    5968    {
    6069    }
     
    6372    virtual const FloatPoint& vertex2() const OVERRIDE { return m_vertex2; }
    6473    int edgeIndex() const { return m_edgeIndex; }
     74    Basis basis() const { return m_basis; }
    6575
    6676private:
     
    6878    FloatPoint m_vertex2;
    6979    int m_edgeIndex;
     80    Basis m_basis;
    7081};
    7182
Note: See TracChangeset for help on using the changeset viewer.