[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 11:37:21 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 453bda465d8abc31e0b8bcb97b4cc17f9b187bdf
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jul 31 05:08:15 2010 +0000

    2010-07-30  Matthew Delaney  <mdelaney at apple.com>
    
            Reviewed by Darin Adler.
    
            ctx.clearRect improperly clears shadow
            https://bugs.webkit.org/show_bug.cgi?id=43213
    
            * canvas/philip/tests/2d.clearRect+fillRect.alpha0-expected.txt: Added.
            * canvas/philip/tests/2d.clearRect+fillRect.alpha0.5-expected.txt: Added.
            * canvas/philip/tests/2d.clearRect+fillRect.alpha0.5.html: Added.
            Same as above but with alpha of one half.
            * canvas/philip/tests/2d.clearRect+fillRect.alpha0.html: Added.
            Tests that clearing rect with alpha or 0 has no unwanted side-effects
            * canvas/philip/tests/2d.clearRect+fillRect.basic-expected.txt: Added.
            * canvas/philip/tests/2d.clearRect+fillRect.basic.html: Added.
            Tests clearing a rect and then filling back over doesn't show any
            side effects (such as caused by not ignoring/restoring appropriate
            context attributes).
            * platform/mac/Skipped: unskipping now passing test
    2010-07-30  Matthew Delaney  <mdelaney at apple.com>
    
            Reviewed by Darin Adler.
    
            ctx.clearRect improperly clears shadow
            https://bugs.webkit.org/show_bug.cgi?id=43213
    
            Tests: canvas/philip/tests/2d.clearRect+fillRect.alpha0.5.html
                   canvas/philip/tests/2d.clearRect+fillRect.alpha0.html
                   canvas/philip/tests/2d.clearRect+fillRect.basic.html
    
            * html/canvas/CanvasRenderingContext2D.cpp:
            (WebCore::CanvasRenderingContext2D::setAllAttributesToDefault):
            Added a new method to wipe out all context attributes to their defaults.
            (WebCore::CanvasRenderingContext2D::clearRect):
            Updated clearRect to ignore shadow, alpha, and global composite attributes
            when clearing the input rect to match the canvas spec.
            * html/canvas/CanvasRenderingContext2D.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64407 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7320dde..4e80731 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,23 @@
+2010-07-30  Matthew Delaney  <mdelaney at apple.com>
+
+        Reviewed by Darin Adler.
+
+        ctx.clearRect improperly clears shadow
+        https://bugs.webkit.org/show_bug.cgi?id=43213
+
+        * canvas/philip/tests/2d.clearRect+fillRect.alpha0-expected.txt: Added.
+        * canvas/philip/tests/2d.clearRect+fillRect.alpha0.5-expected.txt: Added.
+        * canvas/philip/tests/2d.clearRect+fillRect.alpha0.5.html: Added.
+        Same as above but with alpha of one half.
+        * canvas/philip/tests/2d.clearRect+fillRect.alpha0.html: Added.
+        Tests that clearing rect with alpha or 0 has no unwanted side-effects
+        * canvas/philip/tests/2d.clearRect+fillRect.basic-expected.txt: Added.
+        * canvas/philip/tests/2d.clearRect+fillRect.basic.html: Added.
+        Tests clearing a rect and then filling back over doesn't show any
+        side effects (such as caused by not ignoring/restoring appropriate
+        context attributes).
+        * platform/mac/Skipped: unskipping now passing test
+
 2010-07-30  Luiz Agostini  <luiz.agostini at openbossa.org>
 
         Fix chromium test expectations.
diff --git a/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.alpha0-expected.txt b/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.alpha0-expected.txt
new file mode 100644
index 0000000..6234f28
--- /dev/null
+++ b/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.alpha0-expected.txt
@@ -0,0 +1,7 @@
+[index]
+2d.clearRect
+fillRect preceded by a clearRect (ctx.globalAlpha = 0.0) on the same area should show no side effects
+References: 2d.clearRect
+Actual output:
+Expected output:
+Passed
diff --git a/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.alpha0.5-expected.txt b/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.alpha0.5-expected.txt
new file mode 100644
index 0000000..29c5092
--- /dev/null
+++ b/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.alpha0.5-expected.txt
@@ -0,0 +1,8 @@
+[index]
+2d.clearRect
+fillRect preceded by a clearRect (ctx.globalAlpha = 0.5) on the same area should show no side effects
+References: 2d.clearRect
+Actual output:
+Expected output:
+
+Passed
diff --git a/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.alpha0.5.html b/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.alpha0.5.html
new file mode 100644
index 0000000..36c12d0
--- /dev/null
+++ b/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.alpha0.5.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<title>Canvas test: 2d.clearRect+fillRect.alpha0.5</title>
+<script src="../tests.js"></script>
+<link rel="stylesheet" href="../tests.css">
+<body class="show_output">
+<p>
+ <a href="index.html">[index]</a>
+<h1><a href="index.2d.html">2d</a>.<a href="index.2d.clearRect.html">clearRect</a></h1>
+<p class="desc">fillRect preceded by a clearRect (ctx.globalAlpha = 0.5) on the same area should show no side effects</p>
+<div class="refs">References:
+<ul>
+<li><a href="spec.html#testrefs.2d.clearRect">2d.clearRect</a>
+</ul>
+</div>
+
+<p class="output">Actual output:</p>
+<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
+<p class="output expectedtext">Expected output:<p><img src="green-100x50.png" class="output expected" id="expected" alt="">
+<ul id="d"></ul>
+<script>
+_addTest(function(canvas, ctx) {
+
+ctx.fillStyle = '#f00';
+ctx.fillRect(0, 0, 100, 50);
+ctx.globalAlpha = 0.5;
+ctx.clearRect(0, 0, 100, 50);
+ctx.globalAlpha = 1.0;
+ctx.fillStyle = '#0f0';
+ctx.fillRect(0, 0, 100, 50);
+_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
+
+
+});
+</script>
+
diff --git a/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.alpha0.html b/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.alpha0.html
new file mode 100644
index 0000000..927656f
--- /dev/null
+++ b/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.alpha0.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<title>Canvas test: 2d.clearRect+fillRect.alpha0</title>
+<script src="../tests.js"></script>
+<link rel="stylesheet" href="../tests.css">
+<body class="show_output">
+<p>
+ <a href="index.html">[index]</a>
+<h1><a href="index.2d.html">2d</a>.<a href="index.2d.clearRect.html">clearRect</a></h1>
+<p class="desc">fillRect preceded by a clearRect (ctx.globalAlpha = 0.0) on the same area should show no side effects</p><div class="refs">
+<div class="refs">References:
+<ul>
+<li><a href="spec.html#testrefs.2d.clearRect">2d.clearRect</a>
+</ul>
+</div>
+
+
+<p class="output">Actual output:</p>
+<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
+<p class="output expectedtext">Expected output:<p><img src="green-100x50.png" class="output expected" id="expected" alt="">
+<ul id="d"></ul>
+<script>
+_addTest(function(canvas, ctx) {
+
+ctx.fillStyle = '#f00';
+ctx.fillRect(0, 0, 100, 50);
+ctx.globalAlpha = 0.0;
+ctx.clearRect(0, 0, 100, 50);
+ctx.globalAlpha = 1.0;
+ctx.fillStyle = '#0f0';
+ctx.fillRect(0, 0, 100, 50);
+_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
+
+
+});
+</script>
+
diff --git a/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.basic-expected.txt b/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.basic-expected.txt
new file mode 100644
index 0000000..d214545
--- /dev/null
+++ b/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.basic-expected.txt
@@ -0,0 +1,8 @@
+[index]
+2d.clearRect
+fillRect preceded by a clearRect on the same area should show no side effects
+References: 2d.clearRect
+Actual output:
+Expected output:
+
+Passed
diff --git a/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.basic.html b/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.basic.html
new file mode 100644
index 0000000..5caad28
--- /dev/null
+++ b/LayoutTests/canvas/philip/tests/2d.clearRect+fillRect.basic.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<title>Canvas test: 2d.clearRect+fillRect.basic</title>
+<script src="../tests.js"></script>
+<link rel="stylesheet" href="../tests.css">
+<body class="show_output">
+<p>
+ <a href="index.html">[index]</a>
+<h1><a href="index.2d.html">2d</a>.<a href="index.2d.clearRect.html">clearRect</a></h1>
+<p class="desc">fillRect preceded by a clearRect on the same area should show no side effects</p>
+<div class="refs">References:
+<ul>
+<li><a href="spec.html#testrefs.2d.clearRect">2d.clearRect</a>
+</ul>
+</div>
+
+<p class="output">Actual output:</p>
+<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
+<p class="output expectedtext">Expected output:<p><img src="green-100x50.png" class="output expected" id="expected" alt="">
+<ul id="d"></ul>
+<script>
+_addTest(function(canvas, ctx) {
+
+ctx.fillStyle = '#f00';
+ctx.fillRect(0, 0, 100, 50);
+ctx.clearRect(0, 0, 100, 50);
+ctx.fillStyle = '#0f0';
+ctx.fillRect(0, 0, 100, 50);
+_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
+
+
+});
+</script>
+
diff --git a/LayoutTests/platform/mac/Skipped b/LayoutTests/platform/mac/Skipped
index cf49fc0..7104eeb 100644
--- a/LayoutTests/platform/mac/Skipped
+++ b/LayoutTests/platform/mac/Skipped
@@ -165,7 +165,6 @@ scrollbars/scrollbar-click-does-not-blur-content.html
 # Failing canvas test cases from http://philip.html5.org/tests/canvas/suite/tests/
 canvas/philip/tests/2d.drawImage.broken.html
 canvas/philip/tests/2d.path.clip.empty.html
-canvas/philip/tests/2d.clearRect.shadow.html
 canvas/philip/tests/2d.composite.operation.clear.html
 canvas/philip/tests/2d.composite.operation.darker.html
 canvas/philip/tests/2d.composite.operation.highlight.html
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index cf2aa36..f05549f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-07-30  Matthew Delaney  <mdelaney at apple.com>
+
+        Reviewed by Darin Adler.
+
+        ctx.clearRect improperly clears shadow
+        https://bugs.webkit.org/show_bug.cgi?id=43213
+
+        Tests: canvas/philip/tests/2d.clearRect+fillRect.alpha0.5.html
+               canvas/philip/tests/2d.clearRect+fillRect.alpha0.html
+               canvas/philip/tests/2d.clearRect+fillRect.basic.html
+
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::setAllAttributesToDefault):
+        Added a new method to wipe out all context attributes to their defaults.
+        (WebCore::CanvasRenderingContext2D::clearRect):
+        Updated clearRect to ignore shadow, alpha, and global composite attributes
+        when clearing the input rect to match the canvas spec.
+        * html/canvas/CanvasRenderingContext2D.h:
+
 2010-07-30  Kinuko Yasuda  <kinuko at chromium.org>
 
         Reviewed by Jian Li.
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index 6c3d372..3b05348 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -164,6 +164,23 @@ void CanvasRenderingContext2D::restore()
     c->restore();
 }
 
+void CanvasRenderingContext2D::setAllAttributesToDefault() 
+{
+    state().m_globalAlpha = 1;
+    state().m_shadowOffset = FloatSize();
+    state().m_shadowBlur = 0;
+    state().m_shadowColor = Color::transparent;
+    state().m_globalComposite = CompositeSourceOver;
+
+    GraphicsContext* context = drawingContext();
+    if (!context)
+        return;
+
+    context->setShadow(FloatSize(), 0, Color::transparent, DeviceColorSpace);
+    context->setAlpha(1);
+    context->setCompositeOperation(CompositeSourceOver);
+}
+
 CanvasStyle* CanvasRenderingContext2D::strokeStyle() const
 {
     return state().m_strokeStyle.get();
@@ -790,14 +807,18 @@ void CanvasRenderingContext2D::clearRect(float x, float y, float width, float he
 {
     if (!validateRectForCanvas(x, y, width, height))
         return;
-    GraphicsContext* c = drawingContext();
-    if (!c)
+    GraphicsContext* context = drawingContext();
+    if (!context)
         return;
     if (!state().m_invertibleCTM)
         return;
     FloatRect rect(x, y, width, height);
+
+    save();
+    setAllAttributesToDefault();
     willDraw(rect);
-    c->clearRect(rect);
+    context->clearRect(rect);
+    restore();
 }
 
 void CanvasRenderingContext2D::fillRect(float x, float y, float width, float height)
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.h b/WebCore/html/canvas/CanvasRenderingContext2D.h
index fb5f27a..22ed7fc 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.h
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.h
@@ -104,6 +104,7 @@ public:
 
     void save();
     void restore();
+    void setAllAttributesToDefault();
 
     void scale(float sx, float sy);
     void rotate(float angleInRadians);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list