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

Side by Side Diff: LayoutTests/fast/shapes/resources/simple-polygon.js

Issue 20489004: [CSS Shapes] Fix Shapes's polygon tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 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 | « no previous file | LayoutTests/fast/shapes/shape-inside/shape-inside-regular-polygon16.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // The functions in this file are intended to be used to test non-complex polygo ns 1 // The functions in this file are intended to be used to test non-complex polygo ns
2 // where horizontal lines that overlap the polygon only cross the polygon twice. 2 // where horizontal lines that overlap the polygon only cross the polygon twice.
3 if (window.internals) 3 if (window.internals)
4 window.internals.settings.setCSSExclusionsEnabled(true); 4 window.internals.settings.setCSSExclusionsEnabled(true);
5 5
6 function createPolygon(vertices) { 6 function createPolygon(vertices) {
7 var xCoordinates = vertices.map( function(p) { return p.x; } ); 7 var xCoordinates = vertices.map( function(p) { return p.x; } );
8 var yCoordinates = vertices.map( function(p) { return p.y; } ); 8 var yCoordinates = vertices.map( function(p) { return p.y; } );
9 return { 9 return {
10 vertices: vertices, 10 vertices: vertices,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 else { 82 else {
83 interceptsMinX = Math.min(interceptX, interceptsMinX); 83 interceptsMinX = Math.min(interceptX, interceptsMinX);
84 interceptsMaxX = Math.max(interceptX, interceptsMaxX); 84 interceptsMaxX = Math.max(interceptX, interceptsMaxX);
85 } 85 }
86 } 86 }
87 } 87 }
88 88
89 if (!foundXIntercept) 89 if (!foundXIntercept)
90 return []; 90 return [];
91 91
92 return [SubPixelLayout.snapToLayoutUnit(interceptsMinX), SubPixelLayout.snap TolayoutUnit(interceptsMaxX)]; 92 return [SubPixelLayout.snapToLayoutUnit(interceptsMinX), SubPixelLayout.snap ToLayoutUnit(interceptsMaxX)];
93 } 93 }
94 94
95 function polygonLineIntercepts(polygon, y, lineHeight) { 95 function polygonLineIntercepts(polygon, y, lineHeight) {
96 var i1 = polygonXIntercepts(polygon, y); 96 var i1 = polygonXIntercepts(polygon, y);
97 var i2 = polygonXIntercepts(polygon, y + lineHeight); 97 var i2 = polygonXIntercepts(polygon, y + lineHeight);
98 98
99 if (i1.length < 2) 99 if (i1.length < 2)
100 return i2; 100 return i2;
101 if (i2.length < 2) 101 if (i2.length < 2)
102 return i1; 102 return i1;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 positionInformativeText("informative-text", stylesheet, polygon, lineHeight) 241 positionInformativeText("informative-text", stylesheet, polygon, lineHeight)
242 } 242 }
243 243
244 function createPolygonShapeInsideTestCaseExpected() { 244 function createPolygonShapeInsideTestCaseExpected() {
245 var stylesheet = document.getElementById("stylesheet").sheet; 245 var stylesheet = document.getElementById("stylesheet").sheet;
246 var polygon = createPolygon(vertices); 246 var polygon = createPolygon(vertices);
247 generateSimulatedPolygonShapeInsideElement("polygon-shape-inside", styleshee t, polygon, lineHeight); 247 generateSimulatedPolygonShapeInsideElement("polygon-shape-inside", styleshee t, polygon, lineHeight);
248 generatePolygonSVGElements("polygon-svg-shape", stylesheet, polygon, lineHei ght); 248 generatePolygonSVGElements("polygon-svg-shape", stylesheet, polygon, lineHei ght);
249 positionInformativeText("informative-text", stylesheet, polygon, lineHeight) 249 positionInformativeText("informative-text", stylesheet, polygon, lineHeight)
250 } 250 }
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/shapes/shape-inside/shape-inside-regular-polygon16.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698