Changeset 147831 in webkit
- Timestamp:
- Apr 5, 2013 9:21:08 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r147830 r147831 1 2013-04-05 Hans Muller <hmuller@adobe.com> 2 3 [CSS Exclusions] Add support for the simple case of shape-margin polygonal shape-outside 4 https://bugs.webkit.org/show_bug.cgi?id=113726 5 6 Reviewed by Dirk Schulze. 7 8 Verify that shape-outside layout works correctly on floats, when shape-margin is specifed. 9 10 * fast/exclusions/shape-outside-floats/shape-outside-floats-diamond-margin-polygon-expected.txt: Added. 11 * fast/exclusions/shape-outside-floats/shape-outside-floats-diamond-margin-polygon.html: Added. 12 * fast/exclusions/shape-outside-floats/shape-outside-floats-left-margin-polygon-expected.html: Added. 13 * fast/exclusions/shape-outside-floats/shape-outside-floats-left-margin-polygon.html: Added. 14 * fast/exclusions/shape-outside-floats/shape-outside-floats-right-margin-polygon-expected.html: Added. 15 * fast/exclusions/shape-outside-floats/shape-outside-floats-right-margin-polygon.html: Added. 16 1 17 2013-04-05 Benjamin Poulain <bpoulain@apple.com> 2 18 -
trunk/Source/WebCore/ChangeLog
r147829 r147831 1 2013-04-05 Hans Muller <hmuller@adobe.com> 2 3 [CSS Exclusions] Add support for the simple case of shape-margin polygonal shape-outside 4 https://bugs.webkit.org/show_bug.cgi?id=113726 5 6 Reviewed by Dirk Schulze. 7 8 Add support for computing the shape-outside shape-margin boundary for a polygon. 9 This change is similar to the one added for padding polygons, see bug 112592. 10 The algorithm used for computing the margin boundary is is provisional. It works 11 correctly for convex polygons and will work correctly for non self-intersecting 12 polygons whose margin boundary is the same shape as the original polygon. 13 14 Tests: fast/exclusions/shape-outside-floats/shape-outside-floats-diamond-margin-polygon.html 15 fast/exclusions/shape-outside-floats/shape-outside-floats-left-margin-polygon.html 16 fast/exclusions/shape-outside-floats/shape-outside-floats-right-margin-polygon.html 17 18 * rendering/ExclusionPolygon.cpp: 19 (WebCore::appendArc): Generalized this method a little, to deal with margin and padding connecting arcs. 20 (WebCore::computeShapePaddingBounds): Pass the new appendArc() parameter. 21 (WebCore::computeShapeMarginBounds): Compute the margin boundary for a polygon, per the constraints summarized above. 22 (WebCore::ExclusionPolygon::getExcludedIntervals): Use the margin polygon for this computation. 23 1 24 2013-04-05 Andy Estes <aestes@apple.com> 2 25 -
trunk/Source/WebCore/rendering/ExclusionPolygon.cpp
r147111 r147831 109 109 } 110 110 111 static inline void appendArc(Vector<FloatPoint>& vertices, const FloatPoint& arcCenter, float arcRadius, const FloatPoint& startArcVertex, const FloatPoint& endArcVertex )111 static inline void appendArc(Vector<FloatPoint>& vertices, const FloatPoint& arcCenter, float arcRadius, const FloatPoint& startArcVertex, const FloatPoint& endArcVertex, bool padding) 112 112 { 113 113 float startAngle = atan2(startArcVertex.y() - arcCenter.y(), startArcVertex.x() - arcCenter.x()); 114 114 float endAngle = atan2(endArcVertex.y() - arcCenter.y(), endArcVertex.x() - arcCenter.x()); 115 const float twoPI = piFloat * 2; 115 116 if (startAngle < 0) 116 startAngle += piFloat * 2;117 startAngle += twoPI; 117 118 if (endAngle < 0) 118 endAngle += piFloat * 2; 119 endAngle += twoPI; 120 float angle = (startAngle > endAngle) ? (startAngle - endAngle) : (startAngle + twoPI - endAngle); 119 121 const float arcSegmentCount = 5; // An odd number so that one arc vertex will be eactly arcRadius from arcCenter. 120 float angle5 = ((startAngle > endAngle) ? (startAngle - endAngle) : (startAngle + piFloat * 2 - endAngle)) / arcSegmentCount;122 float angle5 = ((padding) ? -angle : twoPI - angle) / arcSegmentCount; 121 123 122 124 vertices.append(startArcVertex); 123 125 for (unsigned i = 1; i < arcSegmentCount; ++i) { 124 float angle = startAngle -angle5 * i;126 float angle = startAngle + angle5 * i; 125 127 vertices.append(arcCenter + FloatPoint(cos(angle) * arcRadius, sin(angle) * arcRadius)); 126 128 } … … 142 144 paddedVertices->append(intersection); 143 145 else if (isReflexVertex(prevEdge.vertex1(), thisEdge.vertex1(), thisEdge.vertex2())) 144 appendArc(*paddedVertices, thisEdge.vertex1(), padding, prevOffsetEdge.vertex2(), thisOffsetEdge.vertex1() );146 appendArc(*paddedVertices, thisEdge.vertex1(), padding, prevOffsetEdge.vertex2(), thisOffsetEdge.vertex1(), true); 145 147 } 146 148 … … 148 150 } 149 151 150 // FIXME: this is just a stub (bug 112917)151 152 static inline FloatPolygon *computeShapeMarginBounds(const FloatPolygon& polygon, float margin, WindRule fillRule) 152 153 { 153 UNUSED_PARAM(margin); 154 155 Vector<FloatPoint>* marginVertices = new Vector<FloatPoint>(polygon.numberOfVertices()); 156 for (unsigned i = 0; i < polygon.numberOfVertices(); ++i) 157 (*marginVertices)[i] = polygon.vertexAt(i); 154 Vector<FloatPoint>* marginVertices = new Vector<FloatPoint>(); 155 FloatPoint intersection; 156 157 for (unsigned i = 0; i < polygon.numberOfEdges(); ++i) { 158 const FloatPolygonEdge& thisEdge = polygon.edgeAt(i); 159 const FloatPolygonEdge& prevEdge = thisEdge.previousEdge(); 160 OffsetPolygonEdge thisOffsetEdge(thisEdge, outwardEdgeNormal(thisEdge) * margin); 161 OffsetPolygonEdge prevOffsetEdge(prevEdge, outwardEdgeNormal(prevEdge) * margin); 162 163 if (prevOffsetEdge.intersection(thisOffsetEdge, intersection)) 164 marginVertices->append(intersection); 165 else 166 appendArc(*marginVertices, thisEdge.vertex1(), margin, prevOffsetEdge.vertex2(), thisOffsetEdge.vertex1(), false); 167 } 168 158 169 return new FloatPolygon(adoptPtr(marginVertices), fillRule); 159 170 } … … 329 340 void ExclusionPolygon::getExcludedIntervals(float logicalTop, float logicalHeight, SegmentList& result) const 330 341 { 331 if (isEmpty()) 342 const FloatPolygon& polygon = shapeMarginBounds(); 343 if (polygon.isEmpty()) 332 344 return; 333 345 … … 336 348 337 349 Vector<ExclusionInterval> y1XIntervals, y2XIntervals; 338 computeXIntersections( m_polygon, y1, true, y1XIntervals);339 computeXIntersections( m_polygon, y2, false, y2XIntervals);350 computeXIntersections(polygon, y1, true, y1XIntervals); 351 computeXIntersections(polygon, y2, false, y2XIntervals); 340 352 341 353 Vector<ExclusionInterval> mergedIntervals; … … 343 355 344 356 Vector<ExclusionInterval> edgeIntervals; 345 computeOverlappingEdgeXProjections( m_polygon, y1, y2, edgeIntervals);357 computeOverlappingEdgeXProjections(polygon, y1, y2, edgeIntervals); 346 358 347 359 Vector<ExclusionInterval> excludedIntervals;
Note: See TracChangeset
for help on using the changeset viewer.