Title: [216366] releases/WebKitGTK/webkit-2.16
Revision
216366
Author
[email protected]
Date
2017-05-08 01:54:16 -0700 (Mon, 08 May 2017)

Log Message

Merge r215507 - Avoid repaints for invisible animations on tumblr.com/search/aww
https://bugs.webkit.org/show_bug.cgi?id=170986
<rdar://problem/28644580>

Reviewed by Andreas Kling.

Source/WebCore:

Test: fast/repaint/mutate-non-visible.html

* rendering/style/RenderStyle.cpp:
(WebCore::requiresPainting):
(WebCore::RenderStyle::changeRequiresRepaint):

    If an element is invisible it does not require repaint even if something else changes.

LayoutTests:

* fast/repaint/mutate-non-visible-expected.txt: Added.
* fast/repaint/mutate-non-visible.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog (216365 => 216366)


--- releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog	2017-05-08 08:51:21 UTC (rev 216365)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog	2017-05-08 08:54:16 UTC (rev 216366)
@@ -1,3 +1,14 @@
+2017-04-19  Antti Koivisto  <[email protected]>
+
+        Avoid repaints for invisible animations on tumblr.com/search/aww
+        https://bugs.webkit.org/show_bug.cgi?id=170986
+        <rdar://problem/28644580>
+
+        Reviewed by Andreas Kling.
+
+        * fast/repaint/mutate-non-visible-expected.txt: Added.
+        * fast/repaint/mutate-non-visible.html: Added.
+
 2017-04-18  Brent Fulgham  <[email protected]>
 
         Correct handling of isolatedWorld in event handling

Added: releases/WebKitGTK/webkit-2.16/LayoutTests/fast/repaint/mutate-non-visible-expected.txt (0 => 216366)


--- releases/WebKitGTK/webkit-2.16/LayoutTests/fast/repaint/mutate-non-visible-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/fast/repaint/mutate-non-visible-expected.txt	2017-05-08 08:54:16 UTC (rev 216366)
@@ -0,0 +1,7 @@
+Test repaint-only style changes in non-visible elements don't trigger repaints.
+(repaint rects
+  (rect 10 28 100 100)
+  (rect 10 28 100 100)
+  (rect 10 28 100 100)
+)
+

Added: releases/WebKitGTK/webkit-2.16/LayoutTests/fast/repaint/mutate-non-visible.html (0 => 216366)


--- releases/WebKitGTK/webkit-2.16/LayoutTests/fast/repaint/mutate-non-visible.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/fast/repaint/mutate-non-visible.html	2017-05-08 08:54:16 UTC (rev 216366)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.container {
+    width: 100px;
+    border: 2px solid black;
+}
+.test {
+    width: 100px;
+    height: 100px;
+    background-color: red;
+}
+.visibility-hidden { visibility: hidden; }
+.opacity-zero { opacity: 0; }
+</style>
+<script src=""
+<script>
+function repaintTest() {
+    var tests = document.querySelectorAll(".test");
+    for (let test of tests)
+        test.style.backgroundColor = "green";
+}
+</script>
+
+</head>
+<body _onload_="runRepaintTest()">
+
+Test repaint-only style changes in non-visible elements don't trigger repaints.
+
+<div class="container">
+<div class="test" ></div>
+<div class="test visibility-hidden"></div>
+<div class="test opacity-zero"></div>
+</div>
+
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog (216365 => 216366)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog	2017-05-08 08:51:21 UTC (rev 216365)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog	2017-05-08 08:54:16 UTC (rev 216366)
@@ -1,3 +1,19 @@
+2017-04-19  Antti Koivisto  <[email protected]>
+
+        Avoid repaints for invisible animations on tumblr.com/search/aww
+        https://bugs.webkit.org/show_bug.cgi?id=170986
+        <rdar://problem/28644580>
+
+        Reviewed by Andreas Kling.
+
+        Test: fast/repaint/mutate-non-visible.html
+
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::requiresPainting):
+        (WebCore::RenderStyle::changeRequiresRepaint):
+
+            If an element is invisible it does not require repaint even if something else changes.
+
 2017-04-18  Brent Fulgham  <[email protected]>
 
         JSEventListener::m_isolatedWorld should be a Ref

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/rendering/style/RenderStyle.cpp (216365 => 216366)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/rendering/style/RenderStyle.cpp	2017-05-08 08:51:21 UTC (rev 216365)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/rendering/style/RenderStyle.cpp	2017-05-08 08:54:16 UTC (rev 216366)
@@ -837,8 +837,20 @@
     return false;
 }
 
+static bool requiresPainting(const RenderStyle& style)
+{
+    if (style.visibility() == HIDDEN)
+        return false;
+    if (!style.opacity())
+        return false;
+    return true;
+}
+
 bool RenderStyle::changeRequiresRepaint(const RenderStyle& other, unsigned& changedContextSensitiveProperties) const
 {
+    if (!requiresPainting(*this) && !requiresPainting(other))
+        return false;
+
     if (m_inheritedFlags.visibility != other.m_inheritedFlags.visibility
         || m_inheritedFlags.printColorAdjust != other.m_inheritedFlags.printColorAdjust
         || m_inheritedFlags.insideLink != other.m_inheritedFlags.insideLink
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to