Title: [167637] trunk
Revision
167637
Author
[email protected]
Date
2014-04-21 17:15:35 -0700 (Mon, 21 Apr 2014)

Log Message

REGRESSION (r166784): Gradient at background of iCloud login page doesn’t go all the way to the bottom
https://bugs.webkit.org/show_bug.cgi?id=131924

Computing tile dimension for contain/cover requires higher precision than what LayoutUnit has. Switching to floats.

Reviewed by Simon Fraser.

Source/WebCore:
Test: fast/backgrounds/hidpi-background-image-contain-cover-scale-needs-more-precision.html

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

LayoutTests:
* fast/backgrounds/hidpi-background-image-contain-cover-scale-needs-more-precision-expected.html: Added.
* fast/backgrounds/hidpi-background-image-contain-cover-scale-needs-more-precision.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (167636 => 167637)


--- trunk/LayoutTests/ChangeLog	2014-04-22 00:14:34 UTC (rev 167636)
+++ trunk/LayoutTests/ChangeLog	2014-04-22 00:15:35 UTC (rev 167637)
@@ -1,3 +1,15 @@
+2014-04-21  Zalan Bujtas  <[email protected]>
+
+        REGRESSION (r166784): Gradient at background of iCloud login page doesn’t go all the way to the bottom
+        https://bugs.webkit.org/show_bug.cgi?id=131924
+
+        Computing tile dimension for contain/cover requires higher precision than what LayoutUnit has. Switching to floats.
+
+        Reviewed by Simon Fraser.
+
+        * fast/backgrounds/hidpi-background-image-contain-cover-scale-needs-more-precision-expected.html: Added.
+        * fast/backgrounds/hidpi-background-image-contain-cover-scale-needs-more-precision.html: Added.
+
 2014-04-21  Eric Carlson  <[email protected]>
 
         [Mac] implement WebKitDataCue

Added: trunk/LayoutTests/fast/backgrounds/hidpi-background-image-contain-cover-scale-needs-more-precision-expected.html (0 => 167637)


--- trunk/LayoutTests/fast/backgrounds/hidpi-background-image-contain-cover-scale-needs-more-precision-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/backgrounds/hidpi-background-image-contain-cover-scale-needs-more-precision-expected.html	2014-04-22 00:15:35 UTC (rev 167637)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that background image tile's dimension is computed correctly for the contain case.</title>
+<style>
+  img {
+    width: 9px;
+    height: 9px;
+    position: fixed;
+    border: 1px solid white;
+    content:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAQACAIAAAAP+8yGAAACoklEQVR4Xu3dwQ0CMQxEUTtKvbRCC3RqjtwR3g3WSwP/MDOObaIlH89XdJ4VzQcAACBiZzcgMvs1AAAAAFCu3WiR3YCYcKMBACh2AKopgFJBA7Xoo4Fip1TQAEAtkmQASXZlalsAJLk/aC59AICdSQNJ7ge4DwRN0ORAbypociAHgsamliHWmlwkB7oKnZ0caH7lQA40v3LApmqRHPiBAsBCSvsOYCHFpuZkfZEcsCmbsqn2/XSbchGAHLApm3q9D6Cz07YAaB19oZWLaCAHbHoiwBf52BRADtiUTb1KAJAD384B8Gkbzx4APOyWAwAjlKCx6eQky4GgyYGgCZocAAiapSCAoLkPJBnA03QASZZkGgAoFVpHczKAWmQIVIsAAOxNARQ7AAB9kUEcQLn+/gCopgAAbjQ3Gg1cOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANV8aAAAAADwi7Pr/5+DVt2tAQAAgGK3I6oZUANEBgDQtigVACFoYQBhUwBBEzQAORA0NmVTOWBTADYlMptyEQCbEhnAOzsALjpPA88e6rJ3FUTmIi7Sm3IRF3ERkS1miaxUEFmpILJSURN6UyIT2QhlALHxIjKRiUxk+yKTPpGJbNInMpEN4sMARAawDBG06SIL2goi21UIGpFpcJlNjbFENuEQmQY0MGUaQEyZRBY0QRM0U6YpkwZEFjTrHFMmDTS/RCayKdOUacoUNH+4I2hENmX2AIhMZGMskWlgjCUyke2LNF5EJjINiExkGy8bL8uQCSIbxIlspcZFJn0iE1mpsEogsjGWi7iIi4jMRVzERfamAJaC52sAwEUANl5sCsCmXGRG89e6bEoDOWBTADmQAwBBk4MRAABJFjQAAIBqPvdrAPAGv7GBbaSCtb0AAAAASUVORK5CYII=");
+  }
+</style>
+</head>
+<body>
+<p id="container"></p>
+<script>
+  var container = document.getElementById("container");
+  adjustment = 0.5;
+  w=0.5; h=0.5;
+  for (i = 0; i < 15; ++i) {
+    adjustment+=0.1;
+    for (j = 0; j < 15; ++j) {
+      var e = document.createElement("img");
+      e.style.top = ((w + 1) * i + j * adjustment) + "px";
+      e.style.left = ((w + 1) * j + i * adjustment) + "px";
+      e.style.width = w + "px";
+      e.style.height = h + "px";
+      container.appendChild(e);
+      w+=0.5;
+      h+=0.5;
+    }
+  }
+</script>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/backgrounds/hidpi-background-image-contain-cover-scale-needs-more-precision.html (0 => 167637)


--- trunk/LayoutTests/fast/backgrounds/hidpi-background-image-contain-cover-scale-needs-more-precision.html	                        (rev 0)
+++ trunk/LayoutTests/fast/backgrounds/hidpi-background-image-contain-cover-scale-needs-more-precision.html	2014-04-22 00:15:35 UTC (rev 167637)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that background image tile's dimension is computed correctly for the contain case.</title>
+<style>
+  div {
+    background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAQACAIAAAAP+8yGAAACoklEQVR4Xu3dwQ0CMQxEUTtKvbRCC3RqjtwR3g3WSwP/MDOObaIlH89XdJ4VzQcAACBiZzcgMvs1AAAAAFCu3WiR3YCYcKMBACh2AKopgFJBA7Xoo4Fip1TQAEAtkmQASXZlalsAJLk/aC59AICdSQNJ7ge4DwRN0ORAbypociAHgsamliHWmlwkB7oKnZ0caH7lQA40v3LApmqRHPiBAsBCSvsOYCHFpuZkfZEcsCmbsqn2/XSbchGAHLApm3q9D6Cz07YAaB19oZWLaCAHbHoiwBf52BRADtiUTb1KAJAD384B8Gkbzx4APOyWAwAjlKCx6eQky4GgyYGgCZocAAiapSCAoLkPJBnA03QASZZkGgAoFVpHczKAWmQIVIsAAOxNARQ7AAB9kUEcQLn+/gCopgAAbjQ3Gg1cOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANV8aAAAAADwi7Pr/5+DVt2tAQAAgGK3I6oZUANEBgDQtigVACFoYQBhUwBBEzQAORA0NmVTOWBTADYlMptyEQCbEhnAOzsALjpPA88e6rJ3FUTmIi7Sm3IRF3ERkS1miaxUEFmpILJSURN6UyIT2QhlALHxIjKRiUxk+yKTPpGJbNInMpEN4sMARAawDBG06SIL2goi21UIGpFpcJlNjbFENuEQmQY0MGUaQEyZRBY0QRM0U6YpkwZEFjTrHFMmDTS/RCayKdOUacoUNH+4I2hENmX2AIhMZGMskWlgjCUyke2LNF5EJjINiExkGy8bL8uQCSIbxIlspcZFJn0iE1mpsEogsjGWi7iIi4jMRVzERfamAJaC52sAwEUANl5sCsCmXGRG89e6bEoDOWBTADmQAwBBk4MRAABJFjQAAIBqPvdrAPAGv7GBbaSCtb0AAAAASUVORK5CYII=");
+    background-size:contain; 
+    width: 10px;
+    height: 10px;
+    position: fixed;
+    border: solid 1px white;
+  }
+</style>
+</head>
+<body>
+<p id="container"></p>
+<script>
+  var container = document.getElementById("container");
+  adjustment = 0.5;
+  w=0.5; h=0.5;
+  for (i = 0; i < 15; ++i) {
+    adjustment+=0.1;
+    for (j = 0; j < 15; ++j) {
+      var e = document.createElement("div");
+      e.style.top = ((w + 1) * i + j * adjustment) + "px";
+      e.style.left = ((w + 1) * j + i * adjustment) + "px";
+      e.style.width = w + "px";
+      e.style.height = h + "px";
+      container.appendChild(e);
+      w+=0.5;
+      h+=0.5;
+    }
+  }
+</script>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (167636 => 167637)


--- trunk/Source/WebCore/ChangeLog	2014-04-22 00:14:34 UTC (rev 167636)
+++ trunk/Source/WebCore/ChangeLog	2014-04-22 00:15:35 UTC (rev 167637)
@@ -1,3 +1,17 @@
+2014-04-21  Zalan Bujtas  <[email protected]>
+
+        REGRESSION (r166784): Gradient at background of iCloud login page doesn’t go all the way to the bottom
+        https://bugs.webkit.org/show_bug.cgi?id=131924
+
+        Computing tile dimension for contain/cover requires higher precision than what LayoutUnit has. Switching to floats.
+
+        Reviewed by Simon Fraser.
+
+        Test: fast/backgrounds/hidpi-background-image-contain-cover-scale-needs-more-precision.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::calculateFillTileSize):
+
 2014-04-21  Dean Jackson  <[email protected]>
 
         Build fix for Mountain Lion.

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (167636 => 167637)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2014-04-22 00:14:34 UTC (rev 167636)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2014-04-22 00:15:35 UTC (rev 167637)
@@ -977,12 +977,16 @@
         FALLTHROUGH;
         case Contain:
         case Cover: {
-            float horizontalScaleFactor = imageIntrinsicSize.width() ? (positioningAreaSize.width() / imageIntrinsicSize.width()).toFloat() : 1;
-            float verticalScaleFactor = imageIntrinsicSize.height() ? (positioningAreaSize.height() / imageIntrinsicSize.height()).toFloat() : 1;
+            // Scale computation needs higher precision than what LayoutUnit can offer.
+            FloatSize localImageIntrinsicSize = imageIntrinsicSize;
+            FloatSize localPositioningAreaSize = positioningAreaSize;
+
+            float horizontalScaleFactor = localImageIntrinsicSize.width() ? (localPositioningAreaSize.width() / localImageIntrinsicSize.width()) : 1;
+            float verticalScaleFactor = localImageIntrinsicSize.height() ? (localPositioningAreaSize.height() / localImageIntrinsicSize.height()) : 1;
             float scaleFactor = type == Contain ? std::min(horizontalScaleFactor, verticalScaleFactor) : std::max(horizontalScaleFactor, verticalScaleFactor);
             float deviceScaleFactor = document().deviceScaleFactor();
-            return LayoutSize(std::max<LayoutUnit>(1 / deviceScaleFactor, imageIntrinsicSize.width() * scaleFactor),
-                std::max<LayoutUnit>(1 / deviceScaleFactor, imageIntrinsicSize.height() * scaleFactor));
+            return LayoutSize(std::max<LayoutUnit>(1 / deviceScaleFactor, localImageIntrinsicSize.width() * scaleFactor),
+                std::max<LayoutUnit>(1 / deviceScaleFactor, localImageIntrinsicSize.height() * scaleFactor));
        }
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to