Title: [197627] trunk
Revision
197627
Author
za...@apple.com
Date
2016-03-05 19:10:21 -0800 (Sat, 05 Mar 2016)

Log Message

Make table collapsed borders subpixel aware.
https://bugs.webkit.org/show_bug.cgi?id=150383

Reviewed by Simon Fraser.

This patch enables authors to
- set subpixel width on collapsed borders
- and push those borders to subpixel positions.

Source/WebCore:

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

* rendering/RenderTable.cpp:
(WebCore::RenderTable::calcBorderStart):
(WebCore::RenderTable::calcBorderEnd):
(WebCore::RenderTable::outerBorderBefore):
(WebCore::RenderTable::outerBorderAfter):
(WebCore::RenderTable::outerBorderStart):
(WebCore::RenderTable::outerBorderEnd):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::borderHalfStart):
(WebCore::RenderTableCell::borderHalfEnd):
(WebCore::RenderTableCell::borderHalfBefore):
(WebCore::RenderTableCell::borderHalfAfter):
(WebCore::RenderTableCell::paintCollapsedBorders):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::calcOuterBorderBefore):
(WebCore::RenderTableSection::calcOuterBorderAfter):
(WebCore::RenderTableSection::calcOuterBorderStart):
(WebCore::RenderTableSection::calcOuterBorderEnd):
* rendering/style/CollapsedBorderValue.h:
(WebCore::CollapsedBorderValue::adjustedCollapsedBorderWidth):

LayoutTests:

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (197626 => 197627)


--- trunk/LayoutTests/ChangeLog	2016-03-06 02:17:29 UTC (rev 197626)
+++ trunk/LayoutTests/ChangeLog	2016-03-06 03:10:21 UTC (rev 197627)
@@ -1,3 +1,18 @@
+2016-03-05  Zalan Bujtas  <za...@apple.com>
+
+        Make table collapsed borders subpixel aware.
+        https://bugs.webkit.org/show_bug.cgi?id=150383
+
+        Reviewed by Simon Fraser.
+
+        This patch enables authors to 
+        - set subpixel width on collapsed borders
+        - and push those borders to subpixel positions.
+
+        * fast/table/collapsed-border-with-odd-pixel-width-expected.html: Added.
+        * fast/table/collapsed-border-with-odd-pixel-width.html: Added.
+        * fast/table/hidpi-collapsed-border-with-odd-pixel-width-expected.html:
+
 2016-03-05  Sam Weinig  <s...@webkit.org>
 
         Add support for processing the autofill field name out of form control elements ultimately to aid input methods

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


--- trunk/LayoutTests/fast/table/collapsed-border-with-odd-pixel-width-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/collapsed-border-with-odd-pixel-width-expected.html	2016-03-06 03:10:21 UTC (rev 197627)
@@ -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: 25px; top: 21px; border-width: 1px"></div><div style="left: 54px; top: 20px; width: 28px; height: 26px; border-width: 2px"></div><div style="left: 84px; top: 20px; width: 28px; height: 25px; border-width: 3px"></div>
+<div style="left: 23px; top: 46px; border-width: 4px; width: 26px; height: 26px"></div><div style="left: 53px; top: 46px; width: 25px; height: 25px; border-width: 5px"></div><div style="left: 82px; top: 45px; width: 25px; height: 24px; border-width: 6px"></div>
+<div style="left: 22px; top: 74px; border-width: 7px; width: 23px; height: 24px;"></div><div style="left: 51px; top: 73px; width: 22px; height: 23px; border-width: 8px"></div><div style="left: 81px; top: 73px; width: 22px; height: 22px; border-width: 9px"></div>
+
+
+<div style="left: 25px; top: 120px; border-width: 1px; width: 22px; height: 26px;"></div><div style="left: 48px; top: 119px; width: 24px; height: 24px; border-width: 3px"></div><div style="left: 73px; top: 118px; width: 22px; height: 22px; border-width: 5px"></div>
+<div style="left: 25px; top: 147px; border-width: 1px; width: 22px; height: 26px;"></div><div style="left: 48px; top: 146px; width: 24px; height: 24px; border-width: 3px"></div><div style="left: 73px; top: 145px; width: 22px; height: 22px; border-width: 5px"></div>
+<div style="left: 25px; top: 174px; border-width: 1px; width: 22px; height: 26px;"></div><div style="left: 48px; top: 173px; width: 24px; height: 24px; border-width: 3px"></div><div style="left: 73px; top: 172px; width: 22px; height: 22px; border-width: 5px"></div>
+
+<div style="left: 25px; top: 211px; border-width: 1px; width: 34px; height: 26px;"></div><div style="left: 60px; top: 210px; width: 34px; height: 24px; border-width: 3px"></div><div style="left: 97px; top: 209px; width: 34px; height: 22px; border-width: 5px"></div>
+<div style="left: 22px; top: 238px; border-width: 7px; width: 30px; height: 26px;"></div><div style="left: 57px; top: 237px; width: 30px; height: 24px; border-width: 9px"></div><div style="left: 94px; top: 236px; width: 28px; height: 22px; border-width: 11px"></div>
+<div style="left: 19px; top: 271px; border-width: 13px; width: 24px; height: 26px;"></div><div style="left: 54px; top: 270px; width: 24px; height: 24px; border-width: 15px"></div><div style="left: 91px; top: 269px; width: 22px; height: 22px; border-width: 17px"></div>
+
+</html>

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


--- trunk/LayoutTests/fast/table/collapsed-border-with-odd-pixel-width.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/collapsed-border-with-odd-pixel-width.html	2016-03-06 03:10:21 UTC (rev 197627)
@@ -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/LayoutTests/fast/table/hidpi-collapsed-border-with-odd-pixel-width-expected.html (197626 => 197627)


--- trunk/LayoutTests/fast/table/hidpi-collapsed-border-with-odd-pixel-width-expected.html	2016-03-06 02:17:29 UTC (rev 197626)
+++ trunk/LayoutTests/fast/table/hidpi-collapsed-border-with-odd-pixel-width-expected.html	2016-03-06 03:10:21 UTC (rev 197627)
@@ -14,17 +14,17 @@
 </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: 25px; top: 21px; border-width: 1px"></div><div style="left: 54px; top: 20.5px; width: 28.5px; height: 26px; border-width: 2px"></div><div style="left: 84px; top: 20px; width: 28px; height: 25px; border-width: 3px"></div>
+<div style="left: 23.5px; top: 46px; border-width: 4px; width: 26px; 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: 82.5px; top: 45px; width: 25px; height: 24px; border-width: 6px"></div>
+<div style="left: 22px; top: 74px; border-width: 7px; width: 23px; height: 24px;"></div><div style="left: 51px; top: 73.5px; width: 22px; height: 23px; border-width: 8px"></div><div style="left: 81px; top: 73px; 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: 25px; top: 120px; border-width: 1px; width: 22px; height: 26px;"></div><div style="left: 48px; top: 119px; width: 24px; height: 24px; border-width: 3px"></div><div style="left: 73px; top: 118px; width: 22px; height: 22px; border-width: 5px"></div>
+<div style="left: 25px; top: 147px; border-width: 1px; width: 22px; height: 26px;"></div><div style="left: 48px; top: 146px; width: 24px; height: 24px; border-width: 3px"></div><div style="left: 73px; top: 145px; width: 22px; height: 22px; border-width: 5px"></div>
+<div style="left: 25px; top: 174px; border-width: 1px; width: 22px; height: 26px;"></div><div style="left: 48px; top: 173px; width: 24px; height: 24px; border-width: 3px"></div><div style="left: 73px; top: 172px; 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>
+<div style="left: 25px; top: 211px; border-width: 1px; width: 34px; height: 26px;"></div><div style="left: 60px; top: 210px; width: 34px; height: 24px; border-width: 3px"></div><div style="left: 97px; top: 209px; width: 34px; height: 22px; border-width: 5px"></div>
+<div style="left: 22px; top: 238px; border-width: 7px; width: 30px; height: 26px;"></div><div style="left: 57px; top: 237px; width: 30px; height: 24px; border-width: 9px"></div><div style="left: 94px; top: 236px; width: 28px; height: 22px; border-width: 11px"></div>
+<div style="left: 19px; top: 271px; border-width: 13px; width: 24px; height: 26px;"></div><div style="left: 54px; top: 270px; width: 24px; height: 24px; border-width: 15px"></div><div style="left: 91px; top: 269px; width: 22px; height: 22px; border-width: 17px"></div>
 
 </html>
\ No newline at end of file

Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (197626 => 197627)


--- trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-03-06 02:17:29 UTC (rev 197626)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-03-06 03:10:21 UTC (rev 197627)
@@ -2953,8 +2953,6 @@
 
 webkit.org/b/154253 animations/animation-delay-changed.html [ Pass Failure ]
 
-webkit.org/b/155036 fast/table/table-overflow.html [ Skip ]
-
 # Uncategorized reftest failures, uncovered once we made reftests work. Needs triage.
 css3/font-variant-petite-caps-synthesis-coverage.html [ ImageOnlyFailure ]
 css3/font-variant-small-caps-synthesis-coverage.html [ ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (197626 => 197627)


--- trunk/Source/WebCore/ChangeLog	2016-03-06 02:17:29 UTC (rev 197626)
+++ trunk/Source/WebCore/ChangeLog	2016-03-06 03:10:21 UTC (rev 197627)
@@ -1,3 +1,37 @@
+2016-03-05  Zalan Bujtas  <za...@apple.com>
+
+        Make table collapsed borders subpixel aware.
+        https://bugs.webkit.org/show_bug.cgi?id=150383
+
+        Reviewed by Simon Fraser.
+
+        This patch enables authors to 
+        - set subpixel width on collapsed borders
+        - and push those borders to subpixel positions.
+
+        Test: fast/table/collapsed-border-with-odd-pixel-width.html
+
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::calcBorderStart):
+        (WebCore::RenderTable::calcBorderEnd):
+        (WebCore::RenderTable::outerBorderBefore):
+        (WebCore::RenderTable::outerBorderAfter):
+        (WebCore::RenderTable::outerBorderStart):
+        (WebCore::RenderTable::outerBorderEnd):
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::borderHalfStart):
+        (WebCore::RenderTableCell::borderHalfEnd):
+        (WebCore::RenderTableCell::borderHalfBefore):
+        (WebCore::RenderTableCell::borderHalfAfter):
+        (WebCore::RenderTableCell::paintCollapsedBorders):
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::calcOuterBorderBefore):
+        (WebCore::RenderTableSection::calcOuterBorderAfter):
+        (WebCore::RenderTableSection::calcOuterBorderStart):
+        (WebCore::RenderTableSection::calcOuterBorderEnd):
+        * rendering/style/CollapsedBorderValue.h:
+        (WebCore::CollapsedBorderValue::adjustedCollapsedBorderWidth):
+
 2016-03-05  Sam Weinig  <s...@webkit.org>
 
         Add support for processing the autofill field name out of form control elements ultimately to aid input methods

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (197626 => 197627)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2016-03-06 02:17:29 UTC (rev 197626)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2016-03-06 03:10:21 UTC (rev 197627)
@@ -1117,7 +1117,7 @@
                 borderWidth = std::max(borderWidth, firstRowAdjoiningBorder.width());
         }
     }
-    return floorToInt((borderWidth + (style().isLeftToRightDirection() ? 0 : 1)) / 2);
+    return CollapsedBorderValue::adjustedCollapsedBorderWidth(borderWidth, document().deviceScaleFactor(), !style().isLeftToRightDirection());
 }
 
 LayoutUnit RenderTable::calcBorderEnd() const
@@ -1172,7 +1172,7 @@
                 borderWidth = std::max(borderWidth, firstRowAdjoiningBorder.width());
         }
     }
-    return floorToInt((borderWidth + (style().isLeftToRightDirection() ? 1 : 0)) / 2);
+    return CollapsedBorderValue::adjustedCollapsedBorderWidth(borderWidth, document().deviceScaleFactor(), style().isLeftToRightDirection());
 }
 
 void RenderTable::recalcBordersInRowDirection()
@@ -1213,8 +1213,10 @@
     const BorderValue& tb = style().borderBefore();
     if (tb.style() == BHIDDEN)
         return 0;
-    if (tb.style() > BHIDDEN)
-        borderWidth = floorToInt(std::max<LayoutUnit>(borderWidth, tb.width() / 2));
+    if (tb.style() > BHIDDEN) {
+        LayoutUnit collapsedBorderWidth = std::max<LayoutUnit>(borderWidth, tb.width() / 2);
+        borderWidth = floorToDevicePixel(collapsedBorderWidth, document().deviceScaleFactor());
+    }
     return borderWidth;
 }
 
@@ -1232,8 +1234,11 @@
     const BorderValue& tb = style().borderAfter();
     if (tb.style() == BHIDDEN)
         return 0;
-    if (tb.style() > BHIDDEN)
-        borderWidth = floorToInt(std::max<LayoutUnit>(borderWidth, (tb.width() + 1) / 2));
+    if (tb.style() > BHIDDEN) {
+        float deviceScaleFactor = document().deviceScaleFactor();
+        LayoutUnit collapsedBorderWidth = std::max<LayoutUnit>(borderWidth, (tb.width() + (1 / deviceScaleFactor)) / 2);
+        borderWidth = floorToDevicePixel(collapsedBorderWidth, deviceScaleFactor);
+    }
     return borderWidth;
 }
 
@@ -1248,7 +1253,7 @@
     if (tb.style() == BHIDDEN)
         return 0;
     if (tb.style() > BHIDDEN)
-        borderWidth = floorToInt((tb.width() + (style().isLeftToRightDirection() ? 0 : 1)) / 2);
+        return CollapsedBorderValue::adjustedCollapsedBorderWidth(tb.width(), document().deviceScaleFactor(), !style().isLeftToRightDirection());
 
     bool allHidden = true;
     for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) {
@@ -1275,7 +1280,7 @@
     if (tb.style() == BHIDDEN)
         return 0;
     if (tb.style() > BHIDDEN)
-        borderWidth = floorToInt((tb.width() + (style().isLeftToRightDirection() ? 1 : 0)) / 2);
+        return CollapsedBorderValue::adjustedCollapsedBorderWidth(tb.width(), document().deviceScaleFactor(), style().isLeftToRightDirection());
 
     bool allHidden = true;
     for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) {

Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (197626 => 197627)


--- trunk/Source/WebCore/rendering/RenderTableCell.cpp	2016-03-06 02:17:29 UTC (rev 197626)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp	2016-03-06 03:10:21 UTC (rev 197627)
@@ -1054,7 +1054,7 @@
 {
     CollapsedBorderValue border = collapsedStartBorder(DoNotIncludeBorderColor);
     if (border.exists())
-        return floorToInt((border.width() + ((styleForCellFlow().isLeftToRightDirection() ^ outer) ? 1 : 0)) / 2); // Give the extra pixel to top and left.
+        return CollapsedBorderValue::adjustedCollapsedBorderWidth(border.width(), document().deviceScaleFactor(), styleForCellFlow().isLeftToRightDirection() ^ outer);
     return 0;
 }
     
@@ -1062,7 +1062,7 @@
 {
     CollapsedBorderValue border = collapsedEndBorder(DoNotIncludeBorderColor);
     if (border.exists())
-        return floorToInt((border.width() + ((styleForCellFlow().isLeftToRightDirection() ^ outer) ? 0 : 1)) / 2);
+        return CollapsedBorderValue::adjustedCollapsedBorderWidth(border.width(), document().deviceScaleFactor(), !(styleForCellFlow().isLeftToRightDirection() ^ outer));
     return 0;
 }
 
@@ -1070,7 +1070,7 @@
 {
     CollapsedBorderValue border = collapsedBeforeBorder(DoNotIncludeBorderColor);
     if (border.exists())
-        return floorToInt((border.width() + ((styleForCellFlow().isFlippedBlocksWritingMode() ^ outer) ? 0 : 1)) / 2); // Give the extra pixel to top and left.
+        return CollapsedBorderValue::adjustedCollapsedBorderWidth(border.width(), document().deviceScaleFactor(), !(styleForCellFlow().isFlippedBlocksWritingMode() ^ outer));
     return 0;
 }
 
@@ -1078,7 +1078,7 @@
 {
     CollapsedBorderValue border = collapsedAfterBorder(DoNotIncludeBorderColor);
     if (border.exists())
-        return floorToInt((border.width() + ((styleForCellFlow().isFlippedBlocksWritingMode() ^ outer) ? 1 : 0)) / 2);
+        return CollapsedBorderValue::adjustedCollapsedBorderWidth(border.width(), document().deviceScaleFactor(), styleForCellFlow().isFlippedBlocksWritingMode() ^ outer);
     return 0;
 }
 
@@ -1205,20 +1205,25 @@
     LayoutUnit rightWidth = rightVal.width();
 
     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));
+    LayoutUnit leftHalfCollapsedBorder = CollapsedBorderValue::adjustedCollapsedBorderWidth(leftWidth , deviceScaleFactor, false);
+    LayoutUnit topHalfCollapsedBorder = CollapsedBorderValue::adjustedCollapsedBorderWidth(topWidth, deviceScaleFactor, false);
+    LayoutUnit righHalftCollapsedBorder = CollapsedBorderValue::adjustedCollapsedBorderWidth(rightWidth, deviceScaleFactor, true);
+    LayoutUnit bottomHalfCollapsedBorder = CollapsedBorderValue::adjustedCollapsedBorderWidth(bottomWidth, deviceScaleFactor, true);
     
+    LayoutRect borderRect = LayoutRect(paintRect.x() - leftHalfCollapsedBorder,
+        paintRect.y() - topHalfCollapsedBorder,
+        paintRect.width() + leftHalfCollapsedBorder + righHalftCollapsedBorder,
+        paintRect.height() + topHalfCollapsedBorder + bottomHalfCollapsedBorder);
+
     EBorderStyle topStyle = collapsedBorderStyle(topVal.style());
     EBorderStyle bottomStyle = collapsedBorderStyle(bottomVal.style());
     EBorderStyle leftStyle = collapsedBorderStyle(leftVal.style());
     EBorderStyle rightStyle = collapsedBorderStyle(rightVal.style());
     
-    bool renderTop = topStyle > BHIDDEN && !topVal.isTransparent() && floorToInt(topWidth);
-    bool renderBottom = bottomStyle > BHIDDEN && !bottomVal.isTransparent() && floorToInt(bottomWidth);
-    bool renderLeft = leftStyle > BHIDDEN && !leftVal.isTransparent() && floorToInt(leftWidth);
-    bool renderRight = rightStyle > BHIDDEN && !rightVal.isTransparent() && floorToInt(rightWidth);
+    bool renderTop = topStyle > BHIDDEN && !topVal.isTransparent() && floorToDevicePixel(topWidth, deviceScaleFactor);
+    bool renderBottom = bottomStyle > BHIDDEN && !bottomVal.isTransparent() && floorToDevicePixel(bottomWidth, deviceScaleFactor);
+    bool renderLeft = leftStyle > BHIDDEN && !leftVal.isTransparent() && floorToDevicePixel(leftWidth, deviceScaleFactor);
+    bool renderRight = rightStyle > BHIDDEN && !rightVal.isTransparent() && floorToDevicePixel(rightWidth, deviceScaleFactor);
 
     // We never paint diagonals at the joins.  We simply let the border with the highest
     // precedence paint on top of borders with lower precedence.  

Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (197626 => 197627)


--- trunk/Source/WebCore/rendering/RenderTableSection.cpp	2016-03-06 02:17:29 UTC (rev 197626)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp	2016-03-06 03:10:21 UTC (rev 197627)
@@ -759,8 +759,7 @@
     }
     if (allHidden)
         return -1;
-
-    return floorToInt(borderWidth / 2);
+    return CollapsedBorderValue::adjustedCollapsedBorderWidth(borderWidth, document().deviceScaleFactor(), false);
 }
 
 LayoutUnit RenderTableSection::calcOuterBorderAfter() const
@@ -810,8 +809,7 @@
     }
     if (allHidden)
         return -1;
-
-    return floorToInt((borderWidth + 1) / 2);
+    return CollapsedBorderValue::adjustedCollapsedBorderWidth(borderWidth, document().deviceScaleFactor(), true);
 }
 
 LayoutUnit RenderTableSection::calcOuterBorderStart() const
@@ -854,8 +852,7 @@
     }
     if (allHidden)
         return -1;
-
-    return floorToInt((borderWidth + (table()->style().isLeftToRightDirection() ? 0 : 1)) / 2);
+    return CollapsedBorderValue::adjustedCollapsedBorderWidth(borderWidth, document().deviceScaleFactor(), !table()->style().isLeftToRightDirection());
 }
 
 LayoutUnit RenderTableSection::calcOuterBorderEnd() const
@@ -898,8 +895,7 @@
     }
     if (allHidden)
         return -1;
-
-    return floorToInt((borderWidth + (table()->style().isLeftToRightDirection() ? 1 : 0)) / 2);
+    return CollapsedBorderValue::adjustedCollapsedBorderWidth(borderWidth, document().deviceScaleFactor(), table()->style().isLeftToRightDirection());
 }
 
 void RenderTableSection::recalcOuterBorder()

Modified: trunk/Source/WebCore/rendering/style/CollapsedBorderValue.h (197626 => 197627)


--- trunk/Source/WebCore/rendering/style/CollapsedBorderValue.h	2016-03-06 02:17:29 UTC (rev 197626)
+++ trunk/Source/WebCore/rendering/style/CollapsedBorderValue.h	2016-03-06 03:10:21 UTC (rev 197627)
@@ -62,6 +62,8 @@
         return width() == o.width() && style() == o.style() && precedence() == o.precedence();
     }
 
+    static LayoutUnit adjustedCollapsedBorderWidth(float borderWidth, float deviceScaleFactor, bool roundUp);
+
 private:
     LayoutUnit m_width;
     RGBA32 m_color { 0 };
@@ -71,6 +73,12 @@
     unsigned m_transparent : 1;
 };
 
+inline LayoutUnit CollapsedBorderValue::adjustedCollapsedBorderWidth(float borderWidth, float deviceScaleFactor, bool roundUp)
+{
+    float halfCollapsedBorderWidth = (borderWidth + (roundUp ? (1 / deviceScaleFactor) : 0)) / 2;
+    return floorToDevicePixel(halfCollapsedBorderWidth, deviceScaleFactor);
+}
+
 } // namespace WebCore
 
 #endif // CollapsedBorderValue_h
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to