OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |