- Revision
- 269623
- Author
- [email protected]
- Date
- 2020-11-10 03:35:51 -0800 (Tue, 10 Nov 2020)
Log Message
[Web Animations] KeyframeEffect.pseudoElement does not return a valid string when targeting ::marker or ::first-letter
https://bugs.webkit.org/show_bug.cgi?id=218741
<rdar://problem/71229846>
Reviewed by Dean Jackson.
LayoutTests/imported/w3c:
Mark two new PASS results showing that KeyframeEffect.pseudoElement shows the correct value
when targeting ::marker or ::first-letter.
* web-platform-tests/web-animations/interfaces/Animatable/animate-expected.txt:
Source/WebCore:
We used to use PseudoElement::pseudoElementNameForEvents() to go from PseudoId to a String, but PseudoElement
only knows about ::before and ::after and not about valid pseudo-elements. We remove that method and create an
equivalent in WebAnimationUtilities that knows about all public pseudo-elements.
* animation/DeclarativeAnimation.cpp:
(WebCore::DeclarativeAnimation::enqueueDOMEvent):
* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::pseudoElement const):
* animation/WebAnimationUtilities.cpp:
(WebCore::pseudoIdAsString):
* animation/WebAnimationUtilities.h:
* dom/PseudoElement.cpp:
(WebCore::PseudoElement::pseudoElementNameForEvents): Deleted.
* dom/PseudoElement.h:
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (269622 => 269623)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-11-10 09:28:40 UTC (rev 269622)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-11-10 11:35:51 UTC (rev 269623)
@@ -1,3 +1,16 @@
+2020-11-10 Antoine Quint <[email protected]>
+
+ [Web Animations] KeyframeEffect.pseudoElement does not return a valid string when targeting ::marker or ::first-letter
+ https://bugs.webkit.org/show_bug.cgi?id=218741
+ <rdar://problem/71229846>
+
+ Reviewed by Dean Jackson.
+
+ Mark two new PASS results showing that KeyframeEffect.pseudoElement shows the correct value
+ when targeting ::marker or ::first-letter.
+
+ * web-platform-tests/web-animations/interfaces/Animatable/animate-expected.txt:
+
2020-11-09 Chris Dumez <[email protected]>
Unexpose obsolete HTMLAppletElement interface
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/animate-expected.txt (269622 => 269623)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/animate-expected.txt 2020-11-10 09:28:40 UTC (rev 269622)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/animate-expected.txt 2020-11-10 11:35:51 UTC (rev 269623)
@@ -143,8 +143,8 @@
PASS animate() with pseudoElement parameter creates an Animation object for ::first-line
PASS animate() with pseudoElement an Animation object targeting the correct pseudo-element
PASS animate() with pseudoElement without content creates an Animation object targeting the correct pseudo-element
-FAIL animate() with pseudoElement an Animation object targeting the correct pseudo-element for ::marker assert_equals: The returned Animation targets the correct selector expected "::marker" but got ""
-FAIL animate() with pseudoElement an Animation object targeting the correct pseudo-element for ::first-line assert_equals: The returned Animation targets the correct selector expected "::first-line" but got ""
+PASS animate() with pseudoElement an Animation object targeting the correct pseudo-element for ::marker
+PASS animate() with pseudoElement an Animation object targeting the correct pseudo-element for ::first-line
PASS animate() with a non-null invalid pseudoElement '' throws a SyntaxError
PASS animate() with a non-null invalid pseudoElement 'before' throws a SyntaxError
PASS animate() with a non-null invalid pseudoElement ':abc' throws a SyntaxError
Modified: trunk/Source/WebCore/ChangeLog (269622 => 269623)
--- trunk/Source/WebCore/ChangeLog 2020-11-10 09:28:40 UTC (rev 269622)
+++ trunk/Source/WebCore/ChangeLog 2020-11-10 11:35:51 UTC (rev 269623)
@@ -1,3 +1,26 @@
+2020-11-10 Antoine Quint <[email protected]>
+
+ [Web Animations] KeyframeEffect.pseudoElement does not return a valid string when targeting ::marker or ::first-letter
+ https://bugs.webkit.org/show_bug.cgi?id=218741
+ <rdar://problem/71229846>
+
+ Reviewed by Dean Jackson.
+
+ We used to use PseudoElement::pseudoElementNameForEvents() to go from PseudoId to a String, but PseudoElement
+ only knows about ::before and ::after and not about valid pseudo-elements. We remove that method and create an
+ equivalent in WebAnimationUtilities that knows about all public pseudo-elements.
+
+ * animation/DeclarativeAnimation.cpp:
+ (WebCore::DeclarativeAnimation::enqueueDOMEvent):
+ * animation/KeyframeEffect.cpp:
+ (WebCore::KeyframeEffect::pseudoElement const):
+ * animation/WebAnimationUtilities.cpp:
+ (WebCore::pseudoIdAsString):
+ * animation/WebAnimationUtilities.h:
+ * dom/PseudoElement.cpp:
+ (WebCore::PseudoElement::pseudoElementNameForEvents): Deleted.
+ * dom/PseudoElement.h:
+
2020-11-10 Martin Robinson <[email protected]>
Scroll-snap on the root aligns to the body margin edge, not the viewport edge
Modified: trunk/Source/WebCore/animation/DeclarativeAnimation.cpp (269622 => 269623)
--- trunk/Source/WebCore/animation/DeclarativeAnimation.cpp 2020-11-10 09:28:40 UTC (rev 269622)
+++ trunk/Source/WebCore/animation/DeclarativeAnimation.cpp 2020-11-10 11:35:51 UTC (rev 269623)
@@ -350,7 +350,7 @@
return;
auto time = secondsToWebAnimationsAPITime(elapsedTime) / 1000;
- const auto& pseudoId = PseudoElement::pseudoElementNameForEvents(m_owningPseudoId);
+ auto pseudoId = pseudoIdAsString(m_owningPseudoId);
auto timelineTime = timeline() ? timeline()->currentTime() : WTF::nullopt;
auto event = createEvent(eventType, time, pseudoId, timelineTime);
event->setTarget(m_owningElement.get());
Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (269622 => 269623)
--- trunk/Source/WebCore/animation/KeyframeEffect.cpp 2020-11-10 09:28:40 UTC (rev 269622)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp 2020-11-10 11:35:51 UTC (rev 269623)
@@ -1177,7 +1177,7 @@
// The target pseudo-selector. null if this effect has no effect target or if the effect target is an element (i.e. not a pseudo-element).
// When the effect target is a pseudo-element, this specifies the pseudo-element selector (e.g. ::before).
if (targetsPseudoElement())
- return PseudoElement::pseudoElementNameForEvents(m_pseudoId);
+ return pseudoIdAsString(m_pseudoId);
return { };
}
Modified: trunk/Source/WebCore/animation/WebAnimationUtilities.cpp (269622 => 269623)
--- trunk/Source/WebCore/animation/WebAnimationUtilities.cpp 2020-11-10 09:28:40 UTC (rev 269622)
+++ trunk/Source/WebCore/animation/WebAnimationUtilities.cpp 2020-11-10 11:35:51 UTC (rev 269623)
@@ -178,4 +178,36 @@
return a.globalPosition() < b.globalPosition();
}
+String pseudoIdAsString(PseudoId pseudoId)
+{
+ static NeverDestroyed<const String> after(MAKE_STATIC_STRING_IMPL("::after"));
+ static NeverDestroyed<const String> before(MAKE_STATIC_STRING_IMPL("::before"));
+ static NeverDestroyed<const String> firstLetter(MAKE_STATIC_STRING_IMPL("::first-letter"));
+ static NeverDestroyed<const String> firstLine(MAKE_STATIC_STRING_IMPL("::first-line"));
+ static NeverDestroyed<const String> highlight(MAKE_STATIC_STRING_IMPL("::highlight"));
+ static NeverDestroyed<const String> marker(MAKE_STATIC_STRING_IMPL("::marker"));
+ static NeverDestroyed<const String> selection(MAKE_STATIC_STRING_IMPL("::selection"));
+ static NeverDestroyed<const String> scrollbar(MAKE_STATIC_STRING_IMPL("::scrollbar"));
+ switch (pseudoId) {
+ case PseudoId::After:
+ return after;
+ case PseudoId::Before:
+ return before;
+ case PseudoId::FirstLetter:
+ return firstLetter;
+ case PseudoId::FirstLine:
+ return firstLine;
+ case PseudoId::Highlight:
+ return highlight;
+ case PseudoId::Marker:
+ return marker;
+ case PseudoId::Selection:
+ return selection;
+ case PseudoId::Scrollbar:
+ return scrollbar;
+ default:
+ return emptyString();
+ }
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/animation/WebAnimationUtilities.h (269622 => 269623)
--- trunk/Source/WebCore/animation/WebAnimationUtilities.h 2020-11-10 09:28:40 UTC (rev 269622)
+++ trunk/Source/WebCore/animation/WebAnimationUtilities.h 2020-11-10 11:35:51 UTC (rev 269623)
@@ -51,6 +51,7 @@
const auto timeEpsilon = Seconds::fromMilliseconds(0.001);
bool compareAnimationsByCompositeOrder(const WebAnimation&, const WebAnimation&);
+String pseudoIdAsString(PseudoId);
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/PseudoElement.cpp (269622 => 269623)
--- trunk/Source/WebCore/dom/PseudoElement.cpp 2020-11-10 09:28:40 UTC (rev 269622)
+++ trunk/Source/WebCore/dom/PseudoElement.cpp 2020-11-10 11:35:51 UTC (rev 269623)
@@ -48,20 +48,6 @@
return name;
}
-String PseudoElement::pseudoElementNameForEvents(PseudoId pseudoId)
-{
- static NeverDestroyed<const String> after(MAKE_STATIC_STRING_IMPL("::after"));
- static NeverDestroyed<const String> before(MAKE_STATIC_STRING_IMPL("::before"));
- switch (pseudoId) {
- case PseudoId::After:
- return after;
- case PseudoId::Before:
- return before;
- default:
- return emptyString();
- }
-}
-
PseudoElement::PseudoElement(Element& host, PseudoId pseudoId)
: Element(pseudoElementTagName(), host.document(), CreatePseudoElement)
, m_hostElement(&host)
Modified: trunk/Source/WebCore/dom/PseudoElement.h (269622 => 269623)
--- trunk/Source/WebCore/dom/PseudoElement.h 2020-11-10 09:28:40 UTC (rev 269622)
+++ trunk/Source/WebCore/dom/PseudoElement.h 2020-11-10 11:35:51 UTC (rev 269623)
@@ -46,8 +46,6 @@
bool canStartSelection() const override { return false; }
bool canContainRangeEndPoint() const override { return false; }
- static String pseudoElementNameForEvents(PseudoId);
-
private:
PseudoElement(Element&, PseudoId);