Title: [285256] trunk
- Revision
- 285256
- Author
- [email protected]
- Date
- 2021-11-04 01:57:49 -0700 (Thu, 04 Nov 2021)
Log Message
REGRESSION (r268932): CPU usage higher than expected with sibling elements running WebAnimations
https://bugs.webkit.org/show_bug.cgi?id=228833
<rdar://problem/81573075>
Reviewed by Antti Koivisto.
Source/WebCore:
Test: webanimations/no-style-updates-for-animated-sibling-elements-accelerated.html
Elements that have any type of animations, and not just CSS Transitions and CSS Animations,
should not be eligible for style sharing.
* style/StyleSharingResolver.cpp:
(WebCore::Style::SharingResolver::canShareStyleWithElement const):
LayoutTests:
Add a new test that checks that accelerated animations on sibling elements do not yield style updates.
* platform/win/TestExpectations:
* webanimations/no-style-updates-for-animated-sibling-elements-accelerated-expected.txt: Added.
* webanimations/no-style-updates-for-animated-sibling-elements-accelerated.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (285255 => 285256)
--- trunk/LayoutTests/ChangeLog 2021-11-04 08:51:14 UTC (rev 285255)
+++ trunk/LayoutTests/ChangeLog 2021-11-04 08:57:49 UTC (rev 285256)
@@ -1,3 +1,17 @@
+2021-11-03 Antoine Quint <[email protected]>
+
+ REGRESSION (r268932): CPU usage higher than expected with sibling elements running WebAnimations
+ https://bugs.webkit.org/show_bug.cgi?id=228833
+ <rdar://problem/81573075>
+
+ Reviewed by Antti Koivisto.
+
+ Add a new test that checks that accelerated animations on sibling elements do not yield style updates.
+
+ * platform/win/TestExpectations:
+ * webanimations/no-style-updates-for-animated-sibling-elements-accelerated-expected.txt: Added.
+ * webanimations/no-style-updates-for-animated-sibling-elements-accelerated.html: Added.
+
2021-11-04 Martin Robinson <[email protected]>
implement transform: perspective(none)
Modified: trunk/LayoutTests/platform/win/TestExpectations (285255 => 285256)
--- trunk/LayoutTests/platform/win/TestExpectations 2021-11-04 08:51:14 UTC (rev 285255)
+++ trunk/LayoutTests/platform/win/TestExpectations 2021-11-04 08:57:49 UTC (rev 285256)
@@ -4750,3 +4750,5 @@
webkit.org/b/232319 fast/ruby/before-block-doesnt-crash.html [ Pass Failure ]
webkit.org/b/232321 imported/mozilla/svg/viewBox-and-pattern-03.svg [ Pass Crash ]
+
+webkit.org/b/232703 webanimations/no-style-updates-for-animated-sibling-elements-accelerated.html [ Failure ]
Added: trunk/LayoutTests/webanimations/no-style-updates-for-animated-sibling-elements-accelerated-expected.txt (0 => 285256)
--- trunk/LayoutTests/webanimations/no-style-updates-for-animated-sibling-elements-accelerated-expected.txt (rev 0)
+++ trunk/LayoutTests/webanimations/no-style-updates-for-animated-sibling-elements-accelerated-expected.txt 2021-11-04 08:57:49 UTC (rev 285256)
@@ -0,0 +1,3 @@
+
+PASS There should not be style updates while accelerated JS-originated animations are running on sibling elements with the same CSS class.
+
Added: trunk/LayoutTests/webanimations/no-style-updates-for-animated-sibling-elements-accelerated.html (0 => 285256)
--- trunk/LayoutTests/webanimations/no-style-updates-for-animated-sibling-elements-accelerated.html (rev 0)
+++ trunk/LayoutTests/webanimations/no-style-updates-for-animated-sibling-elements-accelerated.html 2021-11-04 08:57:49 UTC (rev 285256)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+
+.animated {
+ width: 100px;
+ height: 100px;
+ position: absolute;
+ background-color: black;
+}
+
+</style>
+</head>
+<body>
+<script src=""
+<script src=""
+<div class="animated"></div>
+<div class="animated"></div>
+<script>
+
+promise_test(async () => {
+ for (let element of document.querySelectorAll(".animated"))
+ element.animate({ transform: ["translateX(0)", "translateX(100px)"] }, { duration: 1000, iterations: Infinity });
+
+ // Wait a few frames to make sure the accelerated animations have started.
+ await new Promise(requestAnimationFrame);
+ await new Promise(requestAnimationFrame);
+ await new Promise(requestAnimationFrame);
+
+ window.internals.startTrackingStyleRecalcs();
+
+ // Wait a few more frames to allow time for a style update to occur if the running animations would have triggered one.
+ await new Promise(requestAnimationFrame);
+ await new Promise(requestAnimationFrame);
+ await new Promise(requestAnimationFrame);
+
+ assert_equals(window.internals.styleRecalcCount(), 0);
+}, "There should not be style updates while accelerated JS-originated animations are running on sibling elements with the same CSS class.");
+
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (285255 => 285256)
--- trunk/Source/WebCore/ChangeLog 2021-11-04 08:51:14 UTC (rev 285255)
+++ trunk/Source/WebCore/ChangeLog 2021-11-04 08:57:49 UTC (rev 285256)
@@ -1,3 +1,19 @@
+2021-11-03 Antoine Quint <[email protected]>
+
+ REGRESSION (r268932): CPU usage higher than expected with sibling elements running WebAnimations
+ https://bugs.webkit.org/show_bug.cgi?id=228833
+ <rdar://problem/81573075>
+
+ Reviewed by Antti Koivisto.
+
+ Test: webanimations/no-style-updates-for-animated-sibling-elements-accelerated.html
+
+ Elements that have any type of animations, and not just CSS Transitions and CSS Animations,
+ should not be eligible for style sharing.
+
+ * style/StyleSharingResolver.cpp:
+ (WebCore::Style::SharingResolver::canShareStyleWithElement const):
+
2021-11-04 Martin Robinson <[email protected]>
implement transform: perspective(none)
Modified: trunk/Source/WebCore/style/StyleSharingResolver.cpp (285255 => 285256)
--- trunk/Source/WebCore/style/StyleSharingResolver.cpp 2021-11-04 08:51:14 UTC (rev 285255)
+++ trunk/Source/WebCore/style/StyleSharingResolver.cpp 2021-11-04 08:57:49 UTC (rev 285256)
@@ -260,7 +260,7 @@
if (isControl && !canShareStyleWithControl(downcast<HTMLFormControlElement>(element), downcast<HTMLFormControlElement>(candidateElement)))
return false;
- if (style->transitions() || style->animations())
+ if (candidateElement.hasKeyframeEffects(PseudoId::None))
return false;
// Turn off style sharing for elements that can gain layers for reasons outside of the style system.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes