Title: [186309] releases/WebKitGTK/webkit-2.8
Revision
186309
Author
[email protected]
Date
2015-07-06 00:41:44 -0700 (Mon, 06 Jul 2015)

Log Message

Merge r184440 - REGRESSION (Subpixel): Dashed underline is missing when box is positioned at subpixels.
https://bugs.webkit.org/show_bug.cgi?id=145097
rdar://problem/18588415

Reviewed by Simon Fraser.

Dashed and dotted border painting needs clipping in order to properly display corners.
Similarly to solid border's quad calculation, we pixelsnap the border positions before computing the clipping quad values.

Source/WebCore:

Test: fast/borders/dashed-border-on-subpixel-position.html
      fast/borders/dotted-border-on-subpixel-position.html

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::clipBorderSidePolygon):

LayoutTests:

* fast/borders/dashed-border-on-subpixel-position-expected.html: Added.
* fast/borders/dashed-border-on-subpixel-position.html: Added.
* fast/borders/dotted-border-on-subpixel-position-expected.html: Added.
* fast/borders/dotted-border-on-subpixel-position.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog (186308 => 186309)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog	2015-07-06 07:40:12 UTC (rev 186308)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog	2015-07-06 07:41:44 UTC (rev 186309)
@@ -1,3 +1,19 @@
+2015-05-16  Zalan Bujtas  <[email protected]>
+
+        REGRESSION (Subpixel): Dashed underline is missing when box is positioned at subpixels.
+        https://bugs.webkit.org/show_bug.cgi?id=145097
+        rdar://problem/18588415
+
+        Reviewed by Simon Fraser.
+
+        Dashed and dotted border painting needs clipping in order to properly display corners.
+        Similarly to solid border's quad calculation, we pixelsnap the border positions before computing the clipping quad values.
+
+        * fast/borders/dashed-border-on-subpixel-position-expected.html: Added.
+        * fast/borders/dashed-border-on-subpixel-position.html: Added.
+        * fast/borders/dotted-border-on-subpixel-position-expected.html: Added.
+        * fast/borders/dotted-border-on-subpixel-position.html: Added.
+
 2015-05-15  Antti Koivisto  <[email protected]>
 
         When redirecting to data URL use HTTP response for same origin policy checks

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/fast/borders/dashed-border-on-subpixel-position-expected.html (0 => 186309)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/fast/borders/dashed-border-on-subpixel-position-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/fast/borders/dashed-border-on-subpixel-position-expected.html	2015-07-06 07:41:44 UTC (rev 186309)
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that dashed border is painted properly when on subpixel position.</title>
+<style>
+	div { 
+  		position: absolute;
+  		width: 10px;
+  		height: 10px;
+  	}
+  
+	.border1 {
+		border-top: 1px dashed blue;
+	}
+
+	.border2 {
+		border-bottom: 1px dashed blue;
+	}
+
+	.border3 {
+		border-left: 1px dashed blue;
+	}
+
+	.border4 {
+		border-right: 1px dashed blue;
+	}
+</style>
+</head>    
+<body>
+<script>
+    function createDashedBox(x, y, side) {
+		var box = document.createElement("div");
+		box.style.left = x + "px";
+		box.style.top = y + "px";
+		box.className = "border" + side;
+		document.body.appendChild(box);
+    }
+    
+	for (side = 1; side <= 4; ++side) {
+	    var x = 0;
+    	var y  = 0;
+		for (i = 0; i < 10; ++i) {
+			createDashedBox(x, 0, side);
+			x += 14;
+		}
+
+		for (i = 0; i < 40; ++i) {
+			if (!(i % 20))
+				y += 1;
+			createDashedBox(x, y, side);
+			x += 14;
+		}
+	}
+</script>
+</body>
+</html>
\ No newline at end of file

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/fast/borders/dashed-border-on-subpixel-position.html (0 => 186309)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/fast/borders/dashed-border-on-subpixel-position.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/fast/borders/dashed-border-on-subpixel-position.html	2015-07-06 07:41:44 UTC (rev 186309)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that dashed border is painted properly when on subpixel position.</title>
+<style>
+	div { 
+  		position: absolute;
+  		width: 10px;
+  		height: 10px;
+  	}
+  
+	.border1 {
+		border-top: 1px dashed blue;
+	}
+
+	.border2 {
+		border-bottom: 1px dashed blue;
+	}
+
+	.border3 {
+		border-left: 1px dashed blue;
+	}
+
+	.border4 {
+		border-right: 1px dashed blue;
+	}
+</style>
+</head>    
+<body>
+<script>
+	for (side = 1; side <= 4; ++side) {
+	    var x = 0;
+    	var y  = 0;
+		for (i = 0; i < 50; ++i) {
+			var box = document.createElement("div");
+			box.style.left = x + "px";
+			box.style.top = y + "px";
+			box.className = "border" + side;
+			document.body.appendChild(box);
+			x += 14;
+			y += 0.05;
+		}
+	}
+</script>
+</body>
+</html>
\ No newline at end of file

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/fast/borders/dotted-border-on-subpixel-position-expected.html (0 => 186309)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/fast/borders/dotted-border-on-subpixel-position-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/fast/borders/dotted-border-on-subpixel-position-expected.html	2015-07-06 07:41:44 UTC (rev 186309)
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that dotted border is painted properly when on subpixel position.</title>
+<style>
+	div { 
+  		position: absolute;
+  		width: 10px;
+  		height: 10px;
+  	}
+  
+	.border1 {
+		border-top: 1px dotted blue;
+	}
+
+	.border2 {
+		border-bottom: 1px dotted blue;
+	}
+
+	.border3 {
+		border-left: 1px dotted blue;
+	}
+
+	.border4 {
+		border-right: 1px dotted blue;
+	}
+</style>
+</head>    
+<body>
+<script>
+    function createDashedBox(x, y, side) {
+		var box = document.createElement("div");
+		box.style.left = x + "px";
+		box.style.top = y + "px";
+		box.className = "border" + side;
+		document.body.appendChild(box);
+    }
+    
+	for (side = 1; side <= 4; ++side) {
+	    var x = 0;
+    	var y  = 0;
+		for (i = 0; i < 10; ++i) {
+			createDashedBox(x, 0, side);
+			x += 14;
+		}
+
+		for (i = 0; i < 40; ++i) {
+			if (!(i % 20))
+				y += 1;
+			createDashedBox(x, y, side);
+			x += 14;
+		}
+	}
+</script>
+</body>
+</html>
\ No newline at end of file

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/fast/borders/dotted-border-on-subpixel-position.html (0 => 186309)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/fast/borders/dotted-border-on-subpixel-position.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/fast/borders/dotted-border-on-subpixel-position.html	2015-07-06 07:41:44 UTC (rev 186309)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that dotted border is painted properly when on subpixel position.</title>
+<style>
+	div { 
+  		position: absolute;
+  		width: 10px;
+  		height: 10px;
+  	}
+  
+	.border1 {
+		border-top: 1px dotted blue;
+	}
+
+	.border2 {
+		border-bottom: 1px dotted blue;
+	}
+
+	.border3 {
+		border-left: 1px dotted blue;
+	}
+
+	.border4 {
+		border-right: 1px dotted blue;
+	}
+</style>
+</head>    
+<body>
+<script>
+	for (side = 1; side <= 4; ++side) {
+	    var x = 0;
+    	var y  = 0;
+		for (i = 0; i < 50; ++i) {
+			var box = document.createElement("div");
+			box.style.left = x + "px";
+			box.style.top = y + "px";
+			box.className = "border" + side;
+			document.body.appendChild(box);
+			x += 14;
+			y += 0.05;
+		}
+	}
+</script>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (186308 => 186309)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-07-06 07:40:12 UTC (rev 186308)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-07-06 07:41:44 UTC (rev 186309)
@@ -1,3 +1,20 @@
+2015-05-16  Zalan Bujtas  <[email protected]>
+
+        REGRESSION (Subpixel): Dashed underline is missing when box is positioned at subpixels.
+        https://bugs.webkit.org/show_bug.cgi?id=145097
+        rdar://problem/18588415
+
+        Reviewed by Simon Fraser.
+
+        Dashed and dotted border painting needs clipping in order to properly display corners.
+        Similarly to solid border's quad calculation, we pixelsnap the border positions before computing the clipping quad values.
+
+        Test: fast/borders/dashed-border-on-subpixel-position.html
+              fast/borders/dotted-border-on-subpixel-position.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::clipBorderSidePolygon):
+
 2015-05-15  Antti Koivisto  <[email protected]>
 
         When redirecting to data URL use HTTP response for same origin policy checks

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderBoxModelObject.cpp (186308 => 186309)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderBoxModelObject.cpp	2015-07-06 07:40:12 UTC (rev 186308)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderBoxModelObject.cpp	2015-07-06 07:41:44 UTC (rev 186309)
@@ -2084,10 +2084,11 @@
 {
     FloatPoint quad[4];
 
-    const LayoutRect& outerRect = outerBorder.rect();
-    const LayoutRect& innerRect = innerBorder.rect();
+    float deviceScaleFactor = document().deviceScaleFactor();
+    const FloatRect& outerRect = snapRectToDevicePixels(outerBorder.rect(), deviceScaleFactor);
+    const FloatRect& innerRect = snapRectToDevicePixels(innerBorder.rect(), deviceScaleFactor);
 
-    FloatPoint centerPoint(innerRect.location().x() + static_cast<float>(innerRect.width()) / 2, innerRect.location().y() + static_cast<float>(innerRect.height()) / 2);
+    FloatPoint centerPoint(innerRect.location().x() + innerRect.width() / 2, innerRect.location().y() + innerRect.height() / 2);
 
     // For each side, create a quad that encompasses all parts of that side that may draw,
     // including areas inside the innerBorder.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to