Title: [95207] trunk
Revision
95207
Author
mdela...@apple.com
Date
2011-09-15 12:00:42 -0700 (Thu, 15 Sep 2011)

Log Message

REGRESSION (Safari 5.1-r95043): Incorrect box-shadow offset
https://bugs.webkit.org/show_bug.cgi?id=68041

Reviewed by Dan Bernstein.

Source/WebCore: 

Test: fast/box-shadow/no-blur-multiple-offsets.html

* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::setPlatformShadow): Add hack back in for Lion if
context is not accelerated.

LayoutTests: 

* fast/box-shadow/no-blur-multiple-offsets-expected.txt: Added.
* fast/box-shadow/no-blur-multiple-offsets.html: Added.
* platform/mac/fast/box-shadow/no-blur-multiple-offsets-expected.png: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (95206 => 95207)


--- trunk/LayoutTests/ChangeLog	2011-09-15 18:54:17 UTC (rev 95206)
+++ trunk/LayoutTests/ChangeLog	2011-09-15 19:00:42 UTC (rev 95207)
@@ -1,3 +1,14 @@
+2011-09-15  Matthew Delaney  <mdela...@apple.com>
+
+        REGRESSION (Safari 5.1-r95043): Incorrect box-shadow offset
+        https://bugs.webkit.org/show_bug.cgi?id=68041
+
+        Reviewed by Dan Bernstein.
+
+        * fast/box-shadow/no-blur-multiple-offsets-expected.txt: Added.
+        * fast/box-shadow/no-blur-multiple-offsets.html: Added.
+        * platform/mac/fast/box-shadow/no-blur-multiple-offsets-expected.png: Added.
+
 2011-09-15  James Simonsen  <simon...@chromium.org>
 
         Ref protect HTMLObjectElement and HTMLEmbedElement while requesting plugins

Added: trunk/LayoutTests/fast/box-shadow/no-blur-multiple-offsets-expected.txt (0 => 95207)


--- trunk/LayoutTests/fast/box-shadow/no-blur-multiple-offsets-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/no-blur-multiple-offsets-expected.txt	2011-09-15 19:00:42 UTC (rev 95207)
@@ -0,0 +1,2 @@
+Divs with green no-blur shadows and offsets (x,y) listed.
+(-1,-1) (1,1) (-1,1) (1,-1) (-2,-2) (2,2) (-2,2) (2,-2) (-3,-3) (3,3) (-3,3) (3,-3) (-4,-4) (4,4) (-4,4) (4,-4)

Added: trunk/LayoutTests/fast/box-shadow/no-blur-multiple-offsets.html (0 => 95207)


--- trunk/LayoutTests/fast/box-shadow/no-blur-multiple-offsets.html	                        (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/no-blur-multiple-offsets.html	2011-09-15 19:00:42 UTC (rev 95207)
@@ -0,0 +1,42 @@
+<html>
+<body>
+    <style>
+        .testbox
+        {
+            display: inline-block;
+            text-align: center;
+            margin: 10px;
+            width: 100px;
+            height: 100px;
+            background: white;
+        }
+        #container
+        {
+            width: 500px;
+        }
+    </style>
+    <script>
+        if (window.layoutTestController)
+            window.layoutTestController.dumpAsText(true);
+    </script>
+    Divs with green no-blur shadows and offsets (x,y) listed.
+    <div id="container">
+        <div class="testbox" style="-webkit-box-shadow: green -1px -1px;">(-1,-1)</div>
+        <div class="testbox" style="-webkit-box-shadow: green 1px 1px;">(1,1)</div>
+        <div class="testbox" style="-webkit-box-shadow: green -1px 1px;">(-1,1)</div>
+        <div class="testbox" style="-webkit-box-shadow: green 1px -1px;">(1,-1)</div>
+        <div class="testbox" style="-webkit-box-shadow: green -2px -2px;">(-2,-2)</div>
+        <div class="testbox" style="-webkit-box-shadow: green 2px 2px;">(2,2)</div>
+        <div class="testbox" style="-webkit-box-shadow: green -2px 2px;">(-2,2)</div>
+        <div class="testbox" style="-webkit-box-shadow: green 2px -2px;">(2,-2)</div>
+        <div class="testbox" style="-webkit-box-shadow: green -3px -3px;">(-3,-3)</div>
+        <div class="testbox" style="-webkit-box-shadow: green 3px 3px;">(3,3)</div>
+        <div class="testbox" style="-webkit-box-shadow: green -3px 3px;">(-3,3)</div>
+        <div class="testbox" style="-webkit-box-shadow: green 3px -3px;">(3,-3)</div>
+        <div class="testbox" style="-webkit-box-shadow: green -4px -4px;">(-4,-4)</div>
+        <div class="testbox" style="-webkit-box-shadow: green 4px 4px;">(4,4)</div>
+        <div class="testbox" style="-webkit-box-shadow: green -4px 4px;">(-4,4)</div>
+        <div class="testbox" style="-webkit-box-shadow: green 4px -4px;">(4,-4)</div>
+    </div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/platform/mac/fast/box-shadow/no-blur-multiple-offsets-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/box-shadow/no-blur-multiple-offsets-expected.png ___________________________________________________________________

Added: svn:mime-type

Modified: trunk/Source/WebCore/ChangeLog (95206 => 95207)


--- trunk/Source/WebCore/ChangeLog	2011-09-15 18:54:17 UTC (rev 95206)
+++ trunk/Source/WebCore/ChangeLog	2011-09-15 19:00:42 UTC (rev 95207)
@@ -1,3 +1,16 @@
+2011-09-15  Matthew Delaney  <mdela...@apple.com>
+
+        REGRESSION (Safari 5.1-r95043): Incorrect box-shadow offset
+        https://bugs.webkit.org/show_bug.cgi?id=68041
+
+        Reviewed by Dan Bernstein.
+
+        Test: fast/box-shadow/no-blur-multiple-offsets.html
+
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::setPlatformShadow): Add hack back in for Lion if
+        context is not accelerated.
+
 2011-09-15  James Simonsen  <simon...@chromium.org>
 
         Ref protect HTMLObjectElement and HTMLEmbedElement while requesting plugins

Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (95206 => 95207)


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2011-09-15 18:54:17 UTC (rev 95206)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2011-09-15 19:00:42 UTC (rev 95207)
@@ -1024,21 +1024,22 @@
     // Extreme "blur" values can make text drawing crash or take crazy long times, so clamp
     blurRadius = min(blurRadius, narrowPrecisionToCGFloat(1000.0));
 
-#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
-    // Work around <rdar://problem/5539388> by ensuring that the offsets will get truncated
-    // to the desired integer.
-    static const CGFloat extraShadowOffset = narrowPrecisionToCGFloat(1.0 / 128);
-    if (xOffset > 0)
-        xOffset += extraShadowOffset;
-    else if (xOffset < 0)
-        xOffset -= extraShadowOffset;
 
-    if (yOffset > 0)
-        yOffset += extraShadowOffset;
-    else if (yOffset < 0)
-        yOffset -= extraShadowOffset;
-#endif
+    if (!isAcceleratedContext()) {
+        // Work around <rdar://problem/5539388> by ensuring that the offsets will get truncated
+        // to the desired integer. Also see: <rdar://problem/10056277>
+        static const CGFloat extraShadowOffset = narrowPrecisionToCGFloat(1.0 / 128);
+        if (xOffset > 0)
+            xOffset += extraShadowOffset;
+        else if (xOffset < 0)
+            xOffset -= extraShadowOffset;
 
+        if (yOffset > 0)
+            yOffset += extraShadowOffset;
+        else if (yOffset < 0)
+            yOffset -= extraShadowOffset;
+    }
+
     // Check for an invalid color, as this means that the color was not set for the shadow
     // and we should therefore just use the default shadow color.
     if (!color.isValid())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to