Title: [215507] trunk
- Revision
- 215507
- Author
- [email protected]
- Date
- 2017-04-19 05:15:37 -0700 (Wed, 19 Apr 2017)
Log Message
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: trunk/LayoutTests/ChangeLog (215506 => 215507)
--- trunk/LayoutTests/ChangeLog 2017-04-19 08:41:29 UTC (rev 215506)
+++ trunk/LayoutTests/ChangeLog 2017-04-19 12:15:37 UTC (rev 215507)
@@ -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 John Wilander <[email protected]>
Resource Load Statistics: Check both origins and cookieHostNames for domain matches in data removal
Added: trunk/LayoutTests/fast/repaint/mutate-non-visible-expected.txt (0 => 215507)
--- trunk/LayoutTests/fast/repaint/mutate-non-visible-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/repaint/mutate-non-visible-expected.txt 2017-04-19 12:15:37 UTC (rev 215507)
@@ -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: trunk/LayoutTests/fast/repaint/mutate-non-visible.html (0 => 215507)
--- trunk/LayoutTests/fast/repaint/mutate-non-visible.html (rev 0)
+++ trunk/LayoutTests/fast/repaint/mutate-non-visible.html 2017-04-19 12:15:37 UTC (rev 215507)
@@ -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: trunk/Source/WebCore/ChangeLog (215506 => 215507)
--- trunk/Source/WebCore/ChangeLog 2017-04-19 08:41:29 UTC (rev 215506)
+++ trunk/Source/WebCore/ChangeLog 2017-04-19 12:15:37 UTC (rev 215507)
@@ -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-19 Dean Jackson <[email protected]>
Non-muxable GPUs shouldn't allow offline rendering
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (215506 => 215507)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2017-04-19 08:41:29 UTC (rev 215506)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2017-04-19 12:15:37 UTC (rev 215507)
@@ -843,8 +843,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