Title: [170646] trunk
Revision
170646
Author
[email protected]
Date
2014-07-01 10:25:10 -0700 (Tue, 01 Jul 2014)

Log Message

Subpixel rendering: Pixel crack in breadcrumbs at devforums.apple.com.
https://bugs.webkit.org/show_bug.cgi?id=134491

Reviewed by Simon Fraser.

Do not early round geometry values, while computing background image position. It changes the final
subpixel values and that could lead to wrong snap positions.
pixelSnapBackgroundImageGeometryForPainting() takes care of geometry snapping.

Source/WebCore:
Test: fast/backgrounds/background-image-size-double-rounding.html

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

LayoutTests:
* fast/backgrounds/background-image-size-double-rounding-expected.html: Added.
* fast/backgrounds/background-image-size-double-rounding.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (170645 => 170646)


--- trunk/LayoutTests/ChangeLog	2014-07-01 17:14:35 UTC (rev 170645)
+++ trunk/LayoutTests/ChangeLog	2014-07-01 17:25:10 UTC (rev 170646)
@@ -1,3 +1,17 @@
+2014-07-01  Zalan Bujtas  <[email protected]>
+
+        Subpixel rendering: Pixel crack in breadcrumbs at devforums.apple.com.
+        https://bugs.webkit.org/show_bug.cgi?id=134491
+
+        Reviewed by Simon Fraser.
+
+        Do not early round geometry values, while computing background image position. It changes the final
+        subpixel values and that could lead to wrong snap positions.
+        pixelSnapBackgroundImageGeometryForPainting() takes care of geometry snapping.
+
+        * fast/backgrounds/background-image-size-double-rounding-expected.html: Added.
+        * fast/backgrounds/background-image-size-double-rounding.html: Added.
+
 2014-06-30  Myles C. Maxfield  <[email protected]>
 
         All Indic text is rendered as boxes on iOS

Added: trunk/LayoutTests/fast/backgrounds/background-image-size-double-rounding-expected.html (0 => 170646)


--- trunk/LayoutTests/fast/backgrounds/background-image-size-double-rounding-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/backgrounds/background-image-size-double-rounding-expected.html	2014-07-01 17:25:10 UTC (rev 170646)
@@ -0,0 +1,44 @@
+<html>
+<head>
+<title>This tests that background image size is rounded properly when no-repeat attribute is present.</title>
+<style>
+  .outer {
+	position: absolute;
+    width: 10px;
+    height: 10px;
+	background-color: blue;
+  }
+
+  .inner {
+    height: 10px;
+    width: 10.5px;
+	background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAAaCAYAAAA0R0VGAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAK6wAACusBgosNWgAAAq5pVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIgogICAgICAgICAgICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgICAgICAgICAgIHhtbG5zOnRpZmY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vdGlmZi8xLjAvIj4KICAgICAgICAgPHhtcDpDcmVhdGVEYXRlPjIwMDgtMDktMjBUMTA6MTY6MjNaPC94bXA6Q3JlYXRlRGF0ZT4KICAgICAgICAgPHhtcDpDcmVhdG9yVG9vbD5BZG9iZSBGaXJld29ya3MgQ1MzPC94bXA6Q3JlYXRvclRvb2w+CiAgICAgICAgIDx4bXA6TW9kaWZ5RGF0ZT4yMDA4LTA5LTIwVDEzOjEyOjQ4WjwveG1wOk1vZGlmeURhdGU+CiAgICAgICAgIDxkYzpmb3JtYXQ+aW1hZ2UvcG5nPC9kYzpmb3JtYXQ+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgqSlUo2AAAATUlEQVRIDe3SsQ3AMAwDQcf7j5o2dQx4hK9UnHoCxInP965/Db09tNetpVz9DjlyVaDmbI5cFag5myNXBWrO5shVgZqzOXJVoOZsrsodgj4DFBo/NegAAAAASUVORK5CYII=);
+  }
+</style>
+</head>
+<body>
+<p id="container"></p>
+<script>
+  var container = document.getElementById("container");
+  adjustment = 0.1;
+  for (i = 0; i < 20; ++i) {
+    adjustment += 0.1;
+    size = 8;
+    for (j = 0; j < 20; ++j) {
+      size += 0.1;
+      var outer = document.createElement("div");
+      outer.className = "outer";
+      outer.style.top = (20 * i + j * adjustment) + "px";
+      outer.style.left = (20 * j + i * adjustment) + "px";
+      
+      var inner = document.createElement("div");
+      inner.className = "inner";
+      inner.style.width = size + "px";
+      
+      outer.appendChild(inner);
+      container.appendChild(outer);
+    }
+  }
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/backgrounds/background-image-size-double-rounding.html (0 => 170646)


--- trunk/LayoutTests/fast/backgrounds/background-image-size-double-rounding.html	                        (rev 0)
+++ trunk/LayoutTests/fast/backgrounds/background-image-size-double-rounding.html	2014-07-01 17:25:10 UTC (rev 170646)
@@ -0,0 +1,44 @@
+<html>
+<head>
+<title>This tests that background image size is rounded properly when no-repeat attribute is present.</title>
+<style>
+  .outer {
+    position: absolute;
+    width: 10px;
+    height: 10px;
+	background-color: blue;
+  }
+
+  .inner {
+    height: 10px;
+    width: 10.5px;
+	background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAAaCAYAAAA0R0VGAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAK6wAACusBgosNWgAAAq5pVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIgogICAgICAgICAgICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgICAgICAgICAgIHhtbG5zOnRpZmY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vdGlmZi8xLjAvIj4KICAgICAgICAgPHhtcDpDcmVhdGVEYXRlPjIwMDgtMDktMjBUMTA6MTY6MjNaPC94bXA6Q3JlYXRlRGF0ZT4KICAgICAgICAgPHhtcDpDcmVhdG9yVG9vbD5BZG9iZSBGaXJld29ya3MgQ1MzPC94bXA6Q3JlYXRvclRvb2w+CiAgICAgICAgIDx4bXA6TW9kaWZ5RGF0ZT4yMDA4LTA5LTIwVDEzOjEyOjQ4WjwveG1wOk1vZGlmeURhdGU+CiAgICAgICAgIDxkYzpmb3JtYXQ+aW1hZ2UvcG5nPC9kYzpmb3JtYXQ+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgqSlUo2AAAATUlEQVRIDe3SsQ3AMAwDQcf7j5o2dQx4hK9UnHoCxInP965/Db09tNetpVz9DjlyVaDmbI5cFag5myNXBWrO5shVgZqzOXJVoOZsrsodgj4DFBo/NegAAAAASUVORK5CYII=) no-repeat right;
+  }
+</style>
+</head>
+<body>
+<p id="container"></p>
+<script>
+  var container = document.getElementById("container");
+  adjustment = 0.1;
+  for (i = 0; i < 20; ++i) {
+    adjustment += 0.1;
+    size = 8;
+    for (j = 0; j < 20; ++j) {
+      size += 0.1;
+      var outer = document.createElement("div");
+      outer.className = "outer";
+      outer.style.top = (20 * i + j * adjustment) + "px";
+      outer.style.left = (20 * j + i * adjustment) + "px";
+      
+      var inner = document.createElement("div");
+      inner.className = "inner";
+      inner.style.width = size + "px";
+      
+      outer.appendChild(inner);
+      container.appendChild(outer);
+    }
+  }
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (170645 => 170646)


--- trunk/Source/WebCore/ChangeLog	2014-07-01 17:14:35 UTC (rev 170645)
+++ trunk/Source/WebCore/ChangeLog	2014-07-01 17:25:10 UTC (rev 170646)
@@ -1,3 +1,19 @@
+2014-07-01  Zalan Bujtas  <[email protected]>
+
+        Subpixel rendering: Pixel crack in breadcrumbs at devforums.apple.com.
+        https://bugs.webkit.org/show_bug.cgi?id=134491
+
+        Reviewed by Simon Fraser.
+
+        Do not early round geometry values, while computing background image position. It changes the final
+        subpixel values and that could lead to wrong snap positions.
+        pixelSnapBackgroundImageGeometryForPainting() takes care of geometry snapping.
+
+        Test: fast/backgrounds/background-image-size-double-rounding.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
+
 2014-07-01  Pratik Solanki  <[email protected]>
 
         Create NSURLRequest lazily when USE(CFNETWORK) is enabled

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (170645 => 170646)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2014-07-01 17:14:35 UTC (rev 170645)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2014-07-01 17:25:10 UTC (rev 170646)
@@ -1149,7 +1149,7 @@
     LayoutUnit availableWidth = positioningAreaSize.width() - geometry.tileSize().width();
     LayoutUnit availableHeight = positioningAreaSize.height() - geometry.tileSize().height();
 
-    LayoutUnit computedXPosition = minimumValueForLength(fillLayer->xPosition(), availableWidth, true);
+    LayoutUnit computedXPosition = minimumValueForLength(fillLayer->xPosition(), availableWidth, false);
     if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > 0 && fillTileSize.width() > 0) {
         int numTiles = std::max(1, roundToInt(positioningAreaSize.width() / fillTileSize.width()));
         if (fillLayer->size().size.height().isAuto() && backgroundRepeatY != RoundFill)
@@ -1161,7 +1161,7 @@
         geometry.setSpaceSize(LayoutSize());
     }
 
-    LayoutUnit computedYPosition = minimumValueForLength(fillLayer->yPosition(), availableHeight, true);
+    LayoutUnit computedYPosition = minimumValueForLength(fillLayer->yPosition(), availableHeight, false);
     if (backgroundRepeatY == RoundFill && positioningAreaSize.height() > 0 && fillTileSize.height() > 0) {
         int numTiles = std::max(1, roundToInt(positioningAreaSize.height() / fillTileSize.height()));
         if (fillLayer->size().size.width().isAuto() && backgroundRepeatX != RoundFill)
@@ -1181,7 +1181,7 @@
         LayoutUnit actualWidth = geometry.tileSize().width() + space;
 
         if (space >= 0) {
-            computedXPosition = minimumValueForLength(Length(), availableWidth, true);
+            computedXPosition = minimumValueForLength(Length(), availableWidth, false);
             geometry.setSpaceSize(LayoutSize(space, 0));
             geometry.setPhaseX(actualWidth ? actualWidth - fmodf((computedXPosition + left), actualWidth) : 0);
         } else
@@ -1201,7 +1201,7 @@
         LayoutUnit actualHeight = geometry.tileSize().height() + space;
 
         if (space >= 0) {
-            computedYPosition = minimumValueForLength(Length(), availableHeight, true);
+            computedYPosition = minimumValueForLength(Length(), availableHeight, false);
             geometry.setSpaceSize(LayoutSize(geometry.spaceSize().width(), space));
             geometry.setPhaseY(actualHeight ? actualHeight - fmodf((computedYPosition + top), actualHeight) : 0);
         } else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to