[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 13:32:03 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 8b822414a16c01e2d525b4d24c74d8b78fde93ff
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Sep 18 21:47:04 2010 +0000

    2010-09-18  Matthew Delaney  <mdelaney at apple.com>
    
            Reviewed by Oliver Hunt.
    
            Canvas drawImage with source or destination widths/heights of -1 renders incorrectly.
            https://bugs.webkit.org/show_bug.cgi?id=45976
    
            * canvas/philip/tests/2d.drawImage.negativeOneDest-expected.txt: Added.
            * canvas/philip/tests/2d.drawImage.negativeOneDest.html: Added. Tests that using -1
            for the destination width/height renders correctly.
            * canvas/philip/tests/2d.drawImage.negativeOneSource-expected.txt: Added.
            * canvas/philip/tests/2d.drawImage.negativeOneSource.html: Added. Tests that using -1
            for the source width/height renders correctly.
    2010-09-18  Matthew Delaney  <mdelaney at apple.com>
    
            Reviewed by Oliver Hunt.
    
            Canvas drawImage with source or destination widths/heights of -1 renders incorrectly.
            https://bugs.webkit.org/show_bug.cgi?id=45976
    
            Specifying a -1 width or height for either the source or destination rectangle in drawImage
            get improperly drawn with -1 replaced as the corresponding image width or height. This was because
            the value -1 was being passed around to signal non-specified widths and heights and thus was
            interpreted lower down in the drawImage implementation which disallowed any calls that actually
            wanted to use -1 as the widths or heights. Fixed this by moving the default logic up and not using
            -1 in-band signaling to denote default behavior.
    
            Tests: canvas/philip/tests/2d.drawImage.negativeOneDest.html
                   canvas/philip/tests/2d.drawImage.negativeOneSource.html
    
            * platform/graphics/GraphicsContext.cpp: Removed -1 in-band signals and replaced cascased calls to have
            the desired replaces for unspecified widths and heights earlier on.
            * platform/graphics/GraphicsContext.h: Removed faulty default value.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67792 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 40e71e9..924651a 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-09-18  Matthew Delaney  <mdelaney at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        Canvas drawImage with source or destination widths/heights of -1 renders incorrectly.
+        https://bugs.webkit.org/show_bug.cgi?id=45976
+
+        * canvas/philip/tests/2d.drawImage.negativeOneDest-expected.txt: Added.
+        * canvas/philip/tests/2d.drawImage.negativeOneDest.html: Added. Tests that using -1
+        for the destination width/height renders correctly.
+        * canvas/philip/tests/2d.drawImage.negativeOneSource-expected.txt: Added.
+        * canvas/philip/tests/2d.drawImage.negativeOneSource.html: Added. Tests that using -1
+        for the source width/height renders correctly.
+
 2010-09-18  Michael Saboff  <msaboff at apple.com>
 
         Reviewed by Gavin Barraclough.
diff --git a/LayoutTests/canvas/philip/tests/2d.drawImage.negativeOneDest-expected.txt b/LayoutTests/canvas/philip/tests/2d.drawImage.negativeOneDest-expected.txt
new file mode 100644
index 0000000..42ada98
--- /dev/null
+++ b/LayoutTests/canvas/philip/tests/2d.drawImage.negativeOneDest-expected.txt
@@ -0,0 +1,8 @@
+2d.drawImage.negativeOneDest
+-1 dest width/height represents the correct rectangle
+References: 2d.drawImage.direction
+Actual output:
+Expected output:
+
+Passed
+
diff --git a/LayoutTests/canvas/philip/tests/2d.drawImage.negativeOneDest.html b/LayoutTests/canvas/philip/tests/2d.drawImage.negativeOneDest.html
new file mode 100644
index 0000000..93ec9b6
--- /dev/null
+++ b/LayoutTests/canvas/philip/tests/2d.drawImage.negativeOneDest.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<title>Canvas test: 2d.drawImage.negativeOneDest</title>
+<script src="../tests.js"></script>
+<link rel="stylesheet" href="../tests.css">
+<body class="show_output">
+<p>
+<h1><a href="index.2d.html">2d</a>.<a href="index.2d.drawImage.html">drawImage</a>.negativeOneDest</h1>
+<p class="desc">-1 dest width/height represents the correct rectangle</p>
+<div class="refs">References:
+<ul>
+<li><a href="spec.html#testrefs.2d.drawImage.direction">2d.drawImage.direction</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 = '#0f0';
+ctx.fillRect(0, 0, 100, 50);
+var img = document.getElementById('ggrr-256x256.png');
+ctx.drawImage(img, 128, 128, 1, 1, 0, 0, -1, -1);
+
+//ctx.drawImage(canvas, 24, 24, 1, 1, 0, 0, 100, 50);
+
+_assertPixelApprox(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 48,1, 0,255,0,255, "48,1", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 48,48, 0,255,0,255, "48,48", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 51,1, 0,255,0,255, "51,1", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 51,48, 0,255,0,255, "51,48", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
+
+
+});
+</script>
+<img src="../images/ggrr-256x256.png" id="ggrr-256x256.png" class="resource">
+
diff --git a/LayoutTests/canvas/philip/tests/2d.drawImage.negativeOneSource-expected.txt b/LayoutTests/canvas/philip/tests/2d.drawImage.negativeOneSource-expected.txt
new file mode 100644
index 0000000..cf3517a
--- /dev/null
+++ b/LayoutTests/canvas/philip/tests/2d.drawImage.negativeOneSource-expected.txt
@@ -0,0 +1,8 @@
+2d.drawImage.negativeOneSource
+-1 source width/height represents the correct rectangle
+References: 2d.drawImage.direction
+Actual output:
+Expected output:
+
+Passed
+
diff --git a/LayoutTests/canvas/philip/tests/2d.drawImage.negativeOneSource.html b/LayoutTests/canvas/philip/tests/2d.drawImage.negativeOneSource.html
new file mode 100644
index 0000000..2e49594
--- /dev/null
+++ b/LayoutTests/canvas/philip/tests/2d.drawImage.negativeOneSource.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<title>Canvas test: 2d.drawImage.negativeOneSource</title>
+<script src="../tests.js"></script>
+<link rel="stylesheet" href="../tests.css">
+<body class="show_output">
+<p>
+<h1><a href="index.2d.html">2d</a>.<a href="index.2d.drawImage.html">drawImage</a>.negativeOneSource</h1>
+<p class="desc">-1 source width/height represents the correct rectangle</p>
+<div class="refs">References:
+<ul>
+<li><a href="spec.html#testrefs.2d.drawImage.direction">2d.drawImage.direction</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);
+var img = document.getElementById('ggrr-256x256.png');
+ctx.drawImage(img, 128, 128, -1, -1, 0, 0, 100, 50);
+
+_assertPixelApprox(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 48,1, 0,255,0,255, "48,1", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 48,48, 0,255,0,255, "48,48", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 51,1, 0,255,0,255, "51,1", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 51,48, 0,255,0,255, "51,48", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
+_assertPixelApprox(canvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
+
+
+});
+</script>
+<img src="../images/ggrr-256x256.png" id="ggrr-256x256.png" class="resource">
+
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 5f1f689..2af4a3b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2010-09-18  Matthew Delaney  <mdelaney at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        Canvas drawImage with source or destination widths/heights of -1 renders incorrectly.
+        https://bugs.webkit.org/show_bug.cgi?id=45976
+
+        Specifying a -1 width or height for either the source or destination rectangle in drawImage
+        get improperly drawn with -1 replaced as the corresponding image width or height. This was because
+        the value -1 was being passed around to signal non-specified widths and heights and thus was
+        interpreted lower down in the drawImage implementation which disallowed any calls that actually
+        wanted to use -1 as the widths or heights. Fixed this by moving the default logic up and not using
+        -1 in-band signaling to denote default behavior.
+
+        Tests: canvas/philip/tests/2d.drawImage.negativeOneDest.html
+               canvas/philip/tests/2d.drawImage.negativeOneSource.html
+
+        * platform/graphics/GraphicsContext.cpp: Removed -1 in-band signals and replaced cascased calls to have
+        the desired replaces for unspecified widths and heights earlier on.
+        * platform/graphics/GraphicsContext.h: Removed faulty default value.
+
 2010-09-18  Ademar de Souza Reis Jr  <ademar.reis at openbossa.org>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/platform/graphics/GraphicsContext.cpp b/WebCore/platform/graphics/GraphicsContext.cpp
index 2c94bec..747c9fc 100644
--- a/WebCore/platform/graphics/GraphicsContext.cpp
+++ b/WebCore/platform/graphics/GraphicsContext.cpp
@@ -309,26 +309,6 @@ bool GraphicsContext::paintingDisabled() const
     return m_common->state.paintingDisabled;
 }
 
-void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& p, CompositeOperator op)
-{
-    drawImage(image, styleColorSpace, p, IntRect(0, 0, -1, -1), op);
-}
-
-void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntRect& r, CompositeOperator op, bool useLowQualityScale)
-{
-    drawImage(image, styleColorSpace, r, IntRect(0, 0, -1, -1), op, useLowQualityScale);
-}
-
-void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& dest, const IntRect& srcRect, CompositeOperator op)
-{
-    drawImage(image, styleColorSpace, IntRect(dest, srcRect.size()), srcRect, op);
-}
-
-void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect, CompositeOperator op, bool useLowQualityScale)
-{
-    drawImage(image, styleColorSpace, FloatRect(dest), srcRect, op, useLowQualityScale);
-}
-
 #if !OS(WINCE) || PLATFORM(QT)
 void GraphicsContext::drawText(const Font& font, const TextRun& run, const IntPoint& point, int from, int to)
 {
@@ -383,6 +363,30 @@ void GraphicsContext::drawHighlightForText(const Font& font, const TextRun& run,
     fillRect(font.selectionRectForText(run, point, h, from, to), backgroundColor, colorSpace);
 }
 
+void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& p, CompositeOperator op)
+{
+    if (!image)
+        return;
+    drawImage(image, styleColorSpace, p, IntRect(0, 0, image->width(), image->height()), op);
+}
+
+void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntRect& r, CompositeOperator op, bool useLowQualityScale)
+{
+    if (!image)
+        return;
+    drawImage(image, styleColorSpace, r, IntRect(0, 0, image->width(), image->height()), op, useLowQualityScale);
+}
+
+void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& dest, const IntRect& srcRect, CompositeOperator op)
+{
+    drawImage(image, styleColorSpace, IntRect(dest, srcRect.size()), srcRect, op);
+}
+
+void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect, CompositeOperator op, bool useLowQualityScale)
+{
+    drawImage(image, styleColorSpace, FloatRect(dest), srcRect, op, useLowQualityScale);
+}
+
 void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op, bool useLowQualityScale)
 {
     if (paintingDisabled() || !image)
@@ -393,16 +397,6 @@ void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const
     float tw = dest.width();
     float th = dest.height();
 
-    if (tsw == -1)
-        tsw = image->width();
-    if (tsh == -1)
-        tsh = image->height();
-
-    if (tw == -1)
-        tw = image->width();
-    if (th == -1)
-        th = image->height();
-
     if (useLowQualityScale) {
         save();
         setImageInterpolationQuality(InterpolationNone);
@@ -445,12 +439,16 @@ void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, c
 
 void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const IntPoint& p, CompositeOperator op)
 {
-    drawImageBuffer(image, styleColorSpace, p, IntRect(0, 0, -1, -1), op);
+    if (!image)
+        return;
+    drawImageBuffer(image, styleColorSpace, p, IntRect(0, 0, image->width(), image->height()), op);
 }
 
 void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const IntRect& r, CompositeOperator op, bool useLowQualityScale)
 {
-    drawImageBuffer(image, styleColorSpace, r, IntRect(0, 0, -1, -1), op, useLowQualityScale);
+    if (!image)
+        return;
+    drawImageBuffer(image, styleColorSpace, r, IntRect(0, 0, image->width(), image->height()), op, useLowQualityScale);
 }
 
 void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const IntPoint& dest, const IntRect& srcRect, CompositeOperator op)
@@ -468,21 +466,6 @@ void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorS
     if (paintingDisabled() || !image)
         return;
 
-    float tsw = src.width();
-    float tsh = src.height();
-    float tw = dest.width();
-    float th = dest.height();
-
-    if (tsw == -1)
-        tsw = image->width();
-    if (tsh == -1)
-        tsh = image->height();
-
-    if (tw == -1)
-        tw = image->width();
-    if (th == -1)
-        th = image->height();
-
     if (useLowQualityScale) {
         save();
         setImageInterpolationQuality(InterpolationNone);
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index cb045e1..e57951f 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -235,8 +235,8 @@ namespace WebCore {
         void drawImage(Image*, ColorSpace styleColorSpace, const IntRect&, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
         void drawImage(Image*, ColorSpace styleColorSpace, const IntPoint& destPoint, const IntRect& srcRect, CompositeOperator = CompositeSourceOver);
         void drawImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
-        void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1),
-                       CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
+        void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
+        
         void drawTiledImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize,
                        CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
         void drawTiledImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntRect& srcRect,

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list