Title: [117815] trunk
Revision
117815
Author
[email protected]
Date
2012-05-21 14:18:32 -0700 (Mon, 21 May 2012)

Log Message

Enable SUBPIXEL_LAYOUT feature flag on Chromium
https://bugs.webkit.org/show_bug.cgi?id=85555

Source/WTF: 

Reviewed by Eric Seidel.

Enabling sub-pixel layout on Chromium port.

* wtf/Platform.h:

LayoutTests: 

Patch by Levi Weintraub  <[email protected]> and Emil A Eklund <[email protected]> on 2012-05-21
Reviewed by Eric Seidel.

Updating tests to handle sub-pixel layout, and updating chromium-linux expecations. Updated test
expectations for Chromium Linux and Mac are ready, but the diff is too large for Buzgilla's tiny
brain (>10MB).

* css1/units/rounding.html:
* fast/borders/border-radius-huge-assert.html:
* fast/css/zoom-in-length-round-trip.html:
* fast/dom/Document/CaretRangeFromPoint/hittest-relative-to-viewport.html:
* fast/dom/Window/webkitConvertPoint.html:
* fast/dom/elementFromPoint-relative-to-viewport.html:
* fast/events/clientXY-in-zoom-and-scroll.html:
* fast/events/document-elementFromPoint.html:
* fast/events/offsetX-offsetY.html:
* fast/multicol/break-properties.html:
* fast/multicol/vertical-lr/break-properties.html:
* fast/multicol/vertical-rl/break-properties.html:
* fast/regions/region-style-rule-specificity.html:
* fast/replaced/table-percent-height.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (117814 => 117815)


--- trunk/LayoutTests/ChangeLog	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/LayoutTests/ChangeLog	2012-05-21 21:18:32 UTC (rev 117815)
@@ -1,3 +1,29 @@
+2012-05-21  Levi Weintraub  <[email protected]> and Emil A Eklund <[email protected]>
+
+        Enable SUBPIXEL_LAYOUT feature flag on Chromium
+        https://bugs.webkit.org/show_bug.cgi?id=85555
+
+        Reviewed by Eric Seidel.
+
+        Updating tests to handle sub-pixel layout, and updating chromium-linux expecations. Updated test
+        expectations for Chromium Linux and Mac are ready, but the diff is too large for Buzgilla's tiny
+        brain (>10MB).
+
+        * css1/units/rounding.html:
+        * fast/borders/border-radius-huge-assert.html:
+        * fast/css/zoom-in-length-round-trip.html:
+        * fast/dom/Document/CaretRangeFromPoint/hittest-relative-to-viewport.html:
+        * fast/dom/Window/webkitConvertPoint.html:
+        * fast/dom/elementFromPoint-relative-to-viewport.html:
+        * fast/events/clientXY-in-zoom-and-scroll.html:
+        * fast/events/document-elementFromPoint.html:
+        * fast/events/offsetX-offsetY.html:
+        * fast/multicol/break-properties.html:
+        * fast/multicol/vertical-lr/break-properties.html:
+        * fast/multicol/vertical-rl/break-properties.html:
+        * fast/regions/region-style-rule-specificity.html:
+        * fast/replaced/table-percent-height.html:
+
 2012-05-21  Anna Cavender  <[email protected]>
 
         Only render text track cues if kind=captions or kind=subtitles.

Modified: trunk/LayoutTests/css1/units/rounding.html (117814 => 117815)


--- trunk/LayoutTests/css1/units/rounding.html	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/LayoutTests/css1/units/rounding.html	2012-05-21 21:18:32 UTC (rev 117815)
@@ -36,8 +36,8 @@
 
 var divtop = document.getElementById("top").getBoundingClientRect();
 var divbottom = document.getElementById("bottom").getBoundingClientRect();
-shouldBe('divtop.bottom', '31');
-shouldBe('divbottom.top', '31');
+shouldBe('Math.round(divtop.bottom)', '31');
+shouldBe('Math.round(divbottom.top)', '31');
 
 </script>
 

Modified: trunk/LayoutTests/fast/borders/border-radius-huge-assert.html (117814 => 117815)


--- trunk/LayoutTests/fast/borders/border-radius-huge-assert.html	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/LayoutTests/fast/borders/border-radius-huge-assert.html	2012-05-21 21:18:32 UTC (rev 117815)
@@ -16,7 +16,7 @@
     <div></div>
     <div style="-webkit-border-radius: 926179103pt 10px;"></div>
     <div style="-webkit-border-radius: 10px 926179103pt;"></div>
-    <div style="-webkit-border-radius: 926179103pt;"></div>
+    <div style="-webkit-border-radius: 9261791pt;"></div>
 
 </body>
 </html>

Modified: trunk/LayoutTests/fast/css/zoom-in-length-round-trip.html (117814 => 117815)


--- trunk/LayoutTests/fast/css/zoom-in-length-round-trip.html	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/LayoutTests/fast/css/zoom-in-length-round-trip.html	2012-05-21 21:18:32 UTC (rev 117815)
@@ -25,8 +25,9 @@
     
     for (zoom = 100; zoom <= 200; zoom += 1) {
         containerStyle.setProperty("zoom", zoom / 100);
-        var width = target.offsetWidth;
-        var height = target.offsetHeight;
+        var rect = target.getBoundingClientRect();
+        var width = Math.round(rect.right - rect.left);
+        var height = Math.round(rect.bottom - rect.top);
         if (width !== 1 || height !== 10) {
             failed = true;
             log("FAIL at " + zoom + "% magnification: 1 mapped to " + target.offsetWidth + " and 10 mapped to " + target.offsetHeight + ".");

Modified: trunk/LayoutTests/fast/dom/Document/CaretRangeFromPoint/hittest-relative-to-viewport.html (117814 => 117815)


--- trunk/LayoutTests/fast/dom/Document/CaretRangeFromPoint/hittest-relative-to-viewport.html	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/LayoutTests/fast/dom/Document/CaretRangeFromPoint/hittest-relative-to-viewport.html	2012-05-21 21:18:32 UTC (rev 117815)
@@ -1,5 +1,8 @@
 <script src=""
-<style> 
+<style>
+    #subpixel-test {
+        width: 4.5px;
+    }
     .test {
         width: 100px;
         font-family: "Ahem";
@@ -20,8 +23,12 @@
 
 <p id="description"></p>
 <div id="console"></div>
+<div id="subpixel-test"></div>
 
 <script>
+    var r = document.getElementById('subpixel-test').getBoundingClientRect();
+    var hasSubpixelSupport = r.right - r.left == 4.5;
+    
     if (window.layoutTestController)
         layoutTestController.dumpAsText();
 
@@ -64,8 +71,8 @@
         }
 
         if (zoomOrNot == "zoom") {
-            test(1, 0, 0);
-            test(13, 0, 25);
+            test(hasSubpixelSupport ? 0 : 1, 0, 0);
+            test(hasSubpixelSupport ? 12 : 13, 0, 25);
             test(4, 50, 0);
             test(16, 50, 25);
         } else {

Modified: trunk/LayoutTests/fast/dom/Window/webkitConvertPoint.html (117814 => 117815)


--- trunk/LayoutTests/fast/dom/Window/webkitConvertPoint.html	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/LayoutTests/fast/dom/Window/webkitConvertPoint.html	2012-05-21 21:18:32 UTC (rev 117815)
@@ -13,6 +13,9 @@
       h1 {
           font-size: 14pt;
       }
+      #subpixel-test {
+          width: 4.5px;
+       }
       .layer {
         position: relative;
         width: 600px;
@@ -104,6 +107,9 @@
         }
         
         function run() {
+            var r = document.getElementById('subpixel-test').getBoundingClientRect();
+            var hasSubpixelSupport = r.right - r.left == 4.5;
+
             description("This test exercises the webkitConvertPointFromNodeToPage() function");
             
             debug("Test parameter passing - should not crash");
@@ -128,19 +134,35 @@
                 testFailed("null parameter test b");
             debug("Test did not crash and therefore was successful");
 
-            runTest("Test 1",  "test1",  8, 12, 13, 52);
-            runTest("Test 2",  "test2",  8, 50, 13, 90);
-            runTest("Test 3",  "test3",  8, 84, 13, 124);
-            runTest("Test 4",  "test4",  8, 118, 13, 158);
-            runTest("Test 5",  "test5",  28, 152, 33, 192);
-            runTest("Test 6",  "test6",  28, 186, 33, 226);
-            runTest("Test 7",  "test7",  8, 238, 13, 278);
-            runTest("Test 8",  "test8",  8, 272, 13, 312);
-            runTest("Test 9",  "test9",  28, 290, 33, 330);
-            runTest("Test 10", "test10", 28, 308, 33, 348);
-            runTest("Test 11", "test11", 158, 355, 174, 373);
-            runTest("Test 12", "test12", 168, 428, 184, 446);
-            runTest("Test 13", "test13", 28, 486, 33, 526);
+            if (hasSubpixelSupport) {
+                runTest("Test 1",  "test1",  8, 13, 13, 53);
+                runTest("Test 2",  "test2",  8, 51, 13, 91);
+                runTest("Test 3",  "test3",  8, 85, 13, 125);
+                runTest("Test 4",  "test4",  8, 119, 13, 159);
+                runTest("Test 5",  "test5",  28, 153, 33, 193);
+                runTest("Test 6",  "test6",  28, 187, 33, 227);
+                runTest("Test 7",  "test7",  8, 239, 13, 279);
+                runTest("Test 8",  "test8",  8, 273, 13, 313);
+                runTest("Test 9",  "test9",  28, 291, 33, 331);
+                runTest("Test 10", "test10", 28, 309, 33, 349);
+                runTest("Test 11", "test11", 158, 355, 174, 373);
+                runTest("Test 12", "test12", 168, 428, 184, 446);
+                runTest("Test 13", "test13", 28, 487, 33, 527);
+            } else {
+                runTest("Test 1",  "test1",  8, 12, 13, 52);
+                runTest("Test 2",  "test2",  8, 50, 13, 90);
+                runTest("Test 3",  "test3",  8, 84, 13, 124);
+                runTest("Test 4",  "test4",  8, 118, 13, 158);
+                runTest("Test 5",  "test5",  28, 152, 33, 192);
+                runTest("Test 6",  "test6",  28, 186, 33, 226);
+                runTest("Test 7",  "test7",  8, 238, 13, 278);
+                runTest("Test 8",  "test8",  8, 272, 13, 312);
+                runTest("Test 9",  "test9",  28, 290, 33, 330);
+                runTest("Test 10", "test10", 28, 308, 33, 348);
+                runTest("Test 11", "test11", 158, 355, 174, 373);
+                runTest("Test 12", "test12", 168, 428, 184, 446);
+                runTest("Test 13", "test13", 28, 486, 33, 526);
+            }
             
             isSuccessfullyParsed();
         }
@@ -183,5 +205,6 @@
         </div>
         <div id="description"></div>
         <div id="console"></div>
+        <div id="subpixel-test"></div>
     </body>
 </html>

Modified: trunk/LayoutTests/fast/dom/elementFromPoint-relative-to-viewport.html (117814 => 117815)


--- trunk/LayoutTests/fast/dom/elementFromPoint-relative-to-viewport.html	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/LayoutTests/fast/dom/elementFromPoint-relative-to-viewport.html	2012-05-21 21:18:32 UTC (rev 117815)
@@ -18,6 +18,9 @@
         height: 1000px;
         outline: 1px solid black;
     }
+    #subpixel-test {
+      width: 4.5px;
+    }
 </style>
 <div id="testArea">
     <br>
@@ -25,10 +28,14 @@
     <div class="pusher">This box is here to create scrollbars.</div>
     <div id="test-offscreen" class="test"></div>
     <div class="pusher">This box is here to create even more scrollbars!</div>
+    <div id="subpixel-test"></div>
 </div>
 <p id="description"></p>
 <div id="console"></div>
 <script>
+    var r = document.getElementById('subpixel-test').getBoundingClientRect();
+    var hasSubpixelSupport = r.right - r.left == 4.5;
+
     window._onclick_ = function(e)
     {
         alert(e.clientX + " " + e.clientY + " " + document.elementFromPoint(e.clientX, e.clientY).textContent);
@@ -39,7 +46,7 @@
 
     description('This test document.elementFromPoint is evaluated in with respect to the viewport, not the document.');
 
-    function testElement(element, label, offsetX, offsetY) {
+    function testElement(element, label, offsetX, offsetY, hasZoom) {
         for (var i = 0; i < 25; ++i) {
             var item = document.createElement("div");
             item.className = "testItem";
@@ -80,9 +87,9 @@
         window[scrolledDownAndRightBox] = getFromPoint(50, 20);
 
         shouldBe(unscrolledBox, "'0'");
-        shouldBe(scrolledDownBox, "'5'");
+        shouldBe(scrolledDownBox, hasSubpixelSupport && hasZoom ? "'4'" : "'5'");
         shouldBe(scrolledRightBox, "'3'");
-        shouldBe(scrolledDownAndRightBox, "'8'");
+        shouldBe(scrolledDownAndRightBox, hasSubpixelSupport && hasZoom  ? "'7'" : "'8'");
     }
 
     var elementInitial = document.getElementById('test-initial');
@@ -92,7 +99,7 @@
     testElement(elementOffscreen, "Offscreen", offset.left, offset.top + 1100);
 
     eventSender.zoomPageOut();
-    testElement(elementInitial, "Initial", offset.left, offset.top);
+    testElement(elementInitial, "Initial", offset.left, offset.top, /* hasZoom */ true);
 
     if (window.layoutTestController) {
         var area = document.getElementById('testArea');

Modified: trunk/LayoutTests/fast/events/clientXY-in-zoom-and-scroll.html (117814 => 117815)


--- trunk/LayoutTests/fast/events/clientXY-in-zoom-and-scroll.html	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/LayoutTests/fast/events/clientXY-in-zoom-and-scroll.html	2012-05-21 21:18:32 UTC (rev 117815)
@@ -5,12 +5,19 @@
         height: 1000px;
         outline: 1px solid black;
     }
+    #subpixel-test {
+        width: 4.5px;
+    }
 </style>
 <div id="console"></div>
 <div id="testArea">
     <div id="pusher">This box is here to create scrollbars.</div>
+    <div id="subpixel-test"></div>
 </div>
 <script>
+    var r = document.getElementById('subpixel-test').getBoundingClientRect();
+    var hasSubpixelSupport = r.right - r.left == 4.5;
+
     var event;
 
     function sendClick()
@@ -97,8 +104,8 @@
     {
         event = e;
         debug("\nZoomed and scrolled");
-        shouldBe("event.clientX", "84");
-        shouldBe("event.clientY", "84");
+        shouldBe("event.clientX", hasSubpixelSupport ? "83" : "84");
+        shouldBe("event.clientY", hasSubpixelSupport ? "83" : "84");
         shouldBe("event.pageX", "133");
         shouldBe("event.pageY", "133");
     }

Modified: trunk/LayoutTests/fast/events/document-elementFromPoint.html (117814 => 117815)


--- trunk/LayoutTests/fast/events/document-elementFromPoint.html	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/LayoutTests/fast/events/document-elementFromPoint.html	2012-05-21 21:18:32 UTC (rev 117815)
@@ -126,6 +126,10 @@
     top: 670px;
     color: gray;
 }
+
+#subpixel-test {
+    width: 4.5px;
+}
 </style>
 </head>
 <body>
@@ -195,6 +199,8 @@
 <div id="results"></div>
 <div id="mouse-position"></div>
 
+<!-- Test for subpixel support -->
+<div id="subpixel-test"></div>
 <script>
 // Debug mode.
 if (!window.layoutTestController) {
@@ -247,6 +253,9 @@
 // Start the test.
 document.body.addEventListener('click', clicked, false);
 window.addEventListener('load', function() {
+    var r = document.getElementById('subpixel-test').getBoundingClientRect();
+    var hasSubpixelSupport = r.right - r.left == 4.5;
+
     setTimeout(function() {
         // Scroll body and inner overflow box.
         window.scrollTo(20, 100);
@@ -260,7 +269,7 @@
             dispatchEvent(40, 297, 'table-content', 15, 18);
             dispatchEvent(122, 407, 'transformed', 18, 15);
             dispatchEvent(573, 480, 'inside-overflow', 2, 9);
-            dispatchEvent(707, 174, 'in-columns', 88, 13);
+            dispatchEvent(707, 174, 'in-columns', hasSubpixelSupport ? 87 : 88, 13);
             dispatchEvent(241, 67, 'fixed', 41, 17);
             dispatchEvent(244, 102, 'fixed', 44, 52);
             dispatchEvent(388, 88, 'fixed', 188, 38);

Modified: trunk/LayoutTests/fast/events/offsetX-offsetY.html (117814 => 117815)


--- trunk/LayoutTests/fast/events/offsetX-offsetY.html	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/LayoutTests/fast/events/offsetX-offsetY.html	2012-05-21 21:18:32 UTC (rev 117815)
@@ -23,6 +23,9 @@
     
     function test()
     {
+      var r = document.getElementById('subpixel-test').getBoundingClientRect();
+      var hasSubpixelSupport = r.right - r.left == 4.5;
+
       // Scroll so that frame view offsets are non-zero
       window.scrollTo(20, 100);
 
@@ -37,7 +40,7 @@
       dispatchEvent(157, 32, 'rel-box', 22, 24);
       dispatchEvent(410, 30, 'fixed-box', 10, 10);
       dispatchEvent(36, 272, 'with-bordertopextra', 4, 4);
-      dispatchEvent(639, 207, 'in-columns', 35, 5);
+      dispatchEvent(639, 207, 'in-columns', hasSubpixelSupport ? 34 : 35, 5);
       dispatchEvent(563, 410, 'inside-overflow', 7, 6);
       dispatchEvent(112, 369, 'transformed', 11, 16);
             
@@ -181,6 +184,10 @@
     tr {
 /*      -webkit-transform: rotate(10deg);*/
     }
+
+    #subpixel-test {
+      width: 4.5px;
+    }
   </style>
 </head>
 <body _onclick_="clicked(event)">
@@ -222,6 +229,7 @@
 </div>
 <div id="results"></div>
 <div id="mousepos"></div>
+<div id="subpixel-test"></div>
 
 </body>
 </html>

Modified: trunk/LayoutTests/fast/multicol/break-properties.html (117814 => 117815)


--- trunk/LayoutTests/fast/multicol/break-properties.html	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/LayoutTests/fast/multicol/break-properties.html	2012-05-21 21:18:32 UTC (rev 117815)
@@ -24,13 +24,16 @@
     function testBoxPosition(id, expectedLeft, expectedTop)
     {
         var rect = document.getElementById(id).getBoundingClientRect();
-        if (rect.left === expectedLeft && rect.top === expectedTop)
+        if (Math.round(rect.left) === expectedLeft && Math.round(rect.top) === expectedTop)
             log("PASS: '" + id + "' is at (" + expectedLeft + ", " + expectedTop + ")");
         else
-            log("FAIL: '" + id + "' is at (" + rect.left + ", " + rect.top + ") instead of (" + expectedLeft + " ," + expectedTop + ")");
+            log("FAIL: '" + id + "' is at (" + Math.round(rect.left) + ", " + Math.round(rect.top) + ") instead of (" + expectedLeft + " ," + expectedTop + ")");
     }
 
-    testBoxPosition("break-before", 218, 8);
-    testBoxPosition("after-break", 428, 8);
-    testBoxPosition("no-break", 533, 8);
+    var rect = document.getElementById('break-before').getBoundingClientRect();
+    var hasSubpixelSupport = Math.round(rect.left) != rect.left;
+
+    testBoxPosition("break-before", hasSubpixelSupport ? 220 : 218, 8);
+    testBoxPosition("after-break", hasSubpixelSupport ? 431 : 428, 8);
+    testBoxPosition("no-break", hasSubpixelSupport ? 537 : 533, 8);
 </script>

Modified: trunk/LayoutTests/fast/multicol/vertical-lr/break-properties.html (117814 => 117815)


--- trunk/LayoutTests/fast/multicol/vertical-lr/break-properties.html	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/LayoutTests/fast/multicol/vertical-lr/break-properties.html	2012-05-21 21:18:32 UTC (rev 117815)
@@ -25,12 +25,15 @@
     function testBoxPosition(id, expectedLeft, expectedTop)
     {
         var rect = document.getElementById(id).getBoundingClientRect();
-        if (rect.left === expectedLeft && rect.top === expectedTop)
+        if (Math.round(rect.left) === expectedLeft && Math.round(rect.top) === expectedTop)
             log("PASS: '" + id + "' is at (" + expectedLeft + ", " + expectedTop + ")");
         else
-            log("FAIL: '" + id + "' is at (" + rect.left + ", " + rect.top + ") instead of (" + expectedLeft + " ," + expectedTop + ")");
+            log("FAIL: '" + id + "' is at (" + Math.round(rect.left) + ", " + Math.round(rect.top) + ") instead of (" + expectedLeft + " ," + expectedTop + ")");
     }
 
-    testBoxPosition("break-before", 8, 218);
-    testBoxPosition("after-break", 8, 428);
+    var rect = document.getElementById('break-before').getBoundingClientRect();
+    var hasSubpixelSupport = Math.round(rect.top) != rect.top;
+
+    testBoxPosition("break-before", 8, hasSubpixelSupport ? 220 : 218);
+    testBoxPosition("after-break", 8, hasSubpixelSupport ? 431 : 428);
 </script>

Modified: trunk/LayoutTests/fast/multicol/vertical-rl/break-properties.html (117814 => 117815)


--- trunk/LayoutTests/fast/multicol/vertical-rl/break-properties.html	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/LayoutTests/fast/multicol/vertical-rl/break-properties.html	2012-05-21 21:18:32 UTC (rev 117815)
@@ -28,12 +28,15 @@
     function testBoxPosition(id, expectedLeft, expectedTop)
     {
         var rect = document.getElementById(id).getBoundingClientRect();
-        if (rect.left === expectedLeft && rect.top === expectedTop)
+        if (Math.round(rect.left) === expectedLeft && Math.round(rect.top) === expectedTop)
             log("PASS: '" + id + "' is at (" + expectedLeft + ", " + expectedTop + ")");
         else
-            log("FAIL: '" + id + "' is at (" + rect.left + ", " + rect.top + ") instead of (" + expectedLeft + " ," + expectedTop + ")");
+            log("FAIL: '" + id + "' is at (" + Math.round(rect.left) + ", " + Math.round(rect.top) + ") instead of (" + expectedLeft + " ," + expectedTop + ")");
     }
 
-    testBoxPosition("break-before", 748, 218);
-    testBoxPosition("after-break", 748, 428);
+    var rect = document.getElementById('break-before').getBoundingClientRect();
+    var hasSubpixelSupport = Math.round(rect.top) != rect.top;
+
+    testBoxPosition("break-before", 748, hasSubpixelSupport ? 220 : 218);
+    testBoxPosition("after-break", 748, hasSubpixelSupport ? 431 : 428);
 </script>

Modified: trunk/LayoutTests/fast/regions/region-style-rule-specificity.html (117814 => 117815)


--- trunk/LayoutTests/fast/regions/region-style-rule-specificity.html	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/LayoutTests/fast/regions/region-style-rule-specificity.html	2012-05-21 21:18:32 UTC (rev 117815)
@@ -1,143 +1,143 @@
 <!doctype html>
 <html>
-	<head>
-		<style>
-		body {
-			font-family: monospace;
-			font-size: 1em;
-		}
-		p {
-			margin: 0;
-			line-height: 1em;
-		}
-		.container {
-			background-color: lightgray;
-			width: 15em;
-			height: 5em;
-		}
-		/* selector specificity
-		#id => 100
-		.class => 10
-		element => 1
-		*/
-		/*
-		selector position
-		in style="" attribute
-		in <style/> element / external file
-		*/
+        <head>
+                <style>
+                body {
+                        font-family: monospace;
+                        font-size: 1em;
+                }
+                p {
+                        margin: 0;
+                        line-height: 1em;
+                }
+                .container {
+                        background-color: lightgray;
+                        width: 15em;
+                        height: 5em;
+                }
+                /* selector specificity
+                #id => 100
+                .class => 10
+                element => 1
+                */
+                /*
+                selector position
+                in style="" attribute
+                in <style/> element / external file
+                */
 
-		/* Testing selector specificity is respected in @region style blocks */
-		#f1 {
-			-webkit-flow-into: flow1;
-		}
-		#r1 {
-			-webkit-flow-from: flow1;
-		}
-		@-webkit-region #r1 {
-			* {
-				background-color: yellow;
-			}
-			p {
-				background-color: lightgreen;
-			}
-			.cr1 {
-				background-color: lime;
-			}
-			#p1 {
-				background-color: green;
-			}
-		}
+                /* Testing selector specificity is respected in @region style blocks */
+                #f1 {
+                        -webkit-flow-into: flow1;
+                }
+                #r1 {
+                        -webkit-flow-from: flow1;
+                }
+                @-webkit-region #r1 {
+                        * {
+                                background-color: yellow;
+                        }
+                        p {
+                                background-color: lightgreen;
+                        }
+                        .cr1 {
+                                background-color: lime;
+                        }
+                        #p1 {
+                                background-color: green;
+                        }
+                }
 
-		/* Testing selector position is respected in @region style blocks */
-		#f2 {
-			-webkit-flow-into: flow2;
-		}
-		#r2 {
-			-webkit-flow-from: flow2;
-		}
-		@-webkit-region #r2 {
-			p, .cr21, #p2 {
-				background-color: red;
-			}
-		}
-		@-webkit-region #r2 {
-			p {
-				background-color: lightgreen;
-			}
-			.cr22 {
-				background-color: lime;
-			}
-			#p2 {
-				background-color: green;
-			}
-		}
+                /* Testing selector position is respected in @region style blocks */
+                #f2 {
+                        -webkit-flow-into: flow2;
+                }
+                #r2 {
+                        -webkit-flow-from: flow2;
+                }
+                @-webkit-region #r2 {
+                        p, .cr21, #p2 {
+                                background-color: red;
+                        }
+                }
+                @-webkit-region #r2 {
+                        p {
+                                background-color: lightgreen;
+                        }
+                        .cr22 {
+                                background-color: lime;
+                        }
+                        #p2 {
+                                background-color: green;
+                        }
+                }
 
-		/* More specific selector in flowed content than in @region style */
-		.c3 {
-			background-color: lime;
-		}
-		#p31, #p32 {
-			background-color: lime;
-		}
-		#f3 {
-			-webkit-flow-into: flow3;
-		}
-		#r3 {
-			-webkit-flow-from: flow3;
-		}
-		@-webkit-region #r3 {
-			p, .cr3 {
-				background-color: red;
-			}
-		}
+                /* More specific selector in flowed content than in @region style */
+                .c3 {
+                        background-color: lime;
+                }
+                #p31, #p32 {
+                        background-color: lime;
+                }
+                #f3 {
+                        -webkit-flow-into: flow3;
+                }
+                #r3 {
+                        -webkit-flow-from: flow3;
+                }
+                @-webkit-region #r3 {
+                        p, .cr3 {
+                                background-color: red;
+                        }
+                }
 
-		/* Flowed content has style attribute */
-		#f4 {
-			-webkit-flow-into: flow4;
-		}
-		#r4 {
-			-webkit-flow-from: flow4;
-		}
-		@-webkit-region #r4 {
-			p, #p4, .cr4 {
-				background-color: red;
-			}
-		}
-		</style>
-	</head>
-	<body>
-		<!-- Flowed content -->
-		<div id='f1'>
-			<p>Plain paragraph</p>
-			<p class='cr1'>Styled with class</p>
-			<p id='p1'>Styled with ID</p>
-		</div>
-		<div id='f2'>
-			<p>Plain paragraph</p>
-			<p class='cr21 cr22'>Styled with class</p>
-			<p id='p2'>Styled with ID</p>
-		</div>
-		<div id='f3'>
-			<p class='c3'>Class in content</p>
-			<p id='p31'>ID in content</p>
-			<p class='cr3' id='p32'>ID in content</p>
-		</div>
-		<div id='f4'>
-			<p style='background-color: lime;' >Element style in region</p>
-			<p style='background-color: lime;' id='p2'>ID style in region</p>
-			<p style='background-color: lime;' class='cr2'>Class in region</p>
-		</div>
+                /* Flowed content has style attribute */
+                #f4 {
+                        -webkit-flow-into: flow4;
+                }
+                #r4 {
+                        -webkit-flow-from: flow4;
+                }
+                @-webkit-region #r4 {
+                        p, #p4, .cr4 {
+                                background-color: red;
+                        }
+                }
+                </style>
+        </head>
+        <body>
+                <!-- Flowed content -->
+                <div id='f1'>
+                        <p>Plain paragraph</p>
+                        <p class='cr1'>Styled with class</p>
+                        <p id='p1'>Styled with ID</p>
+                </div>
+                <div id='f2'>
+                        <p>Plain paragraph</p>
+                        <p class='cr21 cr22'>Styled with class</p>
+                        <p id='p2'>Styled with ID</p>
+                </div>
+                <div id='f3'>
+                        <p class='c3'>Class in content</p>
+                        <p id='p31'>ID in content</p>
+                        <p class='cr3' id='p32'>ID in content</p>
+                </div>
+                <div id='f4'>
+                        <p style='background-color: lime;' >Element style in region</p>
+                        <p style='background-color: lime;' id='p2'>ID style in region</p>
+                        <p style='background-color: lime;' class='cr2'>Class in region</p>
+                </div>
 
-		<!-- Regions -->
-		<h1>Testing CSS selectors specificity/position is respected when using @region styling</h1>
+                <!-- Regions -->
+                <h1>Testing CSS selectors specificity/position is respected when using @region styling</h1>
 
-		Selector specificity in @region rule
-		<div class='container' id='r1'></div>
-		Selector position in @region rule
-		<div class='container' id='r2'></div>
-		More specific selector in flowed content
-		<div class='container' id='r3'></div>
-		Style attribute in flowed content
-		<div class='container' id='r4'></div>
-	</body>
-</html>
\ No newline at end of file
+                Selector specificity in @region rule
+                <div class='container' id='r1'></div>
+                Selector position in @region rule
+                <div class='container' id='r2'></div>
+                More specific selector in flowed content
+                <div class='container' id='r3'></div>
+                Style attribute in flowed content
+                <div class='container' id='r4'></div>
+        </body>
+</html>

Modified: trunk/LayoutTests/fast/replaced/table-percent-height.html (117814 => 117815)


--- trunk/LayoutTests/fast/replaced/table-percent-height.html	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/LayoutTests/fast/replaced/table-percent-height.html	2012-05-21 21:18:32 UTC (rev 117815)
@@ -41,7 +41,7 @@
     return parseFloat(str);
 }
 
-function is75PercentOf(expression75, expression100)
+function is75PercentOf(expression75, expression100, hasSubpixelSupport)
 {
     var str75 = eval(expression75);
     var str100 = eval(expression100);
@@ -49,7 +49,10 @@
     var num100 = parsePixelValue(str100);
     if (num75 < 0 || num100 < 0)
         return;
-    if (num75 == Math.floor(num100 * 75 / 100))
+    var expectedValue = num100 * 75 / 100;
+    if (!hasSubpixelSupport)
+        expectedValue = Math.floor(expectedValue);
+    if (num75 == expectedValue)
         testPassed(expression75 + " is 75% of " + expression100 + ".");
     else
         testFailed(expression75 + " [" + str75 + "] is not 75% of " + expression100 + " [" + str100 + "].");
@@ -59,13 +62,15 @@
 {
     description("This test checks that replaced elements with percentage heights within table cells have the correct height.<br>Note, some of the button height tests fail on the Windows ports. See bug #34071.");
 
-    shouldBe("getWidth('canvas-75')", "'224px'");
-    shouldBe("getHeight('canvas-75')", "'112px'");
+    var hasSubpixelSupport = getWidth('canvas-75') == '225px';
+
+    shouldBe("getWidth('canvas-75')", hasSubpixelSupport ? "'225px'" : "'224px'");
+    shouldBe("getHeight('canvas-75')", hasSubpixelSupport ? "'112.5px'" : "'112px'");
     shouldBe("getWidth('canvas-100')", "'300px'");
     shouldBe("getHeight('canvas-100')", "'150px'");
 
     shouldBe("getWidth('embed-75')", "'300px'");
-    shouldBe("getHeight('embed-75')", "'112px'");
+    shouldBe("getHeight('embed-75')", hasSubpixelSupport ? "'112.5px'" : "'112px'");
     shouldBe("getWidth('embed-100')", "'300px'");
     shouldBe("getHeight('embed-100')", "'150px'");
 
@@ -80,7 +85,7 @@
     shouldBe("getHeight('img-100-nested')", "'100px'");
 
     shouldBe("getWidth('object-75')", "'300px'");
-    shouldBe("getHeight('object-75')", "'112px'");
+    shouldBe("getHeight('object-75')", hasSubpixelSupport ? "'112.5px'" : "'112px'");
     shouldBe("getWidth('object-100')", "'300px'");
     shouldBe("getHeight('object-100')", "'150px'");
 
@@ -95,12 +100,12 @@
     shouldBe("getWidth('input-checkbox-75')", "getWidth('input-checkbox-100')");
     shouldBeTrue("getHeight('input-checkbox-75') != '0px'");
     // Note: This behavior doesn't match to Firefox 3.5 and Opera 10.
-    is75PercentOf("getHeight('input-checkbox-75')", "getHeight('input-checkbox-100')");
+    is75PercentOf("getHeight('input-checkbox-75')", "getHeight('input-checkbox-100')", hasSubpixelSupport);
 
     shouldBe("getWidth('input-file-75')", "getWidth('input-file-100')");
     shouldBeTrue("getHeight('input-file-75') != '0px'");
     // Note: This behavior doesn't match to Firefox 3.5 and Opera 10.
-    is75PercentOf("getHeight('input-file-75')", "getHeight('input-file-100')");
+    is75PercentOf("getHeight('input-file-75')", "getHeight('input-file-100')", hasSubpixelSupport);
 
     // Note: This behavior doesn't match to Firefox 3.5 and Opera 10.
     shouldBe("getWidth('input-image-75')", "'75px'");
@@ -111,7 +116,7 @@
     shouldBe("getWidth('input-radio-75')", "getWidth('input-radio-100')");
     shouldBeTrue("getHeight('input-radio-75') != '0px'");
     // Note: This behavior doesn't match to Firefox 3.5 and Opera 10.
-    is75PercentOf("getHeight('input-radio-75')", "getHeight('input-radio-100')");
+    is75PercentOf("getHeight('input-radio-75')", "getHeight('input-radio-100')", hasSubpixelSupport);
 
     shouldBe("getWidth('input-reset-75')", "getWidth('input-reset-100')");
     shouldBeTrue("getHeight('input-reset-75') != '0px'");

Modified: trunk/Source/WTF/ChangeLog (117814 => 117815)


--- trunk/Source/WTF/ChangeLog	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/Source/WTF/ChangeLog	2012-05-21 21:18:32 UTC (rev 117815)
@@ -1,3 +1,14 @@
+2012-05-21  Emil A Eklund <[email protected]> and Levi Weintraub  <[email protected]>
+
+        Enable SUBPIXEL_LAYOUT feature flag on Chromium
+        https://bugs.webkit.org/show_bug.cgi?id=85555
+
+        Reviewed by Eric Seidel.
+
+        Enabling sub-pixel layout on Chromium port.
+
+        * wtf/Platform.h:
+
 2012-05-21  Andreas Kling  <[email protected]>
 
         CSS: Move duplicate property elimination to parser.

Modified: trunk/Source/WTF/wtf/Platform.h (117814 => 117815)


--- trunk/Source/WTF/wtf/Platform.h	2012-05-21 21:01:04 UTC (rev 117814)
+++ trunk/Source/WTF/wtf/Platform.h	2012-05-21 21:18:32 UTC (rev 117815)
@@ -821,8 +821,12 @@
 #endif
 
 #if !defined(ENABLE_SUBPIXEL_LAYOUT)
+#if PLATFORM(CHROMIUM)
+#define ENABLE_SUBPIXEL_LAYOUT 1 
+#else
 #define ENABLE_SUBPIXEL_LAYOUT 0
 #endif
+#endif
 
 #define ENABLE_DEBUG_WITH_BREAKPOINT 0
 #define ENABLE_SAMPLING_COUNTERS 0
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to