Changeset 149457 in webkit
- Timestamp:
- May 1, 2013 3:01:10 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r149450 r149457 1 2013-05-01 Hans Muller <hmuller@adobe.com> 2 3 [CSS Exclusions] Programmatic layout tests fail when subpixel layout is disabled 4 https://bugs.webkit.org/show_bug.cgi?id=115455 5 6 Reviewed by Dirk Schulze. 7 8 First round of changes to restore platform/mac exclusion tests that started failing when 9 subpixel layout was turned off. This set of changes just restores four tests. It also revises 10 the subpixel-utils code to bring it into line with the most recent LayoutUnit et al changes 11 and to simplify its use a little. 12 13 * fast/exclusions/resources/rounded-rectangle.js: 14 (simulateShape): Revised dependencies on subpixel-utils. 15 * fast/exclusions/resources/simple-polygon.js: 16 (polygonXIntercepts): Ditto. 17 * fast/exclusions/resources/subpixel-utils.js: 18 (SubPixelLayout.): Substantially revised, see description. 19 * fast/exclusions/shape-inside/shape-inside-polygon-layout-expected.txt: 20 * fast/exclusions/shape-inside/shape-inside-polygon-layout.html: 21 * fast/exclusions/shape-inside/shape-inside-polygon-padding-003-expected.txt: 22 * fast/exclusions/shape-inside/shape-inside-polygon-padding-003.html: 23 * fast/exclusions/shape-inside/shape-inside-rounded-rectangle-fit-002-expected.html: 24 * fast/exclusions/shape-outside-floats/shape-outside-floats-diamond-margin-polygon-expected.txt: 25 * fast/exclusions/shape-outside-floats/shape-outside-floats-diamond-margin-polygon.html: 26 * fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-left-expected.txt: 27 * fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-left.html: 28 * fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-right-expected.txt: 29 * fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-right.html: 30 * platform/mac/TestExpectations: 31 1 32 2013-05-01 Enrica Casucci <enrica@apple.com> 2 33 -
trunk/LayoutTests/fast/exclusions/resources/rounded-rectangle.js
r148975 r149457 96 96 var paddingLeft = document.createElement("div"); 97 97 paddingLeft.setAttribute("class", "float left"); 98 paddingLeft.style.width = SubPixelLayout. roundLineLeft(dimensions.shapeX + inset) + "px";98 paddingLeft.style.width = SubPixelLayout.snapToLayoutUnit(dimensions.shapeX + inset) + "px"; 99 99 element.appendChild(paddingLeft); 100 100 101 101 var paddingRight = document.createElement("div"); 102 102 paddingRight.setAttribute("class", "float right"); 103 paddingRight.style.width = SubPixelLayout. roundLineRight((dimensions.width - dimensions.shapeWidth - dimensions.shapeX) + inset) + "px";103 paddingRight.style.width = SubPixelLayout.snapToLayoutUnit((dimensions.width - dimensions.shapeWidth - dimensions.shapeX) + inset) + "px"; 104 104 element.appendChild(paddingRight); 105 105 } -
trunk/LayoutTests/fast/exclusions/resources/simple-polygon.js
r133384 r149457 90 90 return []; 91 91 92 return [SubPixelLayout. roundLineLeft(interceptsMinX), SubPixelLayout.roundLineRight(interceptsMaxX)];92 return [SubPixelLayout.snapToLayoutUnit(interceptsMinX), SubPixelLayout.snapTolayoutUnit(interceptsMaxX)]; 93 93 } 94 94 -
trunk/LayoutTests/fast/exclusions/resources/subpixel-utils.js
r147249 r149457 1 1 var SubPixelLayout = (function() { 2 var _subPixelLayout = null; 3 function initSubPixelLayout() { 4 var elem = document.createElement('div'); 5 elem.style.setProperty('width', '4.5px'); 6 document.body.appendChild(elem); 7 var bounds = elem.getBoundingClientRect(); 8 _subPixelLayout = (bounds.width != Math.floor(bounds.width)); 9 document.body.removeChild(elem); 2 var enabled = undefined; 3 4 function isEnabled() 5 { 6 if (enabled === undefined) { 7 var elem = document.createElement('div'); 8 elem.style.setProperty('width', '4.5px'); 9 document.body.appendChild(elem); 10 var bounds = elem.getBoundingClientRect(); 11 enabled = (bounds.width != Math.floor(bounds.width)); 12 document.body.removeChild(elem); 13 } 14 return enabled; 10 15 } 11 document.addEventListener('DOMContentLoaded', initSubPixelLayout); 16 12 17 return { 13 initSubPixelLayout: initSubPixelLayout, 14 roundLineLeft: function(f) { 15 if (!_subPixelLayout) 16 return Math.floor(f); 17 return Math.floor((Math.floor(f * 64) + 32) / 64); // see FractionLayoutUnit::round() 18 isEnabled: isEnabled, 19 snapToLayoutUnit: function(f) { 20 return isEnabled() ? Math.floor(f * 64) / 64 : Math.floor(f); // as in LayoutUnit(f).toFloat() 18 21 }, 19 roundLineRight: function(f) { 20 if (!_subPixelLayout) 21 return Math.floor(f); 22 return Math.floor(Math.floor(f * 64) / 64); // see FractionLayoutUnit::floor() 23 }, 24 isSubPixelLayoutEnabled: function() { 25 return _subPixelLayout; 22 ceilSnapToLayoutUnit: function(f) { 23 return isEnabled() ? Math.ceil(f * 64) / 64 : Math.ceil(f); // see ceiledLayoutUnit(), LayoutUnit.h 26 24 } 27 25 } -
trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-polygon-layout-expected.txt
r148582 r149457 3 3 X 4 4 X 5 PASS shapeInsideRect('a').top is 76 PASS shapeInsideRect('b').top is 227 PASS shapeInsideRect('c').top is 378 PASS shapeInsideRect('d').top is 529 5 -
trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-polygon-layout.html
r148582 r149457 3 3 <head> 4 4 <script src="../../js/resources/js-test-pre.js"></script> 5 <script src="../resources/subpixel-utils.js"></script> 5 6 <script> 6 7 if (window.internals) … … 48 49 } 49 50 50 /* Verify that all four one-character lines are vertically adjacent and 15 pixels high. */ 51 shouldBe("shapeInsideRect('a').top", "7"); 52 shouldBe("shapeInsideRect('b').top", "22"); 53 shouldBe("shapeInsideRect('c').top", "37"); 54 shouldBe("shapeInsideRect('d').top", "52"); 51 // The top of the polygon is a horzontal edge at y=1.42%, and its parent's height is 500px. The top of 52 // the first line, span "a", will align with the top of the polygon. The ExclusionShape::firstIncludedIntervalLogicalTop() 53 // methods use ceiledLayoutUnit() to ensure that their return value is within the shape. 54 var lineATop = SubPixelLayout.ceilSnapToLayoutUnit(.0142 * 500); 55 56 // Verify that all four one-character lines are vertically adjacent and 15 pixels high. 57 var quiet = true; // PASS output depends on SubPixelLayout.isEnabled() 58 shouldBe("shapeInsideRect('a').top", String(lineATop), quiet); 59 shouldBe("shapeInsideRect('b').top", String(lineATop + 15), quiet); 60 shouldBe("shapeInsideRect('c').top", String(lineATop + 30), quiet); 61 shouldBe("shapeInsideRect('d').top", String(lineATop + 45), quiet); 55 62 </script> 56 63 </html> 57 -
trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-polygon-padding-003-expected.txt
r147111 r149457 5 5 XXX 6 6 PASS shapeInsideRect('a').top is 50 7 PASS shapeInsideRect('a').left is within 1 of 190.2158 7 PASS shapeInsideRect('a').width is 150 9 8 PASS shapeInsideRect('b').top is 150 … … 11 10 PASS shapeInsideRect('b').width is 100 12 11 PASS shapeInsideRect('c').top is 250 13 PASS shapeInsideRect('c').left is within 1 of 190.21514 12 PASS shapeInsideRect('c').width is 150 15 13 -
trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-polygon-padding-003.html
r147111 r149457 3 3 <head> 4 4 <script src="../../js/resources/js-test-pre.js"></script> 5 <script src="../resources/subpixel-utils.js"></script> 5 6 <script> 6 7 if (window.internals) … … 71 72 */ 72 73 74 var quiet = true; // PASS output depends on SubPixelLayout.isEnabled() 75 73 76 shouldBe("shapeInsideRect('a').top", "50"); 74 shouldBeCloseTo("shapeInsideRect('a').left", 190.215, 1);77 shouldBeCloseTo("shapeInsideRect('a').left", SubPixelLayout.snapToLayoutUnit(190.215), 1, quiet); 75 78 shouldBe("shapeInsideRect('a').width", "150"); 76 79 … … 80 83 81 84 shouldBe("shapeInsideRect('c').top", "250"); 82 shouldBeCloseTo("shapeInsideRect('c').left", 190.215, 1);85 shouldBeCloseTo("shapeInsideRect('c').left", SubPixelLayout.snapToLayoutUnit(190.215), 1, quiet); 83 86 shouldBe("shapeInsideRect('c').width", "150"); 84 87 </script> -
trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-rounded-rectangle-fit-002-expected.html
r137518 r149457 48 48 <script> 49 49 function init() { 50 if (!SubPixelLayout.is SubPixelLayoutEnabled())50 if (!SubPixelLayout.isEnabled()) 51 51 document.getElementById("shape-inside").style.top = "30px"; 52 52 } -
trunk/LayoutTests/fast/exclusions/shape-outside-floats/shape-outside-floats-diamond-margin-polygon-expected.txt
r147831 r149457 1 X 2 X 3 X 4 5 X 6 X 7 X 1 8 PASS elementRect('l1').top is 0 2 9 PASS elementRect('l1').left is within 1 of 98 … … 11 18 PASS elementRect('l6').top is 120 12 19 PASS elementRect('l6').left is within 1 of 98 13 X14 X15 X16 20 17 X18 X19 X -
trunk/LayoutTests/fast/exclusions/shape-outside-floats/shape-outside-floats-diamond-margin-polygon.html
r147831 r149457 13 13 font: 20px/1 Ahem, sans-serif; 14 14 width: 200px; 15 height: 300px;15 height: 150px; 16 16 } 17 17 … … 26 26 #svg-shape { 27 27 position: absolute; 28 display:block; 28 display: block; 29 top: 0px; 30 left: 0px; 29 31 width: 100px; 30 32 height: 100px; 31 33 } 32 34 </style> 33 34 35 <body> 35 <p></p>36 36 <div id="container"> 37 37 <div id="float-left"> … … 42 42 <span id="l1">X</span></br><span id="l2">X</span><br/><span id="l3">X</span><br/><br/><span id="l4">X</span><br/><span id="l5">X</span><br/><span id="l6">X</span> 43 43 </div> 44 <div id="console"></div> 44 45 </body> 45 46 <script> … … 59 60 function marginLeftXIntercept(lineNumber) 60 61 { 61 return SubPixelLayout. roundLineLeft(lineNumber * 20 + 20 * Math.sqrt(2) + 50);62 return SubPixelLayout.snapToLayoutUnit(lineNumber * 20 + 20 * Math.sqrt(2) + 50); 62 63 } 64 65 var quiet = true; // PASS output depends on SubPixelLayout.isEnabled() 63 66 64 67 shouldBe("elementRect('l1').top", "0"); -
trunk/LayoutTests/fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-left-expected.txt
r147384 r149457 1 PASS elementRect('s1').top is 02 PASS elementRect('s1').left is 3473 PASS elementRect('s2').top is 204 PASS elementRect('s2').left is 3905 PASS elementRect('s3').top is 406 PASS elementRect('s3').left is 4177 1 The left edges of the three black squares should follow the outer ellipse boundary and each square should appear on a subsequent line. 8 2 … … 10 4 X 11 5 X 6 PASS elementRect('s1').top is 0 7 PASS elementRect('s2').top is 20 8 PASS elementRect('s3').top is 40 9 -
trunk/LayoutTests/fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-left.html
r147384 r149457 53 53 </div> 54 54 </div> 55 <div id="console"></div> 55 56 </body> 56 57 <script> … … 67 68 function marginEllipseLeftXIntercept(y, cx, rx, ry) 68 69 { 69 return String( SubPixelLayout. roundLineLeft(cx + rx * Math.sqrt(1 - Math.pow((ry - y) / ry, 2))) );70 return String( SubPixelLayout.snapToLayoutUnit(cx + rx * Math.sqrt(1 - Math.pow((ry - y) / ry, 2))) ); 70 71 } 71 72 … … 73 74 // That's why the Y coordinate in each of those tests is 20 greater than the ".top" test. 74 75 75 SubPixelLayout.initSubPixelLayout(); 76 var quiet = true; // PASS output depends on SubPixelLayout.isEnabled() 76 77 77 78 shouldBe("elementRect('s1').top", "0"); 78 shouldBe("elementRect('s1').left", marginEllipseLeftXIntercept(20, 225, 225, 125) );79 shouldBe("elementRect('s1').left", marginEllipseLeftXIntercept(20, 225, 225, 125), quiet); 79 80 80 81 shouldBe("elementRect('s2').top", "20"); 81 shouldBe("elementRect('s2').left", marginEllipseLeftXIntercept(40, 225, 225, 125) );82 shouldBe("elementRect('s2').left", marginEllipseLeftXIntercept(40, 225, 225, 125), quiet); 82 83 83 84 shouldBe("elementRect('s3').top", "40"); 84 shouldBe("elementRect('s3').left", marginEllipseLeftXIntercept(60, 225, 225, 125) );85 shouldBe("elementRect('s3').left", marginEllipseLeftXIntercept(60, 225, 225, 125), quiet); 85 86 86 87 </script> -
trunk/LayoutTests/fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-right-expected.txt
r147384 r149457 1 PASS elementRect('s1').top is 02 PASS elementRect('s1').right is 1523 PASS elementRect('s2').top is 204 PASS elementRect('s2').right is 1105 PASS elementRect('s3').top is 406 PASS elementRect('s3').right is 827 1 The right edges of the three black squares should follow the outer ellipse boundary and each square should appear on a subsequent line. 8 2 … … 10 4 X 11 5 X 6 PASS elementRect('s1').top is 0 7 PASS elementRect('s2').top is 20 8 PASS elementRect('s3').top is 40 9 -
trunk/LayoutTests/fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-right.html
r147384 r149457 54 54 </div> 55 55 </div> 56 <div id="console"></div> 56 57 </body> 57 58 <script> … … 69 70 { 70 71 var containerWidth = document.getElementById("container").getBoundingClientRect().width; 71 return String( SubPixelLayout. roundLineRight(containerWidth - (cx + rx * Math.sqrt(1 - Math.pow((ry - y) / ry, 2)))) );72 return String( SubPixelLayout.snapToLayoutUnit(containerWidth - (cx + rx * Math.sqrt(1 - Math.pow((ry - y) / ry, 2)))) ); 72 73 } 73 74 … … 75 76 // That's why the Y coordinate in each of those tests is 20 greater than the ".top" test. 76 77 77 SubPixelLayout.initSubPixelLayout(); 78 var quiet = true; // PASS output depends on SubPixelLayout.isEnabled() 78 79 79 80 shouldBe("elementRect('s1').top", "0"); 80 shouldBe("elementRect('s1').right", marginEllipseRightXIntercept(20, 225, 225, 125) );81 shouldBe("elementRect('s1').right", marginEllipseRightXIntercept(20, 225, 225, 125), quiet); 81 82 82 83 shouldBe("elementRect('s2').top", "20"); 83 shouldBe("elementRect('s2').right", marginEllipseRightXIntercept(40, 225, 225, 125) );84 shouldBe("elementRect('s2').right", marginEllipseRightXIntercept(40, 225, 225, 125), quiet); 84 85 85 86 shouldBe("elementRect('s3').top", "40"); 86 shouldBe("elementRect('s3').right", marginEllipseRightXIntercept(60, 225, 225, 125) );87 shouldBe("elementRect('s3').right", marginEllipseRightXIntercept(60, 225, 225, 125), quiet); 87 88 88 89 </script> -
trunk/LayoutTests/platform/mac/TestExpectations
r149382 r149457 1518 1518 webkit.org/b/115292 fast/exclusions/shape-inside/shape-inside-ellipse-padding.html 1519 1519 webkit.org/b/115292 fast/exclusions/shape-inside/shape-inside-ellipse.html 1520 webkit.org/b/115292 fast/exclusions/shape-inside/shape-inside-polygon-layout.html1521 1520 webkit.org/b/115292 fast/exclusions/shape-inside/shape-inside-polygon-padding-002.html 1522 webkit.org/b/115292 fast/exclusions/shape-inside/shape-inside-polygon-padding-003.html1523 webkit.org/b/115292 fast/exclusions/shape-inside/shape-inside-rounded-rectangle-fit-002.html1524 webkit.org/b/115292 fast/exclusions/shape-outside-floats/shape-outside-floats-diamond-margin-polygon.html1525 webkit.org/b/115292 fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-left.html1526 1521 webkit.org/b/115292 fast/exclusions/shape-outside-floats/shape-outside-floats-non-zero-y.html 1527 1522 webkit.org/b/115292 fast/exclusions/shape-outside-floats/shape-outside-floats-simple-circle.html -
trunk/Source/WebCore/ChangeLog
r149450 r149457 1 2013-05-01 Hans Muller <hmuller@adobe.com> 2 [CSS Exclusions] Programmatic layout tests fail when subpixel layout is disabled 3 https://bugs.webkit.org/show_bug.cgi?id=115455 4 5 First round of changes to restore platform/mac exclusion tests that started failing when 6 subpixel layout was turned off. 7 8 Reviewed by Dirk Schulze. 9 10 * rendering/ExclusionPolygon.cpp: 11 (WebCore::appendArc): Ensure that the 3rd of 5 added vertices is in the center of the arc. 12 (WebCore::ExclusionPolygon::firstIncludedIntervalLogicalTop): Use ceiledLayoutUnit() for downwards-snapping first fit location. 13 * rendering/ExclusionRectangle.cpp: 14 (WebCore::ExclusionRectangle::firstIncludedIntervalLogicalTop): Ditto. 15 1 16 2013-05-01 Enrica Casucci <enrica@apple.com> 2 17 -
trunk/Source/WebCore/rendering/ExclusionPolygon.cpp
r149226 r149457 119 119 endAngle += twoPI; 120 120 float angle = (startAngle > endAngle) ? (startAngle - endAngle) : (startAngle + twoPI - endAngle); 121 const float arcSegmentCount = 5; // An oddnumber so that one arc vertex will be eactly arcRadius from arcCenter.122 float a ngle5= ((padding) ? -angle : twoPI - angle) / arcSegmentCount;121 const float arcSegmentCount = 6; // An even number so that one arc vertex will be eactly arcRadius from arcCenter. 122 float arcSegmentAngle = ((padding) ? -angle : twoPI - angle) / arcSegmentCount; 123 123 124 124 vertices.append(startArcVertex); 125 125 for (unsigned i = 1; i < arcSegmentCount; ++i) { 126 float angle = startAngle + a ngle5* i;126 float angle = startAngle + arcSegmentAngle * i; 127 127 vertices.append(arcCenter + FloatPoint(cos(angle) * arcRadius, sin(angle) * arcRadius)); 128 128 } … … 506 506 507 507 if (firstFitFound) 508 result = LayoutUnit::fromFloatCeil(firstFitRect.y());508 result = ceiledLayoutUnit(firstFitRect.y()); 509 509 return firstFitFound; 510 510 } -
trunk/Source/WebCore/rendering/ExclusionRectangle.cpp
r149226 r149457 214 214 } 215 215 if (minIntervalHeight < bounds.height() - (2 * cornerIntercept.y())) { 216 result = LayoutUnit::fromFloatCeil(bounds.y() + cornerIntercept.y());216 result = ceiledLayoutUnit(bounds.y() + cornerIntercept.y()); 217 217 return true; 218 218 }
Note: See TracChangeset
for help on using the changeset viewer.