Animated SVGs do not clear previous frame completely in hidpi mode.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jul 2012 20:43:32 +0000 (20:43 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jul 2012 20:43:32 +0000 (20:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=92395

Patch by Varun Jain <varunjain@chromium.org> on 2012-07-27
Reviewed by Darin Adler.

Source/WebCore:

The rect thats is cleared in subsequent frames needed to be scaled with device scale.

Test: svg/as-image/animated-svg-repaints-completely-in-hidpi.html

* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::drawSVGToImageBuffer):

LayoutTests:

* platform/chromium/TestExpectations:
* platform/mac/svg/as-image/animated-svg-repaints-completely-in-hidpi-expected.png: Added.
* platform/mac/svg/as-image/animated-svg-repaints-completely-in-hidpi-expected.txt: Added.
* svg/as-image/animated-svg-repaints-completely-in-hidpi.html: Added.
* svg/as-image/resources/animated-rect-fixed-size-3.svg: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123914 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/mac/svg/as-image/animated-svg-repaints-completely-in-hidpi-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/svg/as-image/animated-svg-repaints-completely-in-hidpi-expected.txt [new file with mode: 0644]
LayoutTests/svg/as-image/animated-svg-repaints-completely-in-hidpi.html [new file with mode: 0644]
LayoutTests/svg/as-image/resources/animated-rect-fixed-size-3.svg [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/svg/graphics/SVGImage.cpp

index ecd9f26..4f1fa81 100644 (file)
@@ -1,3 +1,16 @@
+2012-07-27  Varun Jain  <varunjain@chromium.org>
+
+        Animated SVGs do not clear previous frame completely in hidpi mode.
+        https://bugs.webkit.org/show_bug.cgi?id=92395
+
+        Reviewed by Darin Adler.
+
+        * platform/chromium/TestExpectations:
+        * platform/mac/svg/as-image/animated-svg-repaints-completely-in-hidpi-expected.png: Added.
+        * platform/mac/svg/as-image/animated-svg-repaints-completely-in-hidpi-expected.txt: Added.
+        * svg/as-image/animated-svg-repaints-completely-in-hidpi.html: Added.
+        * svg/as-image/resources/animated-rect-fixed-size-3.svg: Added.
+
 2012-07-27  Beth Dakin  <bdakin@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=92327
index 70c4d28..e8cf663 100644 (file)
@@ -2816,6 +2816,9 @@ BUGWK70210 : fast/js/stack-overflow-arrity-catch.html = TEXT
 // These all will timeout, because we are lacking a hook that signals test completion.
 BUGWK70066 SKIP : svg/as-image/image-respects-deviceScaleFactor.html = TIMEOUT
 
+// SVG painting in high DPI mode is broken in DRT.
+BUGWK92511 SKIP : svg/as-image/animated-svg-repaints-completely-in-hidpi.html = IMAGE+TEXT
+
 // Flaky tests from ~r97647
 BUGWK70298 MAC : fast/table/border-collapsing/cached-69296.html = IMAGE
 
diff --git a/LayoutTests/platform/mac/svg/as-image/animated-svg-repaints-completely-in-hidpi-expected.png b/LayoutTests/platform/mac/svg/as-image/animated-svg-repaints-completely-in-hidpi-expected.png
new file mode 100644 (file)
index 0000000..87088d6
Binary files /dev/null and b/LayoutTests/platform/mac/svg/as-image/animated-svg-repaints-completely-in-hidpi-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/as-image/animated-svg-repaints-completely-in-hidpi-expected.txt b/LayoutTests/platform/mac/svg/as-image/animated-svg-repaints-completely-in-hidpi-expected.txt
new file mode 100644 (file)
index 0000000..55da858
--- /dev/null
@@ -0,0 +1,11 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 371x18
+          text run at (0,0) width 371: "Images should redraw correctly when SVG animation runs"
+      RenderBlock (anonymous) at (0,34) size 784x500
+        RenderImage {IMG} at (10,10) size 480x480
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/svg/as-image/animated-svg-repaints-completely-in-hidpi.html b/LayoutTests/svg/as-image/animated-svg-repaints-completely-in-hidpi.html
new file mode 100644 (file)
index 0000000..404e9fd
--- /dev/null
@@ -0,0 +1,33 @@
+<html>
+<head>
+    <script src="../../fast/repaint/resources/repaint.js" type="text/javascript"></script>
+    <script type="text/javascript">
+    function startTest()
+    {
+        if (!window.layoutTestController)
+            return;
+        layoutTestController.waitUntilDone();
+        layoutTestController.setBackingScaleFactor(2, runRepaintTest);
+    }
+    function repaintTest()
+    {
+        if (!window.layoutTestController)
+            return;
+        // The animation lasts 100ms. Wait 200ms for the repaint.
+        setTimeout(function() {
+            layoutTestController.notifyDone();
+        }, 200);
+    } 
+    </script>
+    <style type="text/css" media="screen">
+      img {
+        margin: 10px;
+      }
+    </style>
+</head>
+<body onload="startTest()">
+    <p>Images should redraw correctly when SVG animation runs</p>
+    <!-- Don't load animated-rect-fixed-size.svg, it will already be loaded, and the animation already ran if animated-svg-as-image-no-fixed-intrinsic-size.html runs before this test! -->
+    <img src="resources/animated-rect-fixed-size-3.svg">
+</body>
+</html>
diff --git a/LayoutTests/svg/as-image/resources/animated-rect-fixed-size-3.svg b/LayoutTests/svg/as-image/resources/animated-rect-fixed-size-3.svg
new file mode 100644 (file)
index 0000000..c8b138d
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+
+<!--======================================================================-->
+<!--=  Copyright 2000 World Wide Web Consortium, (Massachusetts          =-->
+<!--=  Institute of Technology, Institut National de Recherche en        =-->
+<!--=  Informatique et en Automatique, Keio University). All Rights      =-->
+<!--=  Reserved. See http://www.w3.org/Consortium/Legal/.                =-->
+<!--======================================================================-->
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"  id="svg-root" width="480px" height="480px" viewBox="0 0 480 360" version="1.1" baseProfile="tiny">
+   <SVGTestCase xmlns="http://www.w3.org/2000/02/svg/testsuite/description/">
+   </SVGTestCase>
+   <title id="test-title">animate-elem-14-t</title>
+   <desc id="test-desc">Test possible values for 'keyTimes'</desc>
+   <g id="test-body-content">
+      <g xml:space="preserve" font-family="Arial" font-size="13.5" stroke-width="3" >
+         <g transform="translate(150,140)">
+            <text font-size="36" x="-140" y="140">Time (s):</text>
+            <text font-size="36" x="290" y="140">0</text>
+            <line x1="300" y1="0" x2="300" y2="100" fill="none" stroke="#880000" />
+            <text font-size="36" x="20" y="140">6</text>
+            <line x1="30" y1="0" x2="30" y2="100" fill="none" stroke="#880000" />
+            <rect x="0" y="0" width="300" height="80" fill="#44AAFF" stroke="#880088" stroke-width="4" >
+               <set attributeName="width" to="30" begin="0.1s" fill="freeze"/> 
+            </rect>
+         </g>
+      </g>
+   </g>
+   <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
+</svg>
+
index f5d46ac..ac08dea 100644 (file)
@@ -1,3 +1,17 @@
+2012-07-27  Varun Jain  <varunjain@chromium.org>
+
+        Animated SVGs do not clear previous frame completely in hidpi mode.
+        https://bugs.webkit.org/show_bug.cgi?id=92395
+
+        Reviewed by Darin Adler.
+
+        The rect thats is cleared in subsequent frames needed to be scaled with device scale.
+
+        Test: svg/as-image/animated-svg-repaints-completely-in-hidpi.html
+
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::drawSVGToImageBuffer):
+
 2012-07-27  Scott Graham  <scottmg@chromium.org>
 
         Fix COMPILE_ASSERT for InlineFlowBox growing
index c918c0e..57c579d 100644 (file)
@@ -164,12 +164,13 @@ void SVGImage::drawSVGToImageBuffer(ImageBuffer* buffer, const IntSize& size, fl
 
     // Eventually clear image buffer.
     IntRect rect(IntPoint(), size);
-    if (shouldClear == ClearImageBuffer)
-        buffer->context()->clearRect(rect);
 
     FloatRect scaledRect(rect);
     scaledRect.scale(scale);
 
+    if (shouldClear == ClearImageBuffer)
+        buffer->context()->clearRect(enclosingIntRect(scaledRect));
+
     // Draw SVG on top of ImageBuffer.
     draw(buffer->context(), enclosingIntRect(scaledRect), rect, ColorSpaceDeviceRGB, CompositeSourceOver);