Title: [149504] trunk
- Revision
- 149504
- Author
- [email protected]
- Date
- 2013-05-02 16:33:15 -0700 (Thu, 02 May 2013)
Log Message
border-radius clipping a canvas does not always clip
https://bugs.webkit.org/show_bug.cgi?id=113343
Source/WebCore:
Patch by Arnaud Renevier <[email protected]> on 2013-05-02
Reviewed by Simon Fraser.
clipToRect method clip context to clipRect, and then clip to rounded
rect if clipRect has a radius. But currently, clipToRect exit early if
clipToRect is equal to paintDirtyRect.
This patch allows clipping to rounded corner ever if clipToRect is
equal to paintDirtyRect.
Test: fast/overflow/border-radius-clipping-2.html
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::clipToRect):
LayoutTests:
Create a test that draws a canvas into a clipped overflown div with
radius corner. Then redraw that same thing a moment later. The canvas
should stay correctly clipped the second time.
Patch by Arnaud Renevier <[email protected]> on 2013-05-02
Reviewed by Simon Fraser.
* fast/overflow/border-radius-clipping-2-expected.html: Added.
* fast/overflow/border-radius-clipping-2.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (149503 => 149504)
--- trunk/LayoutTests/ChangeLog 2013-05-02 23:06:09 UTC (rev 149503)
+++ trunk/LayoutTests/ChangeLog 2013-05-02 23:33:15 UTC (rev 149504)
@@ -1,3 +1,17 @@
+2013-05-02 Arnaud Renevier <[email protected]>
+
+ border-radius clipping a canvas does not always clip
+ https://bugs.webkit.org/show_bug.cgi?id=113343
+
+ Create a test that draws a canvas into a clipped overflown div with
+ radius corner. Then redraw that same thing a moment later. The canvas
+ should stay correctly clipped the second time.
+
+ Reviewed by Simon Fraser.
+
+ * fast/overflow/border-radius-clipping-2-expected.html: Added.
+ * fast/overflow/border-radius-clipping-2.html: Added.
+
2013-05-02 Eric Carlson <[email protected]>
Caption menu does not include in-band captions
Added: trunk/LayoutTests/fast/overflow/border-radius-clipping-2-expected.html (0 => 149504)
--- trunk/LayoutTests/fast/overflow/border-radius-clipping-2-expected.html (rev 0)
+++ trunk/LayoutTests/fast/overflow/border-radius-clipping-2-expected.html 2013-05-02 23:33:15 UTC (rev 149504)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script>
+ function start() {
+ var canvas = document.getElementById("cnv");
+ var ctx = canvas.getContext("2d");
+ ctx.fillStyle = "#ff0000";
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+ }
+ </script>
+</head>
+<body _onload_="start()">
+
+<div id="box" style="position: absolute; width: 300px; height: 200px; border-radius: 40px; overflow: hidden;">
+<canvas id="cnv" width="400px" height="400px"></canvas>
+</div>
+
+</body>
+</html>
+
Added: trunk/LayoutTests/fast/overflow/border-radius-clipping-2.html (0 => 149504)
--- trunk/LayoutTests/fast/overflow/border-radius-clipping-2.html (rev 0)
+++ trunk/LayoutTests/fast/overflow/border-radius-clipping-2.html 2013-05-02 23:33:15 UTC (rev 149504)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script>
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+
+ function start() {
+ var canvas = document.getElementById("cnv");
+ var ctx = canvas.getContext("2d");
+
+ setTimeout(function() {
+ ctx.fillStyle = "#ff0000";
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }, 500);
+ }
+
+ </script>
+</head>
+<body _onload_="start()">
+
+<div id="box" style="position: absolute; width: 300px; height: 200px; border-radius: 40px; overflow: hidden;">
+<canvas id="cnv" width="400px" height="400px"></canvas>
+</div>
+
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (149503 => 149504)
--- trunk/Source/WebCore/ChangeLog 2013-05-02 23:06:09 UTC (rev 149503)
+++ trunk/Source/WebCore/ChangeLog 2013-05-02 23:33:15 UTC (rev 149504)
@@ -1,3 +1,22 @@
+2013-05-02 Arnaud Renevier <[email protected]>
+
+ border-radius clipping a canvas does not always clip
+ https://bugs.webkit.org/show_bug.cgi?id=113343
+
+ Reviewed by Simon Fraser.
+
+ clipToRect method clip context to clipRect, and then clip to rounded
+ rect if clipRect has a radius. But currently, clipToRect exit early if
+ clipToRect is equal to paintDirtyRect.
+
+ This patch allows clipping to rounded corner ever if clipToRect is
+ equal to paintDirtyRect.
+
+ Test: fast/overflow/border-radius-clipping-2.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::clipToRect):
+
2013-05-02 Eric Carlson <[email protected]>
Caption menu does not include in-band captions
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (149503 => 149504)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2013-05-02 23:06:09 UTC (rev 149503)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2013-05-02 23:33:15 UTC (rev 149504)
@@ -3514,15 +3514,15 @@
void RenderLayer::clipToRect(RenderLayer* rootLayer, GraphicsContext* context, const LayoutRect& paintDirtyRect, const ClipRect& clipRect,
BorderRadiusClippingRule rule)
{
- if (clipRect.rect() == paintDirtyRect)
- return;
- context->save();
- context->clip(pixelSnappedIntRect(clipRect.rect()));
+ if (clipRect.rect() != paintDirtyRect) {
+ context->save();
+ context->clip(pixelSnappedIntRect(clipRect.rect()));
+ }
+#ifndef DISABLE_ROUNDED_CORNER_CLIPPING
if (!clipRect.hasRadius())
return;
-#ifndef DISABLE_ROUNDED_CORNER_CLIPPING
// If the clip rect has been tainted by a border radius, then we have to walk up our layer chain applying the clips from
// any layers with overflow. The condition for being able to apply these clips is that the overflow object be in our
// containing block chain so we check that also.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes