Title: [163382] trunk
Revision
163382
Author
stav...@adobe.com
Date
2014-02-04 09:27:52 -0800 (Tue, 04 Feb 2014)

Log Message

REGRESSION (r159609): Images are corrupted when hovering over buttons @ github.com
https://bugs.webkit.org/show_bug.cgi?id=127729

Reviewed by Antti Koivisto.

Source/WebCore:

When clipping a rect, the RenderLayer would not properly save the context when
the clipping rect is the same as the paint rect and the clipping rect
has radius.

Test: fast/regions/repaint/hover-border-radius.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::clipToRect):
(WebCore::RenderLayer::restoreClip):

LayoutTests:

Added test for the correct repainting of buttons with border radius when hovering.

* fast/regions/repaint/hover-border-radius-expected.txt: Added.
* fast/regions/repaint/hover-border-radius.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (163381 => 163382)


--- trunk/LayoutTests/ChangeLog	2014-02-04 16:48:13 UTC (rev 163381)
+++ trunk/LayoutTests/ChangeLog	2014-02-04 17:27:52 UTC (rev 163382)
@@ -1,3 +1,15 @@
+2014-02-04  Radu Stavila  <stav...@adobe.com>
+
+        REGRESSION (r159609): Images are corrupted when hovering over buttons @ github.com
+        https://bugs.webkit.org/show_bug.cgi?id=127729
+
+        Reviewed by Antti Koivisto.
+
+        Added test for the correct repainting of buttons with border radius when hovering.
+
+        * fast/regions/repaint/hover-border-radius-expected.txt: Added.
+        * fast/regions/repaint/hover-border-radius.html: Added.
+
 2014-02-04  Andrzej Badowski  <a.badow...@samsung.com>
 
         [EFL] Add expectations for two flaky media layout tests

Added: trunk/LayoutTests/fast/regions/repaint/hover-border-radius-expected.txt (0 => 163382)


--- trunk/LayoutTests/fast/regions/repaint/hover-border-radius-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/repaint/hover-border-radius-expected.txt	2014-02-04 17:27:52 UTC (rev 163382)
@@ -0,0 +1,17 @@
+This test passes if moving the cursor from one of the blue items to the other produces no repaint errors (such as cropping of one of the blue items).
+
+(repaint rects
+  (rect 49 84 350 215)
+  (rect 49 84 350 215)
+  (rect 49 84 350 215)
+  (rect 49 84 350 18)
+  (rect 49 84 350 215)
+  (rect 49 84 350 215)
+  (rect 49 84 350 215)
+  (rect 400 84 350 215)
+  (rect 400 84 350 215)
+  (rect 400 84 350 215)
+  (rect 49 84 350 18)
+  (rect 400 84 350 18)
+)
+

Added: trunk/LayoutTests/fast/regions/repaint/hover-border-radius.html (0 => 163382)


--- trunk/LayoutTests/fast/regions/repaint/hover-border-radius.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/repaint/hover-border-radius.html	2014-02-04 17:27:52 UTC (rev 163382)
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <script src=""
+
+    <style>
+      .page_body
+      {
+        border-bottom-left-radius: 5px;
+        overflow-x: hidden;
+        overflow-y: hidden;
+      }
+
+      li
+      {
+        background-color: lightblue;
+        margin-left: 1px;
+        border-top-left-radius: 5px;
+        float: left;
+        height: 215px;
+        overflow-x: hidden;
+        overflow-y: hidden;
+        position: relative;
+        width: 350px;
+      }
+
+      li:hover
+      {
+        background-color: red;
+      }
+    </style>
+
+    <script type="text/_javascript_">
+      function repaintTest() {
+        if(!window.testRunner)
+          return;
+
+        var first = document.getElementById("first");
+        var second = document.getElementById("second");
+
+        // hover the 1st item
+        var left = first.offsetLeft;
+        var top = first.offsetTop;
+        eventSender.mouseMoveTo(left + 20, top + 20);
+
+        // now hover the 2nd item
+        left = second.offsetLeft;
+        top = second.offsetTop;
+        eventSender.mouseMoveTo(left + 20, top + 20);
+      }
+    </script>
+
+  </head>
+
+  <body _onload_="runRepaintTest();">
+    <p>This test passes if moving the cursor from one of the blue items to the other produces no repaint errors (such as cropping of one of the blue items).
+    <div class="page_body">
+      <ul>
+        <li id="first"></li>
+        <li id="second"></li>
+      </ul>
+    </div>
+  </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (163381 => 163382)


--- trunk/Source/WebCore/ChangeLog	2014-02-04 16:48:13 UTC (rev 163381)
+++ trunk/Source/WebCore/ChangeLog	2014-02-04 17:27:52 UTC (rev 163382)
@@ -1,3 +1,20 @@
+2014-02-04  Radu Stavila  <stav...@adobe.com>
+
+        REGRESSION (r159609): Images are corrupted when hovering over buttons @ github.com
+        https://bugs.webkit.org/show_bug.cgi?id=127729
+
+        Reviewed by Antti Koivisto.
+
+        When clipping a rect, the RenderLayer would not properly save the context when
+        the clipping rect is the same as the paint rect and the clipping rect
+        has radius.
+
+        Test: fast/regions/repaint/hover-border-radius.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::clipToRect):
+        (WebCore::RenderLayer::restoreClip):
+
 2014-02-04  Ryuan Choi  <ryuan.c...@samsung.com>
 
         [CMAKE] Remove workaround for GCC 4.6

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (163381 => 163382)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-02-04 16:48:13 UTC (rev 163381)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-02-04 17:27:52 UTC (rev 163382)
@@ -3563,7 +3563,7 @@
 void RenderLayer::clipToRect(RenderLayer* rootLayer, GraphicsContext* context, const LayoutRect& paintDirtyRect, const ClipRect& clipRect,
                              BorderRadiusClippingRule rule)
 {
-    if (clipRect.rect() != paintDirtyRect) {
+    if (clipRect.rect() != paintDirtyRect || clipRect.hasRadius()) {
         context->save();
         context->clip(pixelSnappedIntRect(clipRect.rect()));
     }
@@ -3588,7 +3588,7 @@
 
 void RenderLayer::restoreClip(GraphicsContext* context, const LayoutRect& paintDirtyRect, const ClipRect& clipRect)
 {
-    if (clipRect.rect() == paintDirtyRect)
+    if (clipRect.rect() == paintDirtyRect && !clipRect.hasRadius())
         return;
     context->restore();
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to