Diff
Modified: trunk/LayoutTests/ChangeLog (281127 => 281128)
--- trunk/LayoutTests/ChangeLog 2021-08-17 04:52:06 UTC (rev 281127)
+++ trunk/LayoutTests/ChangeLog 2021-08-17 05:34:02 UTC (rev 281128)
@@ -1,3 +1,16 @@
+2021-08-16 Antti Koivisto <[email protected]>
+
+ REGRESSION (r275756): Accelerated animations freeze when invalidating layout with shadow dom
+ https://bugs.webkit.org/show_bug.cgi?id=228954
+ <rdar://problem/81750217>
+
+ Reviewed by Ryosuke Niwa.
+
+ Original test by Liam DeBeasi
+
+ * animations/shadow-host-child-change-expected.html: Added.
+ * animations/shadow-host-child-change.html: Added.
+
2021-08-16 Dean Jackson <[email protected]>
WebXR contexts have to use high-power GPUs
Added: trunk/LayoutTests/animations/shadow-host-child-change-expected.html (0 => 281128)
--- trunk/LayoutTests/animations/shadow-host-child-change-expected.html (rev 0)
+++ trunk/LayoutTests/animations/shadow-host-child-change-expected.html 2021-08-17 05:34:02 UTC (rev 281128)
@@ -0,0 +1,18 @@
+
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+ app-content {
+ display: block;
+ width: 100px;
+ height: 100px;
+ background: green;
+ transform: translateX(100px);
+ }
+ </style>
+ </head>
+ <body>
+ <app-content id=target>new text</app-content>
+ </body>
+</html>
Added: trunk/LayoutTests/animations/shadow-host-child-change.html (0 => 281128)
--- trunk/LayoutTests/animations/shadow-host-child-change.html (rev 0)
+++ trunk/LayoutTests/animations/shadow-host-child-change.html 2021-08-17 05:34:02 UTC (rev 281128)
@@ -0,0 +1,50 @@
+
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+ app-content {
+ display: block;
+ width: 100px;
+ height: 100px;
+ background: green;
+ animation: animation 10s linear forwards;
+ }
+ @keyframes animation {
+ from {
+ transform: translateX(0px);
+ }
+ 2% {
+ transform: translateX(100px);
+ }
+ to {
+ transform: translateX(100px);
+ }
+ }
+ </style>
+ </head>
+ <body>
+ <app-content id=target>old text</app-content>
+
+ <script>
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+
+ customElements.define('app-content', class extends HTMLElement {
+ constructor() {
+ super();
+
+ const root = this.attachShadow({ mode: 'open' });
+ root.innerHTML = `<slot></slot>`;
+ }
+ });
+
+ setTimeout(() => {
+ target.innerHTML = "new text"
+ }, 100);
+
+ if (window.testRunner)
+ setTimeout(() => testRunner.notifyDone(), 500);
+ </script>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (281127 => 281128)
--- trunk/Source/WebCore/ChangeLog 2021-08-17 04:52:06 UTC (rev 281127)
+++ trunk/Source/WebCore/ChangeLog 2021-08-17 05:34:02 UTC (rev 281128)
@@ -1,3 +1,25 @@
+2021-08-16 Antti Koivisto <[email protected]>
+
+ REGRESSION (r275756): Accelerated animations freeze when invalidating layout with shadow dom
+ https://bugs.webkit.org/show_bug.cgi?id=228954
+ <rdar://problem/81750217>
+
+ Reviewed by Ryosuke Niwa.
+
+ Test: animations/shadow-host-child-change.html
+
+ Tearing down the host renderer after slot assignments change cancels animations on it.
+
+ * dom/SlotAssignment.cpp:
+ (WebCore::SlotAssignment::didChangeSlot):
+ * rendering/updating/RenderTreeUpdater.cpp:
+ (WebCore::RenderTreeUpdater::tearDownRenderersAfterSlotChange):
+
+ Add a version that keeps the animations going on the teardown root.
+
+ (WebCore::RenderTreeUpdater::tearDownRenderers):
+ * rendering/updating/RenderTreeUpdater.h:
+
2021-08-16 Devin Rousso <[email protected]>
Web Share CanShare() should be called after transient activation check
Modified: trunk/Source/WebCore/dom/SlotAssignment.cpp (281127 => 281128)
--- trunk/Source/WebCore/dom/SlotAssignment.cpp 2021-08-17 04:52:06 UTC (rev 281127)
+++ trunk/Source/WebCore/dom/SlotAssignment.cpp 2021-08-17 05:34:02 UTC (rev 281128)
@@ -307,8 +307,8 @@
if (!slot)
return;
- RenderTreeUpdater::tearDownRenderers(*shadowRoot.host());
- shadowRoot.host()->invalidateStyleAndRenderersForSubtree();
+ RenderTreeUpdater::tearDownRenderersAfterSlotChange(*shadowRoot.host());
+ shadowRoot.host()->invalidateStyleForSubtree();
slot->assignedNodes.clear();
m_slotAssignmentsIsValid = false;
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp (281127 => 281128)
--- trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp 2021-08-17 04:52:06 UTC (rev 281127)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp 2021-08-17 05:34:02 UTC (rev 281128)
@@ -536,6 +536,16 @@
tearDownRenderers(root, TeardownType::Full, builder);
}
+void RenderTreeUpdater::tearDownRenderersAfterSlotChange(Element& host)
+{
+ ASSERT(host.shadowRoot());
+ auto* view = host.document().renderView();
+ if (!view)
+ return;
+ RenderTreeBuilder builder(*view);
+ tearDownRenderers(host, TeardownType::FullAfterSlotChange, builder);
+}
+
void RenderTreeUpdater::tearDownRenderer(Text& text)
{
auto* view = text.document().renderView();
@@ -560,6 +570,7 @@
auto pop = [&] (unsigned depth) {
while (teardownStack.size() > depth) {
auto& element = *teardownStack.takeLast();
+ auto styleable = Styleable::fromElement(element);
// Make sure we don't leave any renderers behind in nodes outside the composed tree.
if (element.shadowRoot())
@@ -566,19 +577,26 @@
tearDownLeftoverShadowHostChildren(element, builder);
switch (teardownType) {
+ case TeardownType::FullAfterSlotChange:
+ if (&element == &root) {
+ // Keep animations going on the host.
+ styleable.willChangeRenderer();
+ break;
+ }
+ FALLTHROUGH;
case TeardownType::Full:
+ if (document.renderTreeBeingDestroyed())
+ styleable.cancelDeclarativeAnimations();
+ element.clearHoverAndActiveStatusBeforeDetachingRenderer();
+ break;
case TeardownType::RendererUpdateCancelingAnimations:
- if (document.renderTreeBeingDestroyed() || teardownType == TeardownType::RendererUpdateCancelingAnimations)
- Styleable::fromElement(element).cancelDeclarativeAnimations();
+ styleable.cancelDeclarativeAnimations();
break;
case TeardownType::RendererUpdate:
- Styleable::fromElement(element).willChangeRenderer();
+ styleable.willChangeRenderer();
break;
}
- if (teardownType == TeardownType::Full)
- element.clearHoverAndActiveStatusBeforeDetachingRenderer();
-
GeneratedContent::removeBeforePseudoElement(element, builder);
GeneratedContent::removeAfterPseudoElement(element, builder);
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.h (281127 => 281128)
--- trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.h 2021-08-17 04:52:06 UTC (rev 281127)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.h 2021-08-17 05:34:02 UTC (rev 281128)
@@ -49,6 +49,7 @@
void commit(std::unique_ptr<const Style::Update>);
static void tearDownRenderers(Element&);
+ static void tearDownRenderersAfterSlotChange(Element& host);
static void tearDownRenderer(Text&);
private:
@@ -86,7 +87,8 @@
void popParent();
void popParentsToDepth(unsigned depth);
- enum class TeardownType { Full, RendererUpdate, RendererUpdateCancelingAnimations };
+ // FIXME: Use OptionSet.
+ enum class TeardownType { Full, FullAfterSlotChange, RendererUpdate, RendererUpdateCancelingAnimations };
static void tearDownRenderers(Element&, TeardownType, RenderTreeBuilder&);
static void tearDownTextRenderer(Text&, RenderTreeBuilder&);
static void tearDownLeftoverShadowHostChildren(Element&, RenderTreeBuilder&);