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

mihaip at chromium.org mihaip at chromium.org
Wed Dec 22 18:25:10 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 4a1481a04b4e02822cfc8b27721cc58a5bfc8bc8
Author: mihaip at chromium.org <mihaip at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 10 18:47:54 2010 +0000

    2010-12-08  Mihai Parparita  <mihaip at chromium.org>
    
            Reviewed by Darin Adler.
    
            fast/canvas/canvas-getImageData-negative-source.html fails on Mac
            https://bugs.webkit.org/show_bug.cgi?id=47901
    
            Add test for rounding behavior. Remove now-passing tests from
            test_expectations.txt.
    
            * fast/canvas/canvas-getImageData-rounding-expected.txt: Added.
            * fast/canvas/canvas-getImageData-rounding.html: Added.
            * platform/chromium/test_expectations.txt:
    2010-12-08  Mihai Parparita  <mihaip at chromium.org>
    
            Reviewed by Darin Adler.
    
            fast/canvas/canvas-getImageData-negative-source.html fails on Mac
            https://bugs.webkit.org/show_bug.cgi?id=47901
    
            Test: fast/canvas/canvas-getImageData-rounding.html
    
            static_cast<unsigned> is generally not what we want in
            convertLogicalToDevice. It produces inconsistent results when compiling
            for 32-bit vs. 64-bit, and in any case we weren't getting correct
            rounding behavior for source rectangles (e.g. we should get a source rect
            of width 2 if the source X is 0.9 and the source width is 0.2, but we
            were getting only one of width 1).
    
            * html/HTMLCanvasElement.cpp:
            (WebCore::HTMLCanvasElement::convertLogicalToDevice):
            (WebCore::HTMLCanvasElement::convertToValidDeviceSize):
            * html/HTMLCanvasElement.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73744 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c7ec95b..eccd111 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-12-08  Mihai Parparita  <mihaip at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        fast/canvas/canvas-getImageData-negative-source.html fails on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=47901
+        
+        Add test for rounding behavior. Remove now-passing tests from
+        test_expectations.txt.
+
+        * fast/canvas/canvas-getImageData-rounding-expected.txt: Added.
+        * fast/canvas/canvas-getImageData-rounding.html: Added.
+        * platform/chromium/test_expectations.txt:
+
 2010-12-10  Alejandro G. Castro  <alex at igalia.com>
 
         Unreviewed GTK test expectation update.
diff --git a/LayoutTests/fast/canvas/canvas-getImageData-rounding-expected.txt b/LayoutTests/fast/canvas/canvas-getImageData-rounding-expected.txt
new file mode 100644
index 0000000..e7ea28b
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-getImageData-rounding-expected.txt
@@ -0,0 +1,36 @@
+Test the handling of non-integer source coordinates in getImageData().
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+getImageData(0, 0, 20, 10)
+PASS imageData.width is 20
+PASS imageData.height is 10
+getImageData(0.1, 0.2, 20, 10)
+PASS imageData.width is 21
+PASS imageData.height is 11
+getImageData(0.9, 0.8, 20, 10)
+PASS imageData.width is 21
+PASS imageData.height is 11
+getImageData(0, 0, 19.9, 9.9)
+PASS imageData.width is 20
+PASS imageData.height is 10
+getImageData(0, 0, 19.1, 9.1)
+PASS imageData.width is 20
+PASS imageData.height is 10
+getImageData(0.9, 0, 0.2, 10)
+PASS imageData.width is 2
+PASS imageData.height is 10
+getImageData(-1, -1, 20, 10)
+PASS imageData.width is 20
+PASS imageData.height is 10
+getImageData(-1.1, 0, 20, 10)
+PASS imageData.width is 21
+PASS imageData.height is 10
+getImageData(-1.9, 0, 20, 10)
+PASS imageData.width is 21
+PASS imageData.height is 10
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/canvas/canvas-getImageData-rounding.html b/LayoutTests/fast/canvas/canvas-getImageData-rounding.html
new file mode 100644
index 0000000..fe4f07f
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-getImageData-rounding.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("Test the handling of non-integer source coordinates in getImageData().");
+
+ctx = document.createElement('canvas').getContext('2d');
+
+function dimensionsShouldBe(sx, sy, sw, sh, width, height)
+{
+    imageData = ctx.getImageData(sx, sy, sw, sh);
+    debug('getImageData(' + sx + ', ' + sy + ', ' + sw + ', ' + sh + ')');
+    shouldBe('imageData.width', width + '');
+    shouldBe('imageData.height', height + '');
+}
+
+// Basic integer values
+dimensionsShouldBe(   0,  0,   20,  10,     20, 10);
+
+// Source point is not an integer
+dimensionsShouldBe(  .1, .2,   20,  10,     21, 11);
+dimensionsShouldBe(  .9, .8,   20,  10,     21, 11);
+
+// Size is not an integer
+dimensionsShouldBe(   0,  0, 19.9, 9.9,     20, 10);
+dimensionsShouldBe(   0,  0, 19.1, 9.1,     20, 10);
+
+// Width straddles a pixel boundary
+dimensionsShouldBe(  .9,  0,   .2,  10,      2, 10);
+
+// Basic integer negative values
+dimensionsShouldBe(  -1, -1,   20,  10,     20, 10);
+
+// Non-integer negative values
+dimensionsShouldBe(-1.1,  0,   20,  10,     21, 10);
+dimensionsShouldBe(-1.9,  0,   20,  10,     21, 10);
+
+successfullyParsed = true;
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium/test_expectations.txt b/LayoutTests/platform/chromium/test_expectations.txt
index 74caf64..8e66305 100644
--- a/LayoutTests/platform/chromium/test_expectations.txt
+++ b/LayoutTests/platform/chromium/test_expectations.txt
@@ -2415,14 +2415,10 @@ BUGWK45991 MAC : canvas/philip/tests/2d.shadow.enable.blur.html = TEXT
 BUGWK45991 MAC : canvas/philip/tests/2d.shadow.enable.x.html = TEXT
 BUGWK45991 MAC : canvas/philip/tests/2d.shadow.enable.y.html = TEXT
 BUGWK45991 MAC : canvas/philip/tests/2d.strokeRect.zero.4.html = TEXT
-BUGWK45991 MAC : canvas/philip/tests/2d.imageData.get.source.outside.html = TEXT
 BUGWK45991 WIN : canvas/philip/tests/2d.gradient.radial.touch2.html = TEXT
 BUGWK40147 : canvas/philip/tests/toDataURL.jpeg.alpha.html = TEXT
 BUG61824 : canvas/philip/tests/2d.pattern.image.string.html = TEXT
 
-// Failures after WebKit roll 70949:71000
-BUGWK45991 MAC : canvas/philip/tests/2d.imageData.get.source.negative.html = TEXT
-
 // Flaky tests
 BUG44229 WIN LINUX : fast/loader/recursive-before-unload-crash.html = PASS TEXT
 
@@ -2924,8 +2920,6 @@ BUG47578 : printing/simultaneous-position-float-change.html = IMAGE+TEXT
 
 BUG59647 WIN : svg/dom/length-list-parser.html = PASS CRASH
 
-BUGWK47901 MAC : fast/canvas/canvas-getImageData-negative-source.html = TEXT
-
 // We don't support layoutTestController.nodesFromRect so this test just times out
 BUGWK46600 SKIP : fast/dom/nodesFromRect-links-and-text.html = TEXT
 BUGWK46600 SKIP : fast/dom/nodesFromRect-inner-documents.html = TEXT
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9d01cbe..90b9457 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2010-12-08  Mihai Parparita  <mihaip at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        fast/canvas/canvas-getImageData-negative-source.html fails on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=47901
+
+        Test: fast/canvas/canvas-getImageData-rounding.html
+        
+        static_cast<unsigned> is generally not what we want in
+        convertLogicalToDevice. It produces inconsistent results when compiling
+        for 32-bit vs. 64-bit, and in any case we weren't getting correct
+        rounding behavior for source rectangles (e.g. we should get a source rect
+        of width 2 if the source X is 0.9 and the source width is 0.2, but we
+        were getting only one of width 1).
+
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::convertLogicalToDevice):
+        (WebCore::HTMLCanvasElement::convertToValidDeviceSize):
+        * html/HTMLCanvasElement.h:
+
 2010-12-10  Hironori Bono  <hbono at chromium.org>
 
         Reviewed by Ojan Vafai.
diff --git a/WebCore/html/HTMLCanvasElement.cpp b/WebCore/html/HTMLCanvasElement.cpp
index fea70d1..4130e38 100644
--- a/WebCore/html/HTMLCanvasElement.cpp
+++ b/WebCore/html/HTMLCanvasElement.cpp
@@ -322,31 +322,33 @@ String HTMLCanvasElement::toDataURL(const String& mimeType, const double* qualit
 
 IntRect HTMLCanvasElement::convertLogicalToDevice(const FloatRect& logicalRect) const
 {
-    return IntRect(convertLogicalToDevice(logicalRect.location()), convertLogicalToDevice(logicalRect.size()));
+    float left = floorf(logicalRect.left() * m_pageScaleFactor);
+    float top = floorf(logicalRect.top() * m_pageScaleFactor);
+    float right = ceilf(logicalRect.right() * m_pageScaleFactor);
+    float bottom = ceilf(logicalRect.bottom() * m_pageScaleFactor);
+    
+    return IntRect(IntPoint(left, top), convertToValidDeviceSize(right - left, bottom - top));
 }
 
 IntSize HTMLCanvasElement::convertLogicalToDevice(const FloatSize& logicalSize) const
 {
-    float wf = ceilf(logicalSize.width() * m_pageScaleFactor);
-    float hf = ceilf(logicalSize.height() * m_pageScaleFactor);
+    return convertToValidDeviceSize(logicalSize.width() * m_pageScaleFactor, logicalSize.height() * m_pageScaleFactor);
+}
 
-    if (!(wf >= 1 && hf >= 1 && wf * hf <= MaxCanvasArea))
+IntSize HTMLCanvasElement::convertToValidDeviceSize(float width, float height) const
+{
+    width = ceilf(width);
+    height = ceilf(height);
+    
+    if (width < 1 || height < 1 || width * height > MaxCanvasArea)
         return IntSize();
 
 #if PLATFORM(SKIA)
-    if (wf > MaxSkiaDim || hf > MaxSkiaDim)
+    if (width > MaxSkiaDim || height > MaxSkiaDim)
         return IntSize();
 #endif
 
-    return IntSize(static_cast<unsigned>(wf), static_cast<unsigned>(hf));
-}
-
-IntPoint HTMLCanvasElement::convertLogicalToDevice(const FloatPoint& logicalPos) const
-{
-    float xf = logicalPos.x() * m_pageScaleFactor;
-    float yf = logicalPos.y() * m_pageScaleFactor;
-
-    return IntPoint(static_cast<unsigned>(xf), static_cast<unsigned>(yf));
+    return IntSize(width, height);
 }
 
 const SecurityOrigin& HTMLCanvasElement::securityOrigin() const
diff --git a/WebCore/html/HTMLCanvasElement.h b/WebCore/html/HTMLCanvasElement.h
index d9b7736..1081c33 100644
--- a/WebCore/html/HTMLCanvasElement.h
+++ b/WebCore/html/HTMLCanvasElement.h
@@ -107,7 +107,7 @@ public:
 
     IntRect convertLogicalToDevice(const FloatRect&) const;
     IntSize convertLogicalToDevice(const FloatSize&) const;
-    IntPoint convertLogicalToDevice(const FloatPoint&) const;
+    IntSize convertToValidDeviceSize(float width, float height) const;
 
     const SecurityOrigin& securityOrigin() const;
     void setOriginTainted() { m_originClean = false; }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list