Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: Source/core/rendering/exclusions/ExclusionPolygon.cpp

Issue 14959014: [CSS Exclusions] Programmatic layout tests fail when subpixel layout is disabled (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated per review feedback. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-right-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 13 matching lines...) Expand all
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27 * OF THE POSSIBILITY OF SUCH DAMAGE. 27 * OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #include "config.h" 30 #include "config.h"
31 #include "core/rendering/exclusions/ExclusionPolygon.h" 31 #include "core/rendering/exclusions/ExclusionPolygon.h"
32 32
33 #include "core/platform/graphics/LayoutPoint.h" 33 #include "core/platform/graphics/LayoutPoint.h"
34 34 #include "wtf/MathExtras.h"
35 #include <wtf/MathExtras.h>
36 35
37 namespace WebCore { 36 namespace WebCore {
38 37
39 enum EdgeIntersectionType { 38 enum EdgeIntersectionType {
40 Normal, 39 Normal,
41 VertexMinY, 40 VertexMinY,
42 VertexMaxY, 41 VertexMaxY,
43 VertexYBoth 42 VertexYBoth
44 }; 43 };
45 44
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 static inline void appendArc(Vector<FloatPoint>& vertices, const FloatPoint& arc Center, float arcRadius, const FloatPoint& startArcVertex, const FloatPoint& end ArcVertex, bool padding) 112 static inline void appendArc(Vector<FloatPoint>& vertices, const FloatPoint& arc Center, float arcRadius, const FloatPoint& startArcVertex, const FloatPoint& end ArcVertex, bool padding)
114 { 113 {
115 float startAngle = atan2(startArcVertex.y() - arcCenter.y(), startArcVertex. x() - arcCenter.x()); 114 float startAngle = atan2(startArcVertex.y() - arcCenter.y(), startArcVertex. x() - arcCenter.x());
116 float endAngle = atan2(endArcVertex.y() - arcCenter.y(), endArcVertex.x() - arcCenter.x()); 115 float endAngle = atan2(endArcVertex.y() - arcCenter.y(), endArcVertex.x() - arcCenter.x());
117 const float twoPI = piFloat * 2; 116 const float twoPI = piFloat * 2;
118 if (startAngle < 0) 117 if (startAngle < 0)
119 startAngle += twoPI; 118 startAngle += twoPI;
120 if (endAngle < 0) 119 if (endAngle < 0)
121 endAngle += twoPI; 120 endAngle += twoPI;
122 float angle = (startAngle > endAngle) ? (startAngle - endAngle) : (startAngl e + twoPI - endAngle); 121 float angle = (startAngle > endAngle) ? (startAngle - endAngle) : (startAngl e + twoPI - endAngle);
123 const float arcSegmentCount = 5; // An odd number so that one arc vertex wil l be eactly arcRadius from arcCenter. 122 const float arcSegmentCount = 6; // An even number so that one arc vertex wi ll be eactly arcRadius from arcCenter.
124 float angle5 = ((padding) ? -angle : twoPI - angle) / arcSegmentCount; 123 float arcSegmentAngle = ((padding) ? -angle : twoPI - angle) / arcSegmentCo unt;
125 124
126 vertices.append(startArcVertex); 125 vertices.append(startArcVertex);
127 for (unsigned i = 1; i < arcSegmentCount; ++i) { 126 for (unsigned i = 1; i < arcSegmentCount; ++i) {
128 float angle = startAngle + angle5 * i; 127 float angle = startAngle + arcSegmentAngle * i;
129 vertices.append(arcCenter + FloatPoint(cos(angle) * arcRadius, sin(angle ) * arcRadius)); 128 vertices.append(arcCenter + FloatPoint(cos(angle) * arcRadius, sin(angle ) * arcRadius));
130 } 129 }
131 vertices.append(endArcVertex); 130 vertices.append(endArcVertex);
132 } 131 }
133 132
134 static inline void snapVerticesToLayoutUnitGrid(Vector<FloatPoint>& vertices) 133 static inline void snapVerticesToLayoutUnitGrid(Vector<FloatPoint>& vertices)
135 { 134 {
136 for (unsigned i = 0; i < vertices.size(); ++i) 135 for (unsigned i = 0; i < vertices.size(); ++i)
137 vertices[i] = flooredLayoutPoint(vertices[i]); 136 vertices[i] = flooredLayoutPoint(vertices[i]);
138 } 137 }
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 } 504 }
506 } 505 }
507 } 506 }
508 507
509 if (firstFitFound) 508 if (firstFitFound)
510 result = LayoutUnit::fromFloatCeil(firstFitRect.y()); 509 result = LayoutUnit::fromFloatCeil(firstFitRect.y());
511 return firstFitFound; 510 return firstFitFound;
512 } 511 }
513 512
514 } // namespace WebCore 513 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-right-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698