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

Side by Side Diff: LayoutTests/fast/exclusions/resources/rounded-rectangle.js

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 | « no previous file | LayoutTests/fast/exclusions/resources/simple-polygon.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 if (window.internals) 1 if (window.internals)
2 window.internals.settings.setCSSExclusionsEnabled(true); 2 window.internals.settings.setCSSExclusionsEnabled(true);
3 3
4 function defined(value) { return typeof value !== "undefined"; } 4 function defined(value) { return typeof value !== "undefined"; }
5 5
6 function convertToRoundedRect(dimensions) { 6 function convertToRoundedRect(dimensions) {
7 if (defined(dimensions.shapeCenterX) && defined(dimensions.shapeCenterY)) { 7 if (defined(dimensions.shapeCenterX) && defined(dimensions.shapeCenterY)) {
8 if (defined(dimensions.shapeRadius)) { 8 if (defined(dimensions.shapeRadius)) {
9 // Convert a circle. 9 // Convert a circle.
10 dimensions.shapeX = dimensions.shapeCenterX - dimensions.shapeRadius ; 10 dimensions.shapeX = dimensions.shapeCenterX - dimensions.shapeRadius ;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 paddingTop.style.width = dimensions.width + "px"; 88 paddingTop.style.width = dimensions.width + "px";
89 paddingTop.style.height = dimensions.shapeY + "px"; 89 paddingTop.style.height = dimensions.shapeY + "px";
90 element.appendChild(paddingTop); 90 element.appendChild(paddingTop);
91 } 91 }
92 92
93 for (var y = 0; y < dimensions.shapeHeight; y+= floatHeight) { 93 for (var y = 0; y < dimensions.shapeHeight; y+= floatHeight) {
94 var inset = simpleRectangle ? 0 : xInset(dimensions, y, y + lineHeight); 94 var inset = simpleRectangle ? 0 : xInset(dimensions, y, y + lineHeight);
95 95
96 var paddingLeft = document.createElement("div"); 96 var paddingLeft = document.createElement("div");
97 paddingLeft.setAttribute("class", "float left"); 97 paddingLeft.setAttribute("class", "float left");
98 paddingLeft.style.width = SubPixelLayout.roundLineLeft(dimensions.shapeX + inset) + "px"; 98 paddingLeft.style.width = SubPixelLayout.snapToLayoutUnit(dimensions.sha peX + inset) + "px";
99 element.appendChild(paddingLeft); 99 element.appendChild(paddingLeft);
100 100
101 var paddingRight = document.createElement("div"); 101 var paddingRight = document.createElement("div");
102 paddingRight.setAttribute("class", "float right"); 102 paddingRight.setAttribute("class", "float right");
103 paddingRight.style.width = SubPixelLayout.roundLineRight((dimensions.wid th - dimensions.shapeWidth - dimensions.shapeX) + inset) + "px"; 103 paddingRight.style.width = SubPixelLayout.snapToLayoutUnit((dimensions.w idth - dimensions.shapeWidth - dimensions.shapeX) + inset) + "px";
104 element.appendChild(paddingRight); 104 element.appendChild(paddingRight);
105 } 105 }
106 } 106 }
107 107
108 function simulateShapeOutline(elementId, stylesheet, dimensions) { 108 function simulateShapeOutline(elementId, stylesheet, dimensions) {
109 stylesheet.insertRule("#" + elementId + "{ position: relative; }"); 109 stylesheet.insertRule("#" + elementId + "{ position: relative; }");
110 stylesheet.insertRule("#" + elementId + "::before { " 110 stylesheet.insertRule("#" + elementId + "::before { "
111 + "content: ' '; " 111 + "content: ' '; "
112 + "display: block; " 112 + "display: block; "
113 + "position: absolute; " 113 + "position: absolute; "
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // For simulating, we ignore the x and y values, since we're not attempting 215 // For simulating, we ignore the x and y values, since we're not attempting
216 // to draw the float's content in the right place, we just want to simulate 216 // to draw the float's content in the right place, we just want to simulate
217 // the shape's effect. 217 // the shape's effect.
218 if (floatValue == "right") 218 if (floatValue == "right")
219 dimensions.shapeX = -dimensions.shapeWidth; 219 dimensions.shapeX = -dimensions.shapeWidth;
220 else 220 else
221 dimensions.shapeX = 0; 221 dimensions.shapeX = 0;
222 dimensions.shapeY = 0; 222 dimensions.shapeY = 0;
223 simulateShapeOutline(elementId, stylesheet, dimensions); 223 simulateShapeOutline(elementId, stylesheet, dimensions);
224 } 224 }
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/exclusions/resources/simple-polygon.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698