Title: [197524] trunk
Revision
197524
Author
[email protected]
Date
2016-03-03 15:55:52 -0800 (Thu, 03 Mar 2016)

Log Message

Subpixel rendering: Make collapsed borders painting subpixel aware.
https://bugs.webkit.org/show_bug.cgi?id=154980

Reviewed by David Hyatt.

This patch enables collapsed borders with odd pixel width paint on subpixel position.
Currently borders with odd pixels are split at integral position so that border-width: 3px;
paints 1px on the left(top) and 2px on the right(bottom) side. With this patch
we paint 1.5px on both sides(on 2x display).

Source/WebCore:

Test: fast/table/hidpi-collapsed-border-with-odd-pixel-width.html

* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::paintCollapsedBorders):

LayoutTests:

* fast/table/hidpi-collapsed-border-with-odd-pixel-width-expected.html: Added.
* fast/table/hidpi-collapsed-border-with-odd-pixel-width.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (197523 => 197524)


--- trunk/LayoutTests/ChangeLog	2016-03-03 23:49:18 UTC (rev 197523)
+++ trunk/LayoutTests/ChangeLog	2016-03-03 23:55:52 UTC (rev 197524)
@@ -1,3 +1,18 @@
+2016-03-03  Zalan Bujtas  <[email protected]>
+
+        Subpixel rendering: Make collapsed borders painting subpixel aware.
+        https://bugs.webkit.org/show_bug.cgi?id=154980
+
+        Reviewed by David Hyatt.
+
+        This patch enables collapsed borders with odd pixel width paint on subpixel position.
+        Currently borders with odd pixels are split at integral position so that border-width: 3px;
+        paints 1px on the left(top) and 2px on the right(bottom) side. With this patch
+        we paint 1.5px on both sides(on 2x display).
+
+        * fast/table/hidpi-collapsed-border-with-odd-pixel-width-expected.html: Added.
+        * fast/table/hidpi-collapsed-border-with-odd-pixel-width.html: Added.
+
 2016-03-03  Filip Pizlo  <[email protected]>
 
         DFG should be able to compile StringReplace

Added: trunk/LayoutTests/fast/table/hidpi-collapsed-border-with-odd-pixel-width-expected.html (0 => 197524)


--- trunk/LayoutTests/fast/table/hidpi-collapsed-border-with-odd-pixel-width-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/hidpi-collapsed-border-with-odd-pixel-width-expected.html	2016-03-03 23:55:52 UTC (rev 197524)
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>This test that we can position collapsed border with odd width at device pixel.</title>
+<style>
+
+div {
+  position: absolute;
+  height: 27px;
+  width: 29px;
+  border-color: red;
+  border-style: solid;
+}
+</style>
+</head>
+<body>
+<div style="left: 24.5px; top: 20.5px; border-width: 1px"></div><div style="left: 54px; top: 20px; width: 28.5px; height: 26.5px; border-width: 2px"></div><div style="left: 83.5px; top: 19.5px; width: 28px; height: 25.5px; border-width: 3px"></div>
+<div style="left: 23px; top: 46px; border-width: 4px; width: 26.5px; height: 26.5px"></div><div style="left: 52.5px; top: 45.5px; width: 25.5px; height: 25.5px; border-width: 5px"></div><div style="left: 82px; top: 45px; width: 25px; height: 24px; border-width: 6px"></div>
+<div style="left: 21.5px; top: 73.5px; border-width: 7px; width: 23.5px; height: 24px;"></div><div style="left: 51px; top: 73px; width: 22px; height: 23px; border-width: 8px"></div><div style="left: 80.5px; top: 72.5px; width: 22px; height: 22px; border-width: 9px"></div>
+
+
+<div style="left: 24.5px; top: 119.5px; border-width: 1px; width: 22px; height: 26px;"></div><div style="left: 47.5px; top: 118.5px; width: 24px; height: 24px; border-width: 3px"></div><div style="left: 72.5px; top: 117.5px; width: 22px; height: 22px; border-width: 5px"></div>
+<div style="left: 24.5px; top: 146.5px; border-width: 1px; width: 22px; height: 26px;"></div><div style="left: 47.5px; top: 145.5px; width: 24px; height: 24px; border-width: 3px"></div><div style="left: 72.5px; top: 144.5px; width: 22px; height: 22px; border-width: 5px"></div>
+<div style="left: 24.5px; top: 173.5px; border-width: 1px; width: 22px; height: 26px;"></div><div style="left: 47.5px; top: 172.5px; width: 24px; height: 24px; border-width: 3px"></div><div style="left: 72.5px; top: 171.5px; width: 22px; height: 22px; border-width: 5px"></div>
+
+<div style="left: 24.5px; top: 210.5px; border-width: 1px; width: 34px; height: 26px;"></div><div style="left: 59.5px; top: 209.5px; width: 34px; height: 24px; border-width: 3px"></div><div style="left: 96.5px; top: 208.5px; width: 34px; height: 22px; border-width: 5px"></div>
+<div style="left: 21.5px; top: 237.5px; border-width: 7px; width: 30px; height: 26px;"></div><div style="left: 56.5px; top: 236.5px; width: 30px; height: 24px; border-width: 9px"></div><div style="left: 93.5px; top: 235.5px; width: 28px; height: 22px; border-width: 11px"></div>
+<div style="left: 18.5px; top: 270.5px; border-width: 13px; width: 24px; height: 26px;"></div><div style="left: 53.5px; top: 269.5px; width: 24px; height: 24px; border-width: 15px"></div><div style="left: 90.5px; top: 268.5px; width: 22px; height: 22px; border-width: 17px"></div>
+
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/table/hidpi-collapsed-border-with-odd-pixel-width.html (0 => 197524)


--- trunk/LayoutTests/fast/table/hidpi-collapsed-border-with-odd-pixel-width.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/hidpi-collapsed-border-with-odd-pixel-width.html	2016-03-03 23:55:52 UTC (rev 197524)
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>This test that we can position collapsed border with odd width at device pixel.</title>
+<style>
+body {
+    margin: 20px;
+}
+
+table {
+    margin: 5px;
+    border-collapse: collapse;
+}
+
+td {
+  height: 20px;
+  width: 20px;
+}
+</style>
+</head>
+<body>
+<table>
+    <tr><td style="border: 1px solid red"></td><td style="border: 2px solid red"></td><td style="border: 3px solid red"></td></tr>
+    <tr><td style="border: 4px solid red"></td><td style="border: 5px solid red"></td><td style="border: 6px solid red"></td></tr>
+    <tr><td style="border: 7px solid red"></td><td style="border: 8px solid red"></td><td style="border: 9px solid red"></td></tr>
+</table>
+<table>
+    <tr><td style="border: 1px solid red"></td><td style="border: 3px solid red"></td><td style="border: 5px solid red"></td></tr>
+    <tr><td style="border: 1px solid red"></td><td style="border: 3px solid red"></td><td style="border: 5px solid red"></td></tr>
+    <tr><td style="border: 1px solid red"></td><td style="border: 3px solid red"></td><td style="border: 5px solid red"></td></tr>
+</table>
+<table>
+    <tr><td style="border: 1px solid red"></td><td style="border: 3px solid red"></td><td style="border: 5px solid red"></td></tr>
+    <tr><td style="border: 7px solid red"></td><td style="border: 9px solid red"></td><td style="border: 11px solid red"></td></tr>
+    <tr><td style="border: 13px solid red"></td><td style="border: 15px solid red"></td><td style="border: 17px solid red"></td></tr>
+</table>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (197523 => 197524)


--- trunk/Source/WebCore/ChangeLog	2016-03-03 23:49:18 UTC (rev 197523)
+++ trunk/Source/WebCore/ChangeLog	2016-03-03 23:55:52 UTC (rev 197524)
@@ -1,3 +1,20 @@
+2016-03-03  Zalan Bujtas  <[email protected]>
+
+        Subpixel rendering: Make collapsed borders painting subpixel aware.
+        https://bugs.webkit.org/show_bug.cgi?id=154980
+
+        Reviewed by David Hyatt.
+
+        This patch enables collapsed borders with odd pixel width paint on subpixel position.
+        Currently borders with odd pixels are split at integral position so that border-width: 3px;
+        paints 1px on the left(top) and 2px on the right(bottom) side. With this patch
+        we paint 1.5px on both sides(on 2x display).
+
+        Test: fast/table/hidpi-collapsed-border-with-odd-pixel-width.html
+
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::paintCollapsedBorders):
+
 2016-03-03  Dave Hyatt  <[email protected]>
 
         Add support for the "last" value of hanging-punctuation

Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (197523 => 197524)


--- trunk/Source/WebCore/rendering/RenderTableCell.cpp	2016-03-03 23:49:18 UTC (rev 197523)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp	2016-03-03 23:55:52 UTC (rev 197524)
@@ -1204,10 +1204,11 @@
     LayoutUnit leftWidth = leftVal.width();
     LayoutUnit rightWidth = rightVal.width();
 
-    LayoutRect borderRect = LayoutRect(paintRect.x() - floorToInt(leftWidth / 2),
-        paintRect.y() - floorToInt(topWidth / 2),
-        paintRect.width() + floorToInt(leftWidth / 2) + floorToInt((rightWidth + 1) / 2),
-        paintRect.height() + floorToInt(topWidth / 2) + floorToInt((bottomWidth + 1) / 2));
+    float deviceScaleFactor = document().deviceScaleFactor();
+    LayoutRect borderRect = LayoutRect(paintRect.x() - floorToDevicePixel(leftWidth / 2, deviceScaleFactor),
+        paintRect.y() - floorToDevicePixel(topWidth / 2, deviceScaleFactor),
+        paintRect.width() + floorToDevicePixel(leftWidth / 2, deviceScaleFactor) + floorToDevicePixel(rightWidth / 2, deviceScaleFactor),
+        paintRect.height() + floorToDevicePixel(topWidth / 2, deviceScaleFactor) + floorToDevicePixel(bottomWidth / 2, deviceScaleFactor));
     
     EBorderStyle topStyle = collapsedBorderStyle(topVal.style());
     EBorderStyle bottomStyle = collapsedBorderStyle(bottomVal.style());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to