Title: [199473] releases/WebKitGTK/webkit-2.12
Revision
199473
Author
[email protected]
Date
2016-04-13 06:25:41 -0700 (Wed, 13 Apr 2016)

Log Message

Merge r198958 - putImageData leaves visible artifacts on retina display
https://bugs.webkit.org/show_bug.cgi?id=156039
<rdar://problem/25482243>

Reviewed by Simon Fraser.

Inflate the repaint rect to cover anti-aliasing bits.

Source/WebCore:

Test: fast/canvas/hidpi-repaint-on-retina-leaves-bits-behind.html

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::didDraw):

LayoutTests:

* fast/canvas/hidpi-repaint-on-retina-leaves-bits-behind-expected.html: Added.
* fast/canvas/hidpi-repaint-on-retina-leaves-bits-behind.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog (199472 => 199473)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog	2016-04-13 13:24:37 UTC (rev 199472)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog	2016-04-13 13:25:41 UTC (rev 199473)
@@ -1,3 +1,16 @@
+2016-03-31  Zalan Bujtas  <[email protected]>
+
+        putImageData leaves visible artifacts on retina display
+        https://bugs.webkit.org/show_bug.cgi?id=156039
+        <rdar://problem/25482243>
+
+        Reviewed by Simon Fraser.
+
+        Inflate the repaint rect to cover anti-aliasing bits.
+
+        * fast/canvas/hidpi-repaint-on-retina-leaves-bits-behind-expected.html: Added.
+        * fast/canvas/hidpi-repaint-on-retina-leaves-bits-behind.html: Added.
+
 2016-03-31  Daniel Bates  <[email protected]>
 
         REGRESSION (r195605): ASSERTION FAILED: !NoEventDispatchAssertion::isEventDispatchForbidden()

Added: releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/hidpi-repaint-on-retina-leaves-bits-behind-expected.html (0 => 199473)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/hidpi-repaint-on-retina-leaves-bits-behind-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/hidpi-repaint-on-retina-leaves-bits-behind-expected.html	2016-04-13 13:25:41 UTC (rev 199473)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we don't leave bits behind on the canvas context.</title>
+</head>
+<body>
+</body>
+</html>
\ No newline at end of file

Added: releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/hidpi-repaint-on-retina-leaves-bits-behind.html (0 => 199473)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/hidpi-repaint-on-retina-leaves-bits-behind.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/hidpi-repaint-on-retina-leaves-bits-behind.html	2016-04-13 13:25:41 UTC (rev 199473)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we don't leave bits behind on the canvas context.</title>
+<style>
+</style>
+</head>
+<body>
+<canvas style="width: 100px; height: 100px" id="canvas" width="100" height="100"></canvas>
+<canvas style="width: 200px; height: 200px" id="stretchedCanvas" width="100" height="100"></canvas>
+<script>
+    if (window.testRunner)
+        testRunner.waitUntilDone();
+    var ctx = canvas.getContext("2d");
+    var stretchedCtx = stretchedCanvas.getContext("2d");
+	ctx.fillRect(1, 1, 50, 50);
+	stretchedCtx.fillRect(1, 1, 50, 50);
+    setTimeout(function() {
+		ctx.clearRect(1, 1, 50, 50);
+		stretchedCtx.clearRect(1, 1, 50, 50);
+		if (window.testRunner)
+		   testRunner.notifyDone();
+    }, 10);
+</script>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog (199472 => 199473)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog	2016-04-13 13:24:37 UTC (rev 199472)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog	2016-04-13 13:25:41 UTC (rev 199473)
@@ -1,3 +1,18 @@
+2016-03-31  Zalan Bujtas  <[email protected]>
+
+        putImageData leaves visible artifacts on retina display
+        https://bugs.webkit.org/show_bug.cgi?id=156039
+        <rdar://problem/25482243>
+
+        Reviewed by Simon Fraser.
+
+        Inflate the repaint rect to cover anti-aliasing bits.
+
+        Test: fast/canvas/hidpi-repaint-on-retina-leaves-bits-behind.html
+
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::didDraw):
+
 2016-04-01  Jiewen Tan  <[email protected]>
 
         WebKit should dispatchDidFailProvisionalLoad while loading invalid URLs

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/html/HTMLCanvasElement.cpp (199472 => 199473)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/html/HTMLCanvasElement.cpp	2016-04-13 13:24:37 UTC (rev 199472)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/html/HTMLCanvasElement.cpp	2016-04-13 13:25:41 UTC (rev 199473)
@@ -305,9 +305,13 @@
 {
     clearCopiedImage();
 
+    FloatRect dirtyRect = rect;
     if (RenderBox* ro = renderBox()) {
         FloatRect destRect = ro->contentBoxRect();
-        FloatRect r = mapRect(rect, FloatRect(0, 0, size().width(), size().height()), destRect);
+        // Inflate dirty rect to cover antialiasing on image buffers.
+        if (drawingContext() && drawingContext()->shouldAntialias())
+            dirtyRect.inflate(1);
+        FloatRect r = mapRect(dirtyRect, FloatRect(0, 0, size().width(), size().height()), destRect);
         r.intersect(destRect);
         if (r.isEmpty() || m_dirtyRect.contains(r))
             return;
@@ -315,8 +319,7 @@
         m_dirtyRect.unite(r);
         ro->repaintRectangle(enclosingIntRect(m_dirtyRect));
     }
-
-    notifyObserversCanvasChanged(rect);
+    notifyObserversCanvasChanged(dirtyRect);
 }
 
 void HTMLCanvasElement::notifyObserversCanvasChanged(const FloatRect& rect)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to