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

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

Issue 53583005: Fix typo in simple-polygon.js LayoutTest helper (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 // 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 function createPolygon(vertices) { 3 function createPolygon(vertices) {
4 var xCoordinates = vertices.map( function(p) { return p.x; } ); 4 var xCoordinates = vertices.map( function(p) { return p.x; } );
5 var yCoordinates = vertices.map( function(p) { return p.y; } ); 5 var yCoordinates = vertices.map( function(p) { return p.y; } );
6 return { 6 return {
7 vertices: vertices, 7 vertices: vertices,
8 minX: Math.min.apply(null, xCoordinates), 8 minX: Math.min.apply(null, xCoordinates),
9 maxX: Math.max.apply(null, xCoordinates), 9 maxX: Math.max.apply(null, xCoordinates),
10 minY: Math.min.apply(null, yCoordinates), 10 minY: Math.min.apply(null, yCoordinates),
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return i1; 99 return i1;
100 100
101 return [Math.max(i1[0], i2[0]), Math.min(i1[1], i2[1])]; 101 return [Math.max(i1[0], i2[0]), Math.min(i1[1], i2[1])];
102 } 102 }
103 103
104 // Generate an "X X ..." string that contains enough characters to fill the poly gon. Each 104 // Generate an "X X ..." string that contains enough characters to fill the poly gon. Each
105 // character occupies a lineHeight size square cell, the top of first line of ch aracters is aligned 105 // character occupies a lineHeight size square cell, the top of first line of ch aracters is aligned
106 // with the the polygon's bounds minimum Y value, and each line of characters fi lls the interior 106 // with the the polygon's bounds minimum Y value, and each line of characters fi lls the interior
107 // of the polygon. 107 // of the polygon.
108 108
109 function generatePolygonContentString(polygon, lineheight) { 109 function generatePolygonContentString(polygon, lineHeight) {
110 var result = ""; 110 var result = "";
111 111
112 for (var y = polygon.minY; y < polygon.maxY; y += lineHeight) { 112 for (var y = polygon.minY; y < polygon.maxY; y += lineHeight) {
113 var xIntercepts = polygonLineIntercepts(polygon, y, lineHeight); 113 var xIntercepts = polygonLineIntercepts(polygon, y, lineHeight);
114 var lengthInCells = Math.floor(xIntercepts[1] / lineHeight) - Math.ceil( xIntercepts[0] / lineHeight); 114 var lengthInCells = Math.floor(xIntercepts[1] / lineHeight) - Math.ceil( xIntercepts[0] / lineHeight);
115 for (var i = 0; i < lengthInCells / 2; i++) 115 for (var i = 0; i < lengthInCells / 2; i++)
116 result += "X "; // all lines end in a space, to enable line breakin g 116 result += "X "; // all lines end in a space, to enable line breakin g
117 } 117 }
118 118
119 return result; 119 return result;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 positionInformativeText("informative-text", stylesheet, polygon, lineHeight) 238 positionInformativeText("informative-text", stylesheet, polygon, lineHeight)
239 } 239 }
240 240
241 function createPolygonShapeInsideTestCaseExpected() { 241 function createPolygonShapeInsideTestCaseExpected() {
242 var stylesheet = document.getElementById("stylesheet").sheet; 242 var stylesheet = document.getElementById("stylesheet").sheet;
243 var polygon = createPolygon(vertices); 243 var polygon = createPolygon(vertices);
244 generateSimulatedPolygonShapeInsideElement("polygon-shape-inside", styleshee t, polygon, lineHeight); 244 generateSimulatedPolygonShapeInsideElement("polygon-shape-inside", styleshee t, polygon, lineHeight);
245 generatePolygonSVGElements("polygon-svg-shape", stylesheet, polygon, lineHei ght); 245 generatePolygonSVGElements("polygon-svg-shape", stylesheet, polygon, lineHei ght);
246 positionInformativeText("informative-text", stylesheet, polygon, lineHeight) 246 positionInformativeText("informative-text", stylesheet, polygon, lineHeight)
247 } 247 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698