Title: [288017] trunk/Source/WebCore
Revision
288017
Author
[email protected]
Date
2022-01-14 07:23:24 -0800 (Fri, 14 Jan 2022)

Log Message

Reduce use of KeyframeEffect::targetElementOrPseudoElement()
https://bugs.webkit.org/show_bug.cgi?id=235228

Reviewed by Antti Koivisto.

The KeyframeEffect::targetElementOrPseudoElement() method is one of the few remaining places
in animation-related code where we deal with PseudoElement objects. As it turns out, a lot of
its remaning call sites are not actually making any use of PseudoElement and should just use
the simple target() method.

* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::invalidate):
* dom/Document.cpp:
(WebCore::Document::matchingAnimations):
* dom/Element.cpp:
(WebCore::Element::getAnimations):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (288016 => 288017)


--- trunk/Source/WebCore/ChangeLog	2022-01-14 15:21:32 UTC (rev 288016)
+++ trunk/Source/WebCore/ChangeLog	2022-01-14 15:23:24 UTC (rev 288017)
@@ -1,5 +1,24 @@
 2022-01-14  Antoine Quint  <[email protected]>
 
+        Reduce use of KeyframeEffect::targetElementOrPseudoElement()
+        https://bugs.webkit.org/show_bug.cgi?id=235228
+
+        Reviewed by Antti Koivisto.
+
+        The KeyframeEffect::targetElementOrPseudoElement() method is one of the few remaining places
+        in animation-related code where we deal with PseudoElement objects. As it turns out, a lot of
+        its remaning call sites are not actually making any use of PseudoElement and should just use
+        the simple target() method.
+
+        * animation/KeyframeEffect.cpp:
+        (WebCore::KeyframeEffect::invalidate):
+        * dom/Document.cpp:
+        (WebCore::Document::matchingAnimations):
+        * dom/Element.cpp:
+        (WebCore::Element::getAnimations):
+
+2022-01-14  Antoine Quint  <[email protected]>
+
         Stop forcing the creation of PseudoElement in KeyframeEffect
         https://bugs.webkit.org/show_bug.cgi?id=235225
 

Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (288016 => 288017)


--- trunk/Source/WebCore/animation/KeyframeEffect.cpp	2022-01-14 15:21:32 UTC (rev 288016)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp	2022-01-14 15:23:24 UTC (rev 288017)
@@ -1415,7 +1415,7 @@
 
 void KeyframeEffect::invalidate()
 {
-    LOG_WITH_STREAM(Animations, stream << "KeyframeEffect::invalidate on element " << ValueOrNull(targetElementOrPseudoElement()));
+    LOG_WITH_STREAM(Animations, stream << "KeyframeEffect::invalidate on element " << ValueOrNull(m_target.get()));
     invalidateElement(targetStyleable());
 }
 

Modified: trunk/Source/WebCore/dom/Document.cpp (288016 => 288017)


--- trunk/Source/WebCore/dom/Document.cpp	2022-01-14 15:21:32 UTC (rev 288016)
+++ trunk/Source/WebCore/dom/Document.cpp	2022-01-14 15:23:24 UTC (rev 288017)
@@ -8550,7 +8550,7 @@
         if (!animation->isRelevant() || !is<KeyframeEffect>(animation->effect()))
             continue;
 
-        auto* target = downcast<KeyframeEffect>(*animation->effect()).targetElementOrPseudoElement();
+        auto* target = downcast<KeyframeEffect>(*animation->effect()).target();
         if (target && target->isConnected() && &target->document() == this && function(*target))
             animations.append(animation);
     }

Modified: trunk/Source/WebCore/dom/Element.cpp (288016 => 288017)


--- trunk/Source/WebCore/dom/Element.cpp	2022-01-14 15:21:32 UTC (rev 288016)
+++ trunk/Source/WebCore/dom/Element.cpp	2022-01-14 15:23:24 UTC (rev 288017)
@@ -4711,8 +4711,6 @@
     // pseudo element.
     if (options && options->subtree) {
         return document().matchingAnimations([&] (Element& target) -> bool {
-            if (is<PseudoElement>(target))
-                return contains(downcast<PseudoElement>(target).hostElement());
             return contains(&target);
         });
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to