| OLD | NEW |
| 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 Loading... |
| 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.roundLineLeft(interceptsMinX), SubPixelLayout.roundLi
neRight(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 Loading... |
| 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 } |
| OLD | NEW |