Changeset 142805 in webkit
- Timestamp:
- Feb 13, 2013 2:43:38 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r142799 r142805 1 2013-02-13 Hans Muller <hmuller@adobe.com> 2 3 [CSS Exclusions] ExclusionPolygon reflex vertices should constrain the first fit location. 4 https://bugs.webkit.org/show_bug.cgi?id=107568 5 6 Reviewed by Dirk Schulze. 7 8 In this carefully contrived test case, the Y coordinate of the origin of the line 9 of text is only computed correctly if the constraints implied by the polygon's 10 reflex vertices are considered. 11 12 * fast/exclusions/shape-inside/shape-inside-first-fit-reflex-expected.html: Added. 13 * fast/exclusions/shape-inside/shape-inside-first-fit-reflex.html: Added. 14 1 15 2013-02-13 Zan Dobersek <zdobersek@igalia.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r142803 r142805 1 2013-02-13 Hans Muller <hmuller@adobe.com> 2 3 [CSS Exclusions] ExclusionPolygon reflex vertices should constrain the first fit location. 4 https://bugs.webkit.org/show_bug.cgi?id=107568 5 6 Reviewed by Dirk Schulze. 7 8 The ExclusionPolygon::firstIncludedIntervalLogicalTop() method now includes offset edges 9 for each of the polygon's reflex vertices. The motivation for this change is explained 10 here: http://hansmuller-webkit.blogspot.com/2013/01/getting-to-point-reflex-vertices.html. 11 12 Test: fast/exclusions/shape-inside/shape-inside-first-fit-reflex.html 13 14 * rendering/ExclusionPolygon.cpp: 15 (WebCore::isReflexVertex): Given three vertices that represent a pair of connected polygon edges, return true if the second vertex is a reflex vertex. 16 (WebCore::ExclusionPolygon::firstIncludedIntervalLogicalTop): This method now includes offset edges for reflex vertices. 17 * rendering/ExclusionPolygon.h: 18 (WebCore::OffsetPolygonEdge::OffsetPolygonEdge): Added a constructor for creating an OffsetPolygonEdge given a reflex vertex. 19 (WebCore::OffsetPolygonEdge::edgeIndex): Changed this property from unsigned to int. Now using -1 to indicate that the offset edge doesn't correspond to a single polygon edge. 20 1 21 2013-02-13 Adam Barth <abarth@webkit.org> 2 22 -
trunk/Source/WebCore/rendering/ExclusionPolygon.cpp
r142187 r142805 439 439 } 440 440 441 static inline bool isReflexVertex(const FloatPoint& prevVertex, const FloatPoint& vertex, const FloatPoint& nextVertex) 442 { 443 return leftSide(prevVertex, nextVertex, vertex) < 0; 444 } 445 441 446 bool VertexPair::intersection(const VertexPair& other, FloatPoint& point) const 442 447 { … … 507 512 for (unsigned i = 0; i < overlappingEdges.size(); ++i) { 508 513 const ExclusionPolygonEdge& edge = *static_cast<ExclusionPolygonEdge*>(overlappingEdges[i].data()); 514 const FloatPoint& vertex0 = edge.previousEdge().vertex1(); 509 515 const FloatPoint& vertex1 = edge.vertex1(); 510 516 const FloatPoint& vertex2 = edge.vertex2(); 511 Vector<OffsetPolygonEdge> offsetEdge Pair;517 Vector<OffsetPolygonEdge> offsetEdgeBuffer; 512 518 513 519 if (vertex2.y() > vertex1.y() ? vertex2.x() >= vertex1.x() : vertex1.x() >= vertex2.x()) { 514 offsetEdge Pair.append(OffsetPolygonEdge(edge, FloatSize(dx, -dy)));515 offsetEdge Pair.append(OffsetPolygonEdge(edge, FloatSize(-dx, dy)));520 offsetEdgeBuffer.append(OffsetPolygonEdge(edge, FloatSize(dx, -dy))); 521 offsetEdgeBuffer.append(OffsetPolygonEdge(edge, FloatSize(-dx, dy))); 516 522 } else { 517 offsetEdgePair.append(OffsetPolygonEdge(edge, FloatSize(dx, dy))); 518 offsetEdgePair.append(OffsetPolygonEdge(edge, FloatSize(-dx, -dy))); 519 } 520 521 for (unsigned j = 0; j < offsetEdgePair.size(); ++j) 522 if (offsetEdgePair[j].maxY() >= minY) 523 offsetEdges.append(offsetEdgePair[j]); 523 offsetEdgeBuffer.append(OffsetPolygonEdge(edge, FloatSize(dx, dy))); 524 offsetEdgeBuffer.append(OffsetPolygonEdge(edge, FloatSize(-dx, -dy))); 525 } 526 527 if (isReflexVertex(vertex0, vertex1, vertex2)) { 528 if (vertex2.x() <= vertex1.x() && vertex0.x() <= vertex1.x()) 529 offsetEdgeBuffer.append(OffsetPolygonEdge(vertex1, FloatSize(dx, -dy), FloatSize(dx, dy))); 530 else if (vertex2.x() >= vertex1.x() && vertex0.x() >= vertex1.x()) 531 offsetEdgeBuffer.append(OffsetPolygonEdge(vertex1, FloatSize(-dx, -dy), FloatSize(-dx, dy))); 532 if (vertex2.y() <= vertex1.y() && vertex0.y() <= vertex1.y()) 533 offsetEdgeBuffer.append(OffsetPolygonEdge(vertex1, FloatSize(-dx, dy), FloatSize(dx, dy))); 534 else if (vertex2.y() >= vertex1.y() && vertex0.y() >= vertex1.y()) 535 offsetEdgeBuffer.append(OffsetPolygonEdge(vertex1, FloatSize(-dx, -dy), FloatSize(dx, -dy))); 536 } 537 538 for (unsigned j = 0; j < offsetEdgeBuffer.size(); ++j) 539 if (offsetEdgeBuffer[j].maxY() >= minY) 540 offsetEdges.append(offsetEdgeBuffer[j]); 524 541 } 525 542 -
trunk/Source/WebCore/rendering/ExclusionPolygon.h
r140606 r142805 166 166 } 167 167 168 OffsetPolygonEdge(const FloatPoint& reflexVertex, const FloatSize& offset1, const FloatSize& offset2) 169 : m_vertex1(reflexVertex + offset1) 170 , m_vertex2(reflexVertex + offset2) 171 , m_edgeIndex(-1) 172 { 173 } 174 168 175 OffsetPolygonEdge(const ExclusionPolygon& polygon, float minLogicalIntervalTop, const FloatSize& offset) 169 176 : m_vertex1(FloatPoint(polygon.shapeLogicalBoundingBox().x(), minLogicalIntervalTop) + offset) 170 177 , m_vertex2(FloatPoint(polygon.shapeLogicalBoundingBox().maxX(), minLogicalIntervalTop) + offset) 171 , m_edgeIndex( polygon.numberOfEdges())178 , m_edgeIndex(-1) 172 179 { 173 180 } … … 175 182 virtual const FloatPoint& vertex1() const OVERRIDE { return m_vertex1; } 176 183 virtual const FloatPoint& vertex2() const OVERRIDE { return m_vertex2; } 177 unsignededgeIndex() const { return m_edgeIndex; }184 int edgeIndex() const { return m_edgeIndex; } 178 185 179 186 private: 180 187 FloatPoint m_vertex1; 181 188 FloatPoint m_vertex2; 182 unsignedm_edgeIndex;189 int m_edgeIndex; 183 190 }; 184 191
Note: See TracChangeset
for help on using the changeset viewer.