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

mihaip at chromium.org mihaip at chromium.org
Wed Dec 22 15:59:16 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 213b792a427d072b0bd157a2476a26a47f83a4f0
Author: mihaip at chromium.org <mihaip at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 17 17:39:39 2010 +0000

    2010-11-17  Satish Sampath  <satish at chromium.org>
    
            Reviewed by Jeremy Orlow.
    
            Clear the speech input mock explicitly before each test.
            https://bugs.webkit.org/show_bug.cgi?id=49660
    
            * DumpRenderTree/chromium/LayoutTestController.cpp:
            (LayoutTestController::setMockSpeechInputResult):
            * DumpRenderTree/chromium/LayoutTestController.h:
            * DumpRenderTree/chromium/WebViewHost.cpp:
            (WebViewHost::speechInputController):
            (WebViewHost::reset): Invoke speech input mock's clearResults method.
            * DumpRenderTree/chromium/WebViewHost.h:
            (WebViewHost::speechInputControllerMock): Moved mock from LayoutTestController.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72214 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 6639388..f8c3f61 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -69,6 +69,21 @@
 
         Reviewed by Tony Chang.
 
+        Rebaseline server: compute diffs client-side
+        https://bugs.webkit.org/show_bug.cgi?id=49640
+        
+        The image diff output from the DRT is pretty bad on some ports (at
+        least the Mac one), so it's better to compute diffs on the client by
+        using <canvas>.
+
+        * Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html:
+        * Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css:
+        * Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js:
+
+2010-11-16  Mihai Parparita  <mihaip at chromium.org>
+
+        Reviewed by Tony Chang.
+
         Rebaseline server: display test results
         https://bugs.webkit.org/show_bug.cgi?id=49626
         
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html
index 142e164..afd2fff 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html
@@ -85,7 +85,7 @@
     <tr>
       <td><img id="expected-image"></td>
       <td><img id="actual-image"></td>
-      <td><img id="diff-image"></td>
+      <td><canvas id="diff-canvas" width="800" height="600"></canvas></td>
     </tr>
   </tbody>
   <tbody id="text-outputs" style="display: none">
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css
index 329f95f..bd2cd98 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css
@@ -113,7 +113,8 @@ a, .link {
   vertical-align: top;
 }
 
-#image-outputs img {
+#image-outputs img,
+#image-outputs canvas {
   width: 800px;
   height: 600px;
   border: solid 1px #ddd;
@@ -121,6 +122,11 @@ a, .link {
   -webkit-user-drag: none;
 }
 
+#image-outputs img.loading,
+#image-outputs canvas.loading {
+  opacity: .5;
+}
+
 #image-outputs #actual-image {
   margin: 0 1em;
 }
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js
index 5387cd9..21d18b7 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js
@@ -232,15 +232,115 @@ function getTestResultUrl(testName, mode)
     return '/test_result?test=' + testName + '&mode=' + mode;
 }
 
+var currentExpectedImageTest;
+var currentActualImageTest;
+
 function displayImageResults(testName)
 {
-    function displayImageResult(mode) {
-        $(mode).src = getTestResultUrl(testName, mode);
+    if (currentExpectedImageTest == currentActualImageTest
+        && currentExpectedImageTest == testName) {
+        return;
+    }
+    
+    function displayImageResult(mode, callback) {
+        var image = $(mode);
+        image.className = 'loading';
+        image.src = getTestResultUrl(testName, mode);
+        image.onload = function() {
+            image.className = '';
+            callback();
+            updateImageDiff();
+        };
     }
 
-    displayImageResult('expected-image');
-    displayImageResult('actual-image');
-    displayImageResult('diff-image');
+    displayImageResult(
+        'expected-image',
+        function() { currentExpectedImageTest = testName; });
+    displayImageResult(
+        'actual-image',
+        function() { currentActualImageTest = testName; });
+
+    $('diff-canvas').className = 'loading';
+    $('diff-canvas').style.display = '';
+}
+
+/**
+ * Computes a graphical a diff between the expected and actual images by
+ * rendering each to a canvas, getting the image data, and comparing the RGBA
+ * components of each pixel. The output is put into the diff canvas, with
+ * identical pixels appearing at 12.5% opacity and different pixels being
+ * highlighted in red.
+ */
+function updateImageDiff() {
+    if (currentExpectedImageTest != currentActualImageTest)
+        return;
+        
+    var expectedImage = $('expected-image');
+    var actualImage = $('actual-image');
+    
+    function getImageData(image) {
+        var imageCanvas = document.createElement('canvas');
+        imageCanvas.width = image.width;
+        imageCanvas.height = image.height;
+        imageCanvasContext = imageCanvas.getContext('2d');
+        
+        imageCanvasContext.fillStyle = 'rgba(255, 255, 255, 1)';
+        imageCanvasContext.fillRect(
+            0, 0, image.width, image.height);
+            
+        imageCanvasContext.drawImage(image, 0, 0);
+        return imageCanvasContext.getImageData(
+            0, 0, image.width, image.height);  
+    }
+    
+    var expectedImageData = getImageData(expectedImage);
+    var actualImageData = getImageData(actualImage);
+    
+    var diffCanvas = $('diff-canvas');
+    var diffCanvasContext = diffCanvas.getContext('2d');
+    var diffImageData =
+        diffCanvasContext.createImageData(diffCanvas.width, diffCanvas.height);
+  
+    // Avoiding property lookups for all these during the per-pixel loop below
+    // provides a significant performance benefit.
+    var expectedWidth = expectedImage.width;
+    var expectedHeight = expectedImage.height;
+    var expected = expectedImageData.data;
+    
+    var actualWidth = actualImage.width;
+    var actual = actualImageData.data;
+  
+    var diffWidth = diffImageData.width;
+    var diff = diffImageData.data;
+    
+    for (var x = 0; x < expectedWidth; x++) {
+        for (var y = 0; y < expectedHeight; y++) {
+            var expectedOffset = (y * expectedWidth + x) * 4;
+            var actualOffset = (y * actualWidth + x) * 4;
+            var diffOffset = (y * diffWidth + x) * 4;
+            if (expected[expectedOffset] != actual[actualOffset] ||
+                expected[expectedOffset + 1] != actual[actualOffset + 1] ||
+                expected[expectedOffset + 2] != actual[actualOffset + 2] ||
+                expected[expectedOffset + 3] != actual[actualOffset + 3]) {
+                diff[diffOffset] = 255;
+                diff[diffOffset + 1] = 0;
+                diff[diffOffset + 2] = 0;
+                diff[diffOffset + 3] = 255;
+            } else {
+                diff[diffOffset] = expected[expectedOffset];
+                diff[diffOffset + 1] = expected[expectedOffset + 1];
+                diff[diffOffset + 2] = expected[expectedOffset + 2];
+                diff[diffOffset + 3] = 32;
+            }
+        }
+    }
+    
+    diffCanvasContext.putImageData(
+        diffImageData,
+        0, 0,
+        0, 0,
+        diffImageData.width, diffImageData.height);
+    diffCanvas.className = '';
 }
 
 function displayTextResults(testName)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list