Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (289681 => 289682)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-12 01:12:05 UTC (rev 289681)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-12 01:15:31 UTC (rev 289682)
@@ -1,3 +1,16 @@
+2022-02-11 Commit Queue <[email protected]>
+
+ Unreviewed, reverting r289498.
+ https://bugs.webkit.org/show_bug.cgi?id=236534
+
+ Speedometer2 2% regression
+
+ Reverted changeset:
+
+ "Dialog element only animates once"
+ https://bugs.webkit.org/show_bug.cgi?id=236274
+ https://commits.webkit.org/r289498
+
2022-02-11 Chris Dumez <[email protected]>
Fix MIME type check for classic worker script fetches
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/dialog-animation-expected.txt (289681 => 289682)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/dialog-animation-expected.txt 2022-02-12 01:12:05 UTC (rev 289681)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/dialog-animation-expected.txt 2022-02-12 01:15:31 UTC (rev 289682)
@@ -1,3 +0,0 @@
-
-PASS CSS Animations tied to <dialog open> are canceled and restarted as the dialog is hidden and shown
-
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/dialog-animation.html (289681 => 289682)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/dialog-animation.html 2022-02-12 01:12:05 UTC (rev 289681)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/dialog-animation.html 2022-02-12 01:15:31 UTC (rev 289682)
@@ -1,44 +0,0 @@
-<!doctype html>
-<meta charset=utf-8>
-<title>CSS Animations on a <dialog></title>
-<link rel="help" href=""
-<script src=""
-<script src=""
-<script src=""
-<style>
-
-dialog[open] {
- animation: dialog-open-animation 1ms;
-}
-
-@keyframes dialog-open-animation {
- from { opacity: 0 }
-}
-
-</style>
-<div id="log"></div>
-<script>
-
-"use strict";
-
-promise_test(async t => {
- const dialog = addElement(t, "dialog");
-
- // Open the dialog a first time, this should trigger a CSS Animation.
- dialog.open = true;
- const animations = dialog.getAnimations();
- assert_equals(animations.length, 1, "As the <dialog> is shown intially an animation is started");
-
- await animations[0].finished;
-
- await waitForNextFrame();
-
- dialog.open = false;
- assert_equals(dialog.getAnimations().length, 0, "As the <dialog> is closed the animation is removed");
-
- await waitForNextFrame();
-
- dialog.open = true;
- assert_equals(dialog.getAnimations().length, 1, "As the <dialog> is shown again an animation is started again");
-}, "CSS Animations tied to <dialog open> are canceled and restarted as the dialog is hidden and shown");
-</script>
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/dialog-backdrop-animation-expected.txt (289681 => 289682)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/dialog-backdrop-animation-expected.txt 2022-02-12 01:12:05 UTC (rev 289681)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/dialog-backdrop-animation-expected.txt 2022-02-12 01:15:31 UTC (rev 289682)
@@ -1,3 +0,0 @@
-
-PASS CSS Animations on a <dialog> ::backdrop are canceled and restarted as the dialog is hidden and shown
-
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/dialog-backdrop-animation.html (289681 => 289682)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/dialog-backdrop-animation.html 2022-02-12 01:12:05 UTC (rev 289681)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/dialog-backdrop-animation.html 2022-02-12 01:15:31 UTC (rev 289682)
@@ -1,44 +0,0 @@
-<!doctype html>
-<meta charset=utf-8>
-<title>CSS Animations on a <dialog> ::backdrop</title>
-<link rel="help" href=""
-<script src=""
-<script src=""
-<script src=""
-<style>
-
-dialog[open]::backdrop {
- animation: dialog-backdrop-animation 1ms;
-}
-
-@keyframes dialog-backdrop-animation {
- from { opacity: 0 }
-}
-
-</style>
-<div id="log"></div>
-<script>
-
-"use strict";
-
-promise_test(async t => {
- const dialog = addElement(t, "dialog");
-
- // Open the dialog a first time, this should trigger a CSS Animation.
- dialog.showModal();
- const animations = dialog.getAnimations({ subtree: true });
- assert_equals(animations.length, 1, "As the <dialog> is shown intially an animation is started on its ::backdrop");
-
- await animations[0].finished;
-
- await waitForNextFrame();
-
- dialog.close();
- assert_equals(dialog.getAnimations({ subtree: true }).length, 0, "As the <dialog> is closed the animation is removed from its ::backdrop");
-
- await waitForNextFrame();
-
- dialog.showModal();
- assert_equals(dialog.getAnimations({ subtree: true }).length, 1, "As the <dialog> is shown again an animation is started again on its ::backdrop");
-}, "CSS Animations on a <dialog> ::backdrop are canceled and restarted as the dialog is hidden and shown");
-</script>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/support/testcommon.js (289681 => 289682)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/support/testcommon.js 2022-02-12 01:12:05 UTC (rev 289681)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/support/testcommon.js 2022-02-12 01:15:31 UTC (rev 289682)
@@ -87,46 +87,34 @@
}
/**
- * Appends an element to the document body.
+ * Appends a div to the document body.
*
* @param t The testharness.js Test object. If provided, this will be used
* to register a cleanup callback to remove the div when the test
* finishes.
*
- * @param name A string specifying the element name.
- *
* @param attrs A dictionary object with attribute names and values to set on
* the div.
*/
-function addElement(t, name, attrs) {
- var element = document.createElement(name);
+function addDiv(t, attrs) {
+ var div = document.createElement('div');
if (attrs) {
for (var attrName in attrs) {
- element.setAttribute(attrName, attrs[attrName]);
+ div.setAttribute(attrName, attrs[attrName]);
}
}
- document.body.appendChild(element);
+ document.body.appendChild(div);
if (t && typeof t.add_cleanup === 'function') {
- t.add_cleanup(() => element.remove());
+ t.add_cleanup(function() {
+ if (div.parentNode) {
+ div.remove();
+ }
+ });
}
- return element;
+ return div;
}
/**
- * Appends a div to the document body.
- *
- * @param t The testharness.js Test object. If provided, this will be used
- * to register a cleanup callback to remove the div when the test
- * finishes.
- *
- * @param attrs A dictionary object with attribute names and values to set on
- * the div.
- */
-function addDiv(t, attrs) {
- return addElement(t, "div", attrs);
-}
-
-/**
* Appends a style div to the document head.
*
* @param t The testharness.js Test object. If provided, this will be used
Modified: trunk/Source/WebCore/ChangeLog (289681 => 289682)
--- trunk/Source/WebCore/ChangeLog 2022-02-12 01:12:05 UTC (rev 289681)
+++ trunk/Source/WebCore/ChangeLog 2022-02-12 01:15:31 UTC (rev 289682)
@@ -1,3 +1,16 @@
+2022-02-11 Commit Queue <[email protected]>
+
+ Unreviewed, reverting r289498.
+ https://bugs.webkit.org/show_bug.cgi?id=236534
+
+ Speedometer2 2% regression
+
+ Reverted changeset:
+
+ "Dialog element only animates once"
+ https://bugs.webkit.org/show_bug.cgi?id=236274
+ https://commits.webkit.org/r289498
+
2022-02-11 Megan Gardner <[email protected]>
Enable grammar checking on Mac Catalyst.
Modified: trunk/Source/WebCore/dom/Element.cpp (289681 => 289682)
--- trunk/Source/WebCore/dom/Element.cpp 2022-02-12 01:12:05 UTC (rev 289681)
+++ trunk/Source/WebCore/dom/Element.cpp 2022-02-12 01:15:31 UTC (rev 289682)
@@ -3442,15 +3442,6 @@
layer.establishesTopLayerWillChange();
});
- // We need to call Styleable::fromRenderer() while this document is still contained
- // in Document::topLayerElements().
- if (auto* renderer = this->renderer()) {
- if (auto backdrop = renderer->backdropRenderer()) {
- if (auto styleable = Styleable::fromRenderer(*backdrop))
- styleable->cancelDeclarativeAnimations();
- }
- }
-
document().removeTopLayerElement(*this);
clearNodeFlag(NodeFlag::IsInTopLayer);
Modified: trunk/Source/WebCore/style/Styleable.cpp (289681 => 289682)
--- trunk/Source/WebCore/style/Styleable.cpp 2022-02-12 01:12:05 UTC (rev 289681)
+++ trunk/Source/WebCore/style/Styleable.cpp 2022-02-12 01:15:31 UTC (rev 289682)
@@ -215,6 +215,33 @@
removeDeclarativeAnimationFromListsForOwningElement(animation);
}
+static void removeCSSAnimationCreatedByMarkup(const Styleable& styleable, CSSAnimation& cssAnimation)
+{
+ styleable.animationsCreatedByMarkup().remove(&cssAnimation);
+
+ if (!styleable.hasKeyframeEffects())
+ return;
+
+ auto& keyframeEffectStack = styleable.ensureKeyframeEffectStack();
+ auto* cssAnimationList = keyframeEffectStack.cssAnimationList();
+ if (!cssAnimationList || cssAnimationList->isEmpty())
+ return;
+
+ auto& backingAnimation = cssAnimation.backingAnimation();
+ for (size_t i = 0; i < cssAnimationList->size(); ++i) {
+ if (cssAnimationList->animation(i) == backingAnimation) {
+ // It is important we do not make a clone of the Animation references contained
+ // within cssAnimationList since sorting animations in compareCSSAnimations()
+ // makes pointer comparisons to distinguish between backing animations of various
+ // CSSAnimation objects.
+ auto newAnimationList = cssAnimationList->shallowCopy();
+ newAnimationList->remove(i);
+ keyframeEffectStack.setCSSAnimationList(WTFMove(newAnimationList));
+ return;
+ }
+ }
+}
+
void Styleable::elementWasRemoved() const
{
cancelDeclarativeAnimations();
@@ -228,25 +255,17 @@
}
}
-static void clearCSSAnimationsForStyleable(const Styleable& styleable)
-{
- for (auto& cssAnimation : styleable.animationsCreatedByMarkup())
- cssAnimation->cancelFromStyle();
- if (auto* effectStack = styleable.keyframeEffectStack())
- effectStack->setCSSAnimationList(nullptr);
- styleable.setAnimationsCreatedByMarkup({ });
-}
-
void Styleable::cancelDeclarativeAnimations() const
{
if (auto* animations = this->animations()) {
for (auto& animation : *animations) {
- if (is<DeclarativeAnimation>(animation))
+ if (is<DeclarativeAnimation>(animation)) {
+ if (is<CSSAnimation>(animation))
+ removeCSSAnimationCreatedByMarkup(*this, downcast<CSSAnimation>(*animation));
downcast<DeclarativeAnimation>(*animation).cancelFromStyle();
+ }
}
}
-
- clearCSSAnimationsForStyleable(*this);
}
static bool keyframesRuleExistsForAnimation(Element& element, const Animation& animation, const String& animationName)
@@ -276,7 +295,9 @@
// In case this element is newly getting a "display: none" we need to cancel all of its animations and disregard new ones.
if (currentStyle && currentStyle->display() != DisplayType::None && newStyle.display() == DisplayType::None) {
- clearCSSAnimationsForStyleable(*this);
+ for (auto& cssAnimation : animationsCreatedByMarkup())
+ cssAnimation->cancelFromStyle();
+ keyframeEffectStack.setCSSAnimationList(nullptr);
return;
}