[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

simon.fraser at apple.com simon.fraser at apple.com
Thu Apr 8 01:04:59 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 82dfe09ae1201458d21bacf61dd06b5040e0d72a
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 14 04:44:31 2010 +0000

    2010-01-13  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Dan Bernstein.
    
            Fix shadow drawing to do the correct computations using the base coordinate space
            https://bugs.webkit.org/show_bug.cgi?id=33629
    
            Shadows draw using the CGContext base CTM, so we need to convert the shadow offet
            and size from user CTM into into base CTM coordinates, via the matix obtained from wkGetUserToBaseCTM().
    
            Test: compositing/shadows/shadow-drawing.html
    
            * platform/graphics/cg/GraphicsContextCG.cpp:
            (WebCore::GraphicsContext::setPlatformShadow):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53235 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index a01facc..902ff3a 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-01-13  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Fix shadow drawing to do the correct computations using the base coordinate space
+        https://bugs.webkit.org/show_bug.cgi?id=33629
+        
+        Testcase for box- and text-shadow drawing, both into the window, and into composited layers.
+
+        * compositing/shadows/shadow-drawing.html: Added.
+        * platform/mac/compositing/shadows/shadow-drawing-expected.checksum: Added.
+        * platform/mac/compositing/shadows/shadow-drawing-expected.png: Added.
+        * platform/mac/compositing/shadows/shadow-drawing-expected.txt: Added.
+
 2010-01-13  Nikolas Zimmermann  <nzimmermann at rim.com>
 
         Not reviewed. Update Qt slave result after last SVG commit.
diff --git a/LayoutTests/compositing/shadows/shadow-drawing.html b/LayoutTests/compositing/shadows/shadow-drawing.html
new file mode 100644
index 0000000..57cac52
--- /dev/null
+++ b/LayoutTests/compositing/shadows/shadow-drawing.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <title>Shadow test</title>
+  <style type="text/css" media="screen">
+   .box {
+        display: inline-block;
+        height: 150px;
+        width: 200px;
+        margin: 50px;
+        border: 1px solid black;
+        -webkit-box-shadow: 10px 10px 4px rgba(0, 0, 0, 0.5);
+     }
+
+     .compositing {
+       -webkit-transform: translateZ(0);
+     }
+     
+     .shadowed {
+       font-size: 28pt;
+       color: blue;
+       text-align: center;
+       text-shadow: 0 10px 3px rgba(0, 0, 0, 0.5);
+       -webkit-transform: rotate(10deg);
+     }
+  </style>
+</head>
+<body>
+
+<p>Left and right sides should look the same.</p>
+
+<div class="box">
+  <p class="shadowed">Shadowed text</p>
+</div>
+
+<div class="compositing box">
+  <p class="shadowed">Shadowed text</p>
+</div>
+
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/compositing/shadows/shadow-drawing-expected.checksum b/LayoutTests/platform/mac/compositing/shadows/shadow-drawing-expected.checksum
new file mode 100644
index 0000000..928ef7b
--- /dev/null
+++ b/LayoutTests/platform/mac/compositing/shadows/shadow-drawing-expected.checksum
@@ -0,0 +1 @@
+9f46077840f2deeaaedcdab100aa4111
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/compositing/shadows/shadow-drawing-expected.png b/LayoutTests/platform/mac/compositing/shadows/shadow-drawing-expected.png
new file mode 100644
index 0000000..3a804eb
Binary files /dev/null and b/LayoutTests/platform/mac/compositing/shadows/shadow-drawing-expected.png differ
diff --git a/LayoutTests/platform/mac/compositing/shadows/shadow-drawing-expected.txt b/LayoutTests/platform/mac/compositing/shadows/shadow-drawing-expected.txt
new file mode 100644
index 0000000..94029ac
--- /dev/null
+++ b/LayoutTests/platform/mac/compositing/shadows/shadow-drawing-expected.txt
@@ -0,0 +1,27 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x310
+  RenderBlock {HTML} at (0,0) size 800x310
+    RenderBody {BODY} at (8,16) size 784x286
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 262x18
+          text run at (0,0) width 262: "Left and right sides should look the same."
+      RenderBlock (anonymous) at (0,34) size 784x252
+        RenderBlock {DIV} at (50,50) size 202x152 [border: (1px solid #000000)]
+        RenderText {#text} at (302,151) size 4x18
+          text run at (302,151) width 4: " "
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+layer at (59,138) size 200x86
+  RenderBlock {P} at (1,38) size 200x86 [color=#0000FF]
+    RenderText {#text} at (22,0) size 156x86
+      text run at (22,0) width 156: "Shadowed"
+      text run at (72,43) width 55: "text"
+layer at (364,100) size 202x152
+  RenderBlock {DIV} at (356,50) size 202x152 [border: (1px solid #000000)]
+layer at (365,138) size 200x86
+  RenderBlock {P} at (1,38) size 200x86 [color=#0000FF]
+    RenderText {#text} at (22,0) size 156x86
+      text run at (22,0) width 156: "Shadowed"
+      text run at (72,43) width 55: "text"
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6a2cb52..f7c1908 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-01-13  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Fix shadow drawing to do the correct computations using the base coordinate space
+        https://bugs.webkit.org/show_bug.cgi?id=33629
+        
+        Shadows draw using the CGContext base CTM, so we need to convert the shadow offet
+        and size from user CTM into into base CTM coordinates, via the matix obtained from wkGetUserToBaseCTM().
+
+        Test: compositing/shadows/shadow-drawing.html
+
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::setPlatformShadow):
+
 2010-01-13  Nikolas Zimmermann  <nzimmermann at rim.com>
 
         Reviewed by Oliver Hunt.
diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
index 746d1f5..b147676 100644
--- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
@@ -36,6 +36,7 @@
 #include "Path.h"
 #include "Pattern.h"
 #include "TransformationMatrix.h"
+#include "WebCoreSystemInterface.h"
 
 #include <CoreGraphics/CGBitmapContext.h>
 #include <CoreGraphics/CGPDFContext.h>
@@ -749,23 +750,22 @@ void GraphicsContext::setPlatformShadow(const IntSize& offset, int blur, const C
     CGContextRef context = platformContext();
 
     if (!m_common->state.shadowsIgnoreTransforms) {
-        CGAffineTransform transform = CGContextGetCTM(context);
+        CGAffineTransform userToBaseCTM = wkGetUserToBaseCTM(context);
 
-        CGFloat A = transform.a * transform.a + transform.b * transform.b;
-        CGFloat B = transform.a * transform.c + transform.b * transform.d;
+        CGFloat A = userToBaseCTM.a * userToBaseCTM.a + userToBaseCTM.b * userToBaseCTM.b;
+        CGFloat B = userToBaseCTM.a * userToBaseCTM.c + userToBaseCTM.b * userToBaseCTM.d;
         CGFloat C = B;
-        CGFloat D = transform.c * transform.c + transform.d * transform.d;
+        CGFloat D = userToBaseCTM.c * userToBaseCTM.c + userToBaseCTM.d * userToBaseCTM.d;
 
         CGFloat smallEigenvalue = narrowPrecisionToCGFloat(sqrt(0.5 * ((A + D) - sqrt(4 * B * C + (A - D) * (A - D)))));
 
         // Extreme "blur" values can make text drawing crash or take crazy long times, so clamp
         blurRadius = min(blur * smallEigenvalue, narrowPrecisionToCGFloat(1000.0));
 
-        CGSize offsetInDeviceSpace = CGSizeApplyAffineTransform(offset, transform);
-
-        xOffset = offsetInDeviceSpace.width;
-        yOffset = offsetInDeviceSpace.height;
+        CGSize offsetInBaseSpace = CGSizeApplyAffineTransform(offset, userToBaseCTM);
 
+        xOffset = offsetInBaseSpace.width;
+        yOffset = offsetInBaseSpace.height;
     }
 
     // Work around <rdar://problem/5539388> by ensuring that the offsets will get truncated

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list