Diff
Modified: trunk/LayoutTests/ChangeLog (288622 => 288623)
--- trunk/LayoutTests/ChangeLog 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/LayoutTests/ChangeLog 2022-01-26 17:41:07 UTC (rev 288623)
@@ -1,3 +1,17 @@
+2022-01-26 Antoine Quint <[email protected]>
+
+ [Web Inspector] Graphics tab should display pseudo-elements for more than ::before and ::after
+ https://bugs.webkit.org/show_bug.cgi?id=235234
+ <rdar://87766777>
+
+ Reviewed by Devin Rousso.
+
+ Check that requestEffectTarget() returns the correct Styleable by checking whether it's defined
+ or null, and checking its `node` and `pseudoId` members.
+
+ * inspector/animation/targetChanged-expected.txt:
+ * inspector/animation/targetChanged.html:
+
2022-01-26 J Pascoe <[email protected]>
[WebAuthn] Add authenticator attachment used during authentication to credential payload
Modified: trunk/LayoutTests/inspector/animation/targetChanged-expected.txt (288622 => 288623)
--- trunk/LayoutTests/inspector/animation/targetChanged-expected.txt 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/LayoutTests/inspector/animation/targetChanged-expected.txt 2022-01-26 17:41:07 UTC (rev 288623)
@@ -3,16 +3,33 @@
== Running test suite: Animation.targetChanged
-- Running test case: Animation.targetChanged.NewTarget
-PASS: Animation should have a target.
+PASS: Animation effect should have a target element.
+PASS: Animation effect should not have a target pseudo-element.
Changing target...
-PASS: Animation should have a target.
-PASS: Animation effect should have changed.
+PASS: Animation effect should have a target element.
+PASS: Animation effect should not have a target pseudo-element.
+PASS: Animation effect target should have changed.
+PASS: Animation effect target element should have changed.
-- Running test case: Animation.targetChanged.NullTarget
-PASS: Animation should have a target.
+PASS: Animation effect should have a target element.
+PASS: Animation effect should not have a target pseudo-element.
Changing target...
-PASS: Animation should not have a target.
-PASS: Animation effect should have changed.
+PASS: Animation effect should not have a target element.
+PASS: Animation effect target should have changed.
+-- Running test case: Animation.targetChanged.NewTargetWithPseudoId
+PASS: Animation effect should not have a target.
+Changing target...
+
+PASS: Animation effect should have a target element.
+PASS: Animation effect should not have a target pseudo-element.
+Changing target again...
+
+PASS: Animation effect should have a target element.
+PASS: Animation effect should have a target pseudo-element.
+PASS: Animation effect target should have changed.
+PASS: Animation effect target element should not have changed.
+
Modified: trunk/LayoutTests/inspector/animation/targetChanged.html (288622 => 288623)
--- trunk/LayoutTests/inspector/animation/targetChanged.html 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/LayoutTests/inspector/animation/targetChanged.html 2022-01-26 17:41:07 UTC (rev 288623)
@@ -29,7 +29,8 @@
InspectorTest.assert(animation.animationType === WI.Animation.Type.WebAnimation, "Animation should be a web animation.");
let [oldTarget] = await promisify((callback) => { animation.requestEffectTarget(callback); });
- InspectorTest.expectThat(oldTarget instanceof WI.DOMNode, "Animation should have a target.");
+ InspectorTest.expectThat(oldTarget.node instanceof WI.DOMNode, "Animation effect should have a target element.");
+ InspectorTest.expectNull(oldTarget.pseudoId, "Animation effect should not have a target pseudo-element.");
InspectorTest.log("Changing target...\n");
await Promise.all([
@@ -38,9 +39,11 @@
]);
let [newTarget] = await promisify((callback) => { animation.requestEffectTarget(callback); });
- InspectorTest.expectThat(newTarget instanceof WI.DOMNode, "Animation should have a target.");
+ InspectorTest.expectThat(newTarget.node instanceof WI.DOMNode, "Animation effect should have a target element.");
+ InspectorTest.expectNull(newTarget.pseudoId, "Animation effect should not have a target pseudo-element.");
- InspectorTest.expectNotEqual(newTarget, oldTarget, "Animation effect should have changed.");
+ InspectorTest.expectNotEqual(newTarget, oldTarget, "Animation effect target should have changed.");
+ InspectorTest.expectNotEqual(newTarget.node, oldTarget.node, "Animation effect target element should have changed.");
},
});
@@ -60,7 +63,8 @@
InspectorTest.assert(animation.animationType === WI.Animation.Type.WebAnimation, "Animation should be a web animation.");
let [oldTarget] = await promisify((callback) => { animation.requestEffectTarget(callback); });
- InspectorTest.expectThat(oldTarget instanceof WI.DOMNode, "Animation should have a target.");
+ InspectorTest.expectThat(oldTarget.node instanceof WI.DOMNode, "Animation effect should have a target element.");
+ InspectorTest.expectNull(oldTarget.pseudoId, "Animation effect should not have a target pseudo-element.");
InspectorTest.log("Changing target...\n");
await Promise.all([
@@ -69,12 +73,55 @@
]);
let [newTarget] = await promisify((callback) => { animation.requestEffectTarget(callback); });
- InspectorTest.expectNull(newTarget, "Animation should not have a target.");
+ InspectorTest.expectNull(newTarget, "Animation effect should not have a target element.");
- InspectorTest.expectNotEqual(newTarget, oldTarget, "Animation effect should have changed.");
+ InspectorTest.expectNotEqual(newTarget, oldTarget, "Animation effect target should have changed.");
},
});
+ suite.addTestCase({
+ name: "Animation.targetChanged.NewTargetWithPseudoId",
+ description: "Should return a valid object for the given animation identifier.",
+ async test() {
+ let animations = Array.from(WI.animationManager.animationCollection);
+ InspectorTest.assert(animations.length === 1, "There should only be one animation.");
+
+ let animation = animations[0];
+ if (!animation) {
+ throw `Missing animation.`;
+ return;
+ }
+
+ InspectorTest.assert(animation.animationType === WI.Animation.Type.WebAnimation, "Animation should be a web animation.");
+
+ let [oldTarget] = await promisify((callback) => { animation.requestEffectTarget(callback); });
+ InspectorTest.expectNull(oldTarget, "Animation effect should not have a target.");
+
+ InspectorTest.log("Changing target...\n");
+ await Promise.all([
+ animation.awaitEvent(WI.Animation.Event.TargetChanged),
+ InspectorTest.evaluateInPage(`window.animation.effect.target = document.createElement("div")`),
+ ]);
+
+ let [newTarget] = await promisify((callback) => { animation.requestEffectTarget(callback); });
+ InspectorTest.expectThat(newTarget.node instanceof WI.DOMNode, "Animation effect should have a target element.");
+ InspectorTest.expectNull(newTarget.pseudoId, "Animation effect should not have a target pseudo-element.");
+
+ InspectorTest.log("Changing target again...\n");
+ await Promise.all([
+ animation.awaitEvent(WI.Animation.Event.TargetChanged),
+ InspectorTest.evaluateInPage(`window.animation.effect.pseudoElement = "::before"`),
+ ]);
+
+ let [newestTarget] = await promisify((callback) => { animation.requestEffectTarget(callback); });
+ InspectorTest.expectThat(newestTarget.node instanceof WI.DOMNode, "Animation effect should have a target element.");
+ InspectorTest.expectEqual(newestTarget.pseudoId, "before", "Animation effect should have a target pseudo-element.");
+
+ InspectorTest.expectNotEqual(newTarget, newestTarget, "Animation effect target should have changed.");
+ InspectorTest.expectEqual(newTarget.node, newestTarget.node, "Animation effect target element should not have changed.");
+ },
+ });
+
suite.runTestCasesAndFinish();
}
</script>
Modified: trunk/Source/_javascript_Core/ChangeLog (288622 => 288623)
--- trunk/Source/_javascript_Core/ChangeLog 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-01-26 17:41:07 UTC (rev 288623)
@@ -1,3 +1,16 @@
+2022-01-26 Antoine Quint <[email protected]>
+
+ [Web Inspector] Graphics tab should display pseudo-elements for more than ::before and ::after
+ https://bugs.webkit.org/show_bug.cgi?id=235234
+ <rdar://87766777>
+
+ Reviewed by Devin Rousso.
+
+ Add a new `DOM.Styleable` type to be used as the parameter type for `requestEffectTarget()` callbacks.
+
+ * inspector/protocol/Animation.json:
+ * inspector/protocol/DOM.json:
+
2022-01-26 Yusuke Suzuki <[email protected]>
[JSC] Do not run testPingPongStackOverflow while running multithreaded MultithreadedMultiVMExecutionTest
Modified: trunk/Source/_javascript_Core/inspector/protocol/Animation.json (288622 => 288623)
--- trunk/Source/_javascript_Core/inspector/protocol/Animation.json 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/_javascript_Core/inspector/protocol/Animation.json 2022-01-26 17:41:07 UTC (rev 288623)
@@ -88,7 +88,7 @@
{ "name": "animationId", "$ref": "AnimationId" }
],
"returns": [
- { "name": "nodeId", "$ref": "DOM.NodeId" }
+ { "name": "nodeId", "$ref": "DOM.Styleable" }
]
},
{
Modified: trunk/Source/_javascript_Core/inspector/protocol/DOM.json (288622 => 288623)
--- trunk/Source/_javascript_Core/inspector/protocol/DOM.json 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/_javascript_Core/inspector/protocol/DOM.json 2022-01-26 17:41:07 UTC (rev 288623)
@@ -168,6 +168,15 @@
{ "name": "borderColor", "$ref": "RGBAColor", "optional": true, "description": "The border highlight fill color (default: transparent)." },
{ "name": "marginColor", "$ref": "RGBAColor", "optional": true, "description": "The margin highlight fill color (default: transparent)." }
]
+ },
+ {
+ "id": "Styleable",
+ "type": "object",
+ "properties": [
+ { "name": "nodeId", "$ref": "NodeId" },
+ { "name": "pseudoId", "$ref": "CSS.PseudoId", "optional": true }
+ ],
+ "description": "An object referencing a node and a pseudo-element, primarily used to identify an animation effect target."
}
],
"commands": [
Modified: trunk/Source/WebCore/ChangeLog (288622 => 288623)
--- trunk/Source/WebCore/ChangeLog 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebCore/ChangeLog 2022-01-26 17:41:07 UTC (rev 288623)
@@ -1,3 +1,53 @@
+2022-01-26 Antoine Quint <[email protected]>
+
+ [Web Inspector] Graphics tab should display pseudo-elements for more than ::before and ::after
+ https://bugs.webkit.org/show_bug.cgi?id=235234
+ <rdar://87766777>
+
+ Reviewed by Devin Rousso.
+
+ Until now, we would pass the result of KeyframeEffect::targetElementOrPseudoElement() to
+ InspectorAnimationAgent::willApplyKeyframeEffect(). This meant that the inspector would only
+ be told of an animation target as an Element or a PseudoElement but not as an Element / PseudoId
+ pair, thus only allowing ::before and ::after to be represented since only those pseudo-elements
+ create a PseudoElement.
+
+ We now pass a Styleable, which encapsulate an Element / PseudoId pair, to
+ InspectorAnimationAgent::willApplyKeyframeEffect(). Additionally, the Styleable target is read from
+ the effect for callbacks provided to requestEffectTarget().
+
+ Sadly, we still rely on PseudoElement, but this patch at least removes all use of PseudoElement
+ from KeyframeEffect and pushes it down to InspectorDOMAgent with a new static method
+ elementToPushForStyleable() which the new pushStyleableElementToFrontend() and pushStyleablePathToFrontend()
+ methods use to turn the Styleable to an Element or PseudoElement.
+
+ In the future, we would need to further remove PseudoElement from Web Inspector and expose something
+ similar to Styleable throughout the codebase, or find some other way to encapsulate an Element / PseudoId
+ pair.
+
+ * animation/KeyframeEffect.cpp:
+ (WebCore::KeyframeEffect::apply):
+ (WebCore::KeyframeEffect::targetElementOrPseudoElement const): Deleted.
+ * animation/KeyframeEffect.h:
+ (WebCore::KeyframeEffect::target const):
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::willApplyKeyframeEffectImpl):
+ * inspector/InspectorInstrumentation.h:
+ (WebCore::InspectorInstrumentation::willApplyKeyframeEffect):
+ * inspector/agents/InspectorAnimationAgent.cpp:
+ (WebCore::InspectorAnimationAgent::requestEffectTarget):
+ (WebCore::InspectorAnimationAgent::willApplyKeyframeEffect):
+ * inspector/agents/InspectorAnimationAgent.h:
+ * inspector/agents/InspectorCSSAgent.cpp:
+ (WebCore::InspectorCSSAgent::protocolValueForPseudoId):
+ (WebCore::protocolValueForPseudoId): Deleted.
+ * inspector/agents/InspectorCSSAgent.h:
+ * inspector/agents/InspectorDOMAgent.cpp:
+ (WebCore::elementToPushForStyleable):
+ (WebCore::InspectorDOMAgent::pushStyleableElementToFrontend):
+ (WebCore::InspectorDOMAgent::pushStyleablePathToFrontend):
+ * inspector/agents/InspectorDOMAgent.h:
+
2022-01-26 J Pascoe <[email protected]>
[WebAuthn] Add authenticator attachment used during authentication to credential payload
Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (288622 => 288623)
--- trunk/Source/WebCore/animation/KeyframeEffect.cpp 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp 2022-01-26 17:41:07 UTC (rev 288623)
@@ -48,7 +48,6 @@
#include "KeyframeEffectStack.h"
#include "Logging.h"
#include "PropertyAllowlist.h"
-#include "PseudoElement.h"
#include "RenderBox.h"
#include "RenderBoxModelObject.h"
#include "RenderElement.h"
@@ -1182,19 +1181,6 @@
return m_target.get() && m_pseudoId != PseudoId::None;
}
-Element* KeyframeEffect::targetElementOrPseudoElement() const
-{
- if (m_target) {
- if (m_pseudoId == PseudoId::Before)
- return m_target->beforePseudoElement();
-
- if (m_pseudoId == PseudoId::After)
- return m_target->afterPseudoElement();
- }
-
- return m_target.get();
-}
-
void KeyframeEffect::setTarget(RefPtr<Element>&& newTarget)
{
if (m_target == newTarget)
@@ -1288,7 +1274,7 @@
auto computedTiming = getComputedTiming(startTime);
if (!startTime) {
m_phaseAtLastApplication = computedTiming.phase;
- if (auto* target = targetElementOrPseudoElement())
+ if (auto target = targetStyleable())
InspectorInstrumentation::willApplyKeyframeEffect(*target, *this, computedTiming);
}
Modified: trunk/Source/WebCore/animation/KeyframeEffect.h (288622 => 288623)
--- trunk/Source/WebCore/animation/KeyframeEffect.h 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebCore/animation/KeyframeEffect.h 2022-01-26 17:41:07 UTC (rev 288623)
@@ -101,7 +101,6 @@
const Vector<ParsedKeyframe>& parsedKeyframes() const { return m_parsedKeyframes; }
Element* target() const { return m_target.get(); }
- Element* targetElementOrPseudoElement() const;
void setTarget(RefPtr<Element>&&);
bool targetsPseudoElement() const;
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (288622 => 288623)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2022-01-26 17:41:07 UTC (rev 288623)
@@ -1120,7 +1120,7 @@
}
#endif
-void InspectorInstrumentation::willApplyKeyframeEffectImpl(InstrumentingAgents& instrumentingAgents, Element& target, KeyframeEffect& effect, ComputedEffectTiming computedTiming)
+void InspectorInstrumentation::willApplyKeyframeEffectImpl(InstrumentingAgents& instrumentingAgents, const Styleable& target, KeyframeEffect& effect, ComputedEffectTiming computedTiming)
{
if (auto* animationAgent = instrumentingAgents.trackingAnimationAgent())
animationAgent->willApplyKeyframeEffect(target, effect, computedTiming);
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (288622 => 288623)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2022-01-26 17:41:07 UTC (rev 288623)
@@ -99,6 +99,8 @@
class WebSocketChannel;
class WorkerOrWorkletGlobalScope;
+struct Styleable;
+
#if ENABLE(WEBGL)
class WebGLProgram;
#endif
@@ -299,7 +301,7 @@
static bool isWebGLProgramHighlighted(WebGLRenderingContextBase&, WebGLProgram&);
#endif
- static void willApplyKeyframeEffect(Element&, KeyframeEffect&, ComputedEffectTiming);
+ static void willApplyKeyframeEffect(const Styleable&, KeyframeEffect&, ComputedEffectTiming);
static void didChangeWebAnimationName(WebAnimation&);
static void didSetWebAnimationEffect(WebAnimation&);
static void didChangeWebAnimationEffectTiming(WebAnimation&);
@@ -502,7 +504,7 @@
static bool isWebGLProgramHighlightedImpl(InstrumentingAgents&, WebGLProgram&);
#endif
- static void willApplyKeyframeEffectImpl(InstrumentingAgents&, Element&, KeyframeEffect&, ComputedEffectTiming);
+ static void willApplyKeyframeEffectImpl(InstrumentingAgents&, const Styleable&, KeyframeEffect&, ComputedEffectTiming);
static void didChangeWebAnimationNameImpl(InstrumentingAgents&, WebAnimation&);
static void didSetWebAnimationEffectImpl(InstrumentingAgents&, WebAnimation&);
static void didChangeWebAnimationEffectTimingImpl(InstrumentingAgents&, WebAnimation&);
@@ -1455,10 +1457,10 @@
}
#endif
-inline void InspectorInstrumentation::willApplyKeyframeEffect(Element& target, KeyframeEffect& effect, ComputedEffectTiming computedTiming)
+inline void InspectorInstrumentation::willApplyKeyframeEffect(const Styleable& target, KeyframeEffect& effect, ComputedEffectTiming computedTiming)
{
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (auto* agents = instrumentingAgents(target.document()))
+ if (auto* agents = instrumentingAgents(target.element.document()))
willApplyKeyframeEffectImpl(*agents, target, effect, computedTiming);
}
Modified: trunk/Source/WebCore/inspector/agents/InspectorAnimationAgent.cpp (288622 => 288623)
--- trunk/Source/WebCore/inspector/agents/InspectorAnimationAgent.cpp 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebCore/inspector/agents/InspectorAnimationAgent.cpp 2022-01-26 17:41:07 UTC (rev 288623)
@@ -38,6 +38,7 @@
#include "Event.h"
#include "FillMode.h"
#include "Frame.h"
+#include "InspectorCSSAgent.h"
#include "InspectorDOMAgent.h"
#include "InstrumentingAgents.h"
#include "JSExecState.h"
@@ -47,6 +48,7 @@
#include "Page.h"
#include "PlaybackDirection.h"
#include "RenderElement.h"
+#include "Styleable.h"
#include "TimingFunction.h"
#include "WebAnimation.h"
#include <_javascript_Core/IdentifiersFactory.h>
@@ -279,7 +281,7 @@
return { };
}
-Protocol::ErrorStringOr<Protocol::DOM::NodeId> InspectorAnimationAgent::requestEffectTarget(const Protocol::Animation::AnimationId& animationId)
+Protocol::ErrorStringOr<Ref<Protocol::DOM::Styleable>> InspectorAnimationAgent::requestEffectTarget(const Protocol::Animation::AnimationId& animationId)
{
Protocol::ErrorString errorString;
@@ -297,11 +299,11 @@
auto& keyframeEffect = downcast<KeyframeEffect>(*effect);
- auto* target = keyframeEffect.targetElementOrPseudoElement();
+ auto target = keyframeEffect.targetStyleable();
if (!target)
return makeUnexpected("Animation for given animationId does not have a target"_s);
- return domAgent->pushNodePathToFrontend(errorString, target);
+ return domAgent->pushStyleablePathToFrontend(errorString, *target);
}
Protocol::ErrorStringOr<Ref<Protocol::Runtime::RemoteObject>> InspectorAnimationAgent::resolveAnimation(const Protocol::Animation::AnimationId& animationId, const String& objectGroup)
@@ -371,7 +373,7 @@
return computedTiming.localTime.value() < (computedTiming.endTime - computedTiming.activeDuration);
}
-void InspectorAnimationAgent::willApplyKeyframeEffect(Element& target, KeyframeEffect& keyframeEffect, ComputedEffectTiming computedTiming)
+void InspectorAnimationAgent::willApplyKeyframeEffect(const Styleable& target, KeyframeEffect& keyframeEffect, ComputedEffectTiming computedTiming)
{
auto* animation = keyframeEffect.animation();
if (!is<DeclarativeAnimation>(animation))
@@ -421,7 +423,7 @@
if (ensureResult.isNewEntry) {
if (auto* domAgent = m_instrumentingAgents.persistentDOMAgent()) {
- if (auto nodeId = domAgent->pushNodeToFrontend(&target))
+ if (auto nodeId = domAgent->pushStyleableElementToFrontend(target))
event->setNodeId(nodeId);
}
Modified: trunk/Source/WebCore/inspector/agents/InspectorAnimationAgent.h (288622 => 288623)
--- trunk/Source/WebCore/inspector/agents/InspectorAnimationAgent.h 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebCore/inspector/agents/InspectorAnimationAgent.h 2022-01-26 17:41:07 UTC (rev 288623)
@@ -44,6 +44,8 @@
class Page;
class WebAnimation;
+struct Styleable;
+
class InspectorAnimationAgent final : public InspectorAgentBase, public Inspector::AnimationBackendDispatcherHandler {
WTF_MAKE_NONCOPYABLE(InspectorAnimationAgent);
WTF_MAKE_FAST_ALLOCATED;
@@ -58,13 +60,13 @@
// AnimationBackendDispatcherHandler
Inspector::Protocol::ErrorStringOr<void> enable();
Inspector::Protocol::ErrorStringOr<void> disable();
- Inspector::Protocol::ErrorStringOr<Inspector::Protocol::DOM::NodeId> requestEffectTarget(const Inspector::Protocol::Animation::AnimationId&);
+ Inspector::Protocol::ErrorStringOr<Ref<Inspector::Protocol::DOM::Styleable>> requestEffectTarget(const Inspector::Protocol::Animation::AnimationId&);
Inspector::Protocol::ErrorStringOr<Ref<Inspector::Protocol::Runtime::RemoteObject>> resolveAnimation(const Inspector::Protocol::Animation::AnimationId&, const String& objectGroup);
Inspector::Protocol::ErrorStringOr<void> startTracking();
Inspector::Protocol::ErrorStringOr<void> stopTracking();
// InspectorInstrumentation
- void willApplyKeyframeEffect(Element&, KeyframeEffect&, ComputedEffectTiming);
+ void willApplyKeyframeEffect(const Styleable&, KeyframeEffect&, ComputedEffectTiming);
void didChangeWebAnimationName(WebAnimation&);
void didSetWebAnimationEffect(WebAnimation&);
void didChangeWebAnimationEffectTiming(WebAnimation&);
Modified: trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp (288622 => 288623)
--- trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp 2022-01-26 17:41:07 UTC (rev 288623)
@@ -441,7 +441,7 @@
}
}
-static std::optional<Protocol::CSS::PseudoId> protocolValueForPseudoId(PseudoId pseudoId)
+std::optional<Protocol::CSS::PseudoId> InspectorCSSAgent::protocolValueForPseudoId(PseudoId pseudoId)
{
switch (pseudoId) {
case PseudoId::FirstLine:
Modified: trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.h (288622 => 288623)
--- trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.h 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.h 2022-01-26 17:41:07 UTC (rev 288623)
@@ -85,6 +85,8 @@
static CSSStyleRule* asCSSStyleRule(CSSRule&);
static std::optional<Inspector::Protocol::CSS::LayoutContextType> layoutContextTypeForRenderer(RenderObject*);
+ static std::optional<Inspector::Protocol::CSS::PseudoId> protocolValueForPseudoId(PseudoId);
+
// InspectorAgentBase
void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*);
void willDestroyFrontendAndBackend(Inspector::DisconnectReason);
Modified: trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp (288622 => 288623)
--- trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp 2022-01-26 17:41:07 UTC (rev 288623)
@@ -104,6 +104,7 @@
#include "StyleProperties.h"
#include "StyleResolver.h"
#include "StyleSheetList.h"
+#include "Styleable.h"
#include "Text.h"
#include "TextNodeTraversal.h"
#include "Timer.h"
@@ -538,6 +539,25 @@
m_childrenRequested.clear();
}
+static Element* elementToPushForStyleable(const Styleable& styleable)
+{
+ // FIXME: We want to get rid of PseudoElement.
+ auto* element = &styleable.element;
+
+ if (styleable.pseudoId == PseudoId::Before)
+ element = element->beforePseudoElement();
+ else if (styleable.pseudoId == PseudoId::After)
+ element = element->afterPseudoElement();
+
+ return element;
+}
+
+Protocol::DOM::NodeId InspectorDOMAgent::pushStyleableElementToFrontend(const Styleable& styleable)
+{
+ auto* element = elementToPushForStyleable(styleable);
+ return pushNodeToFrontend(element ?: &styleable.element);
+}
+
Protocol::DOM::NodeId InspectorDOMAgent::pushNodeToFrontend(Node* nodeToPush)
{
if (!nodeToPush)
@@ -637,6 +657,23 @@
return pushNodePathToFrontend(ignored, nodeToPush);
}
+Ref<Protocol::DOM::Styleable> InspectorDOMAgent::pushStyleablePathToFrontend(Protocol::ErrorString errorString, const Styleable& styleable)
+{
+ auto* element = elementToPushForStyleable(styleable);
+ auto nodeId = pushNodePathToFrontend(errorString, element ?: &styleable.element);
+
+ auto protocolStyleable = Protocol::DOM::Styleable::create()
+ .setNodeId(nodeId)
+ .release();
+
+ if (styleable.pseudoId != PseudoId::None) {
+ if (auto pseudoId = InspectorCSSAgent::protocolValueForPseudoId(styleable.pseudoId))
+ protocolStyleable->setPseudoId(*pseudoId);
+ }
+
+ return protocolStyleable;
+}
+
Protocol::DOM::NodeId InspectorDOMAgent::pushNodePathToFrontend(Protocol::ErrorString errorString, Node* nodeToPush)
{
ASSERT(nodeToPush); // Invalid input
Modified: trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.h (288622 => 288623)
--- trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.h 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.h 2022-01-26 17:41:07 UTC (rev 288623)
@@ -75,6 +75,8 @@
class RevalidateStyleAttributeTask;
class ShadowRoot;
+struct Styleable;
+
class InspectorDOMAgent final : public InspectorAgentBase, public Inspector::DOMBackendDispatcherHandler {
WTF_MAKE_NONCOPYABLE(InspectorDOMAgent);
WTF_MAKE_FAST_ALLOCATED;
@@ -184,6 +186,8 @@
void styleAttributeInvalidated(const Vector<Element*>& elements);
+ Inspector::Protocol::DOM::NodeId pushStyleableElementToFrontend(const Styleable&);
+ Ref<Inspector::Protocol::DOM::Styleable> pushStyleablePathToFrontend(Inspector::Protocol::ErrorString, const Styleable&);
Inspector::Protocol::DOM::NodeId pushNodeToFrontend(Node*);
Inspector::Protocol::DOM::NodeId pushNodeToFrontend(Inspector::Protocol::ErrorString&, Inspector::Protocol::DOM::NodeId documentNodeId, Node*);
Inspector::Protocol::DOM::NodeId pushNodePathToFrontend(Node*);
Modified: trunk/Source/WebInspectorUI/ChangeLog (288622 => 288623)
--- trunk/Source/WebInspectorUI/ChangeLog 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebInspectorUI/ChangeLog 2022-01-26 17:41:07 UTC (rev 288623)
@@ -1,3 +1,35 @@
+2022-01-26 Antoine Quint <[email protected]>
+
+ [Web Inspector] Graphics tab should display pseudo-elements for more than ::before and ::after
+ https://bugs.webkit.org/show_bug.cgi?id=235234
+ <rdar://87766777>
+
+ Reviewed by Devin Rousso.
+
+ Add a new `DOMStyleable` model class to match the new `DOM.Styleable` protocol type.
+
+ When calling Animation.requestEffectTarget(), we now use this new DOMStyleable class
+ to display pseudo-elements other than ::before or ::after in the Graphics tab.
+
+ * UserInterface/Base/DOMUtilities.js:
+ (WI.linkifyStyleable):
+ * UserInterface/Main.html:
+ * UserInterface/Models/Animation.js:
+ (WI.Animation.prototype.requestEffectTarget):
+ * UserInterface/Models/DOMStyleable.js: Added.
+ (WI.DOMStyleable.prototype.fromPayload):
+ (WI.DOMStyleable.prototype.get node):
+ (WI.DOMStyleable.prototype.get pseudoId):
+ (WI.DOMStyleable.prototype.get displayName):
+ (WI.DOMStyleable):
+ * UserInterface/Test.html:
+ * UserInterface/Views/AnimationCollectionContentView.js:
+ (WI.AnimationCollectionContentView.prototype._handleContentViewMouseEnter):
+ * UserInterface/Views/AnimationContentView.js:
+ (WI.AnimationContentView.prototype._refreshSubtitle):
+ * UserInterface/Views/AnimationDetailsSidebarPanel.js:
+ (WI.AnimationDetailsSidebarPanel.prototype._refreshIdentitySection):
+
2022-01-25 Nikita Vasilyev <[email protected]>
Web Inspector: Collapse blackboxed call frames by default
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/DOMUtilities.js (288622 => 288623)
--- trunk/Source/WebInspectorUI/UserInterface/Base/DOMUtilities.js 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/DOMUtilities.js 2022-01-26 17:41:07 UTC (rev 288623)
@@ -57,6 +57,15 @@
return link;
};
+WI.linkifyStyleable = function(styleable)
+{
+ console.assert(styleable instanceof WI.DOMStyleable, styleable);
+ let displayName = styleable.displayName;
+ let link = document.createElement("span");
+ link.append(displayName);
+ return WI.linkifyNodeReferenceElement(styleable.node, link, {displayName});
+};
+
WI.linkifyNodeReference = function(node, options = {})
{
let displayName = node.displayName;
Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (288622 => 288623)
--- trunk/Source/WebInspectorUI/UserInterface/Main.html 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html 2022-01-26 17:41:07 UTC (rev 288623)
@@ -419,6 +419,7 @@
<script src=""
<script src=""
<script src=""
+ <script src=""
<script src=""
<script src=""
<script src=""
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Animation.js (288622 => 288623)
--- trunk/Source/WebInspectorUI/UserInterface/Models/Animation.js 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Animation.js 2022-01-26 17:41:07 UTC (rev 288623)
@@ -191,6 +191,7 @@
return WI.UIString("Animation %d").format(this._uniqueDisplayNameNumber);
}
+ // COMPATIBILITY (iOS 15): effectTarget changed from DOM.NodeId to CSS.Styleable.
requestEffectTarget(callback)
{
if (this._effectTarget !== undefined) {
@@ -208,9 +209,13 @@
WI.domManager.ensureDocument();
let target = WI.assumingMainTarget();
- target.AnimationAgent.requestEffectTarget(this._animationId, (error, nodeId) => {
- this._effectTarget = !error ? WI.domManager.nodeForId(nodeId) : null;
+ target.AnimationAgent.requestEffectTarget(this._animationId, (error, styleable) => {
+ // COMPATIBILITY (iOS 15): effectTarget changed from DOM.NodeId to DOM.Styleable.
+ if (!isNaN(styleable))
+ styleable = {nodeId: styleable};
+ this._effectTarget = !error ? WI.DOMStyleable.fromPayload(styleable) : null;
+
for (let requestEffectTargetCallback of this._requestEffectTargetCallbacks)
requestEffectTargetCallback(this._effectTarget);
Added: trunk/Source/WebInspectorUI/UserInterface/Models/DOMStyleable.js (0 => 288623)
--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMStyleable.js (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMStyleable.js 2022-01-26 17:41:07 UTC (rev 288623)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WI.DOMStyleable = class DOMStyleable
+{
+ constructor(node, {pseudoId} = {})
+ {
+ console.assert(node instanceof WI.DOMNode, node);
+ console.assert(!pseudoId || Object.values(WI.CSSManager.PseudoSelectorNames).includes(pseudoId), pseudoId);
+
+ this._node = node;
+ this._pseudoId = pseudoId || null;
+ }
+
+ // Static
+
+ static fromPayload({nodeId, pseudoId})
+ {
+ return new WI.DOMStyleable(WI.domManager.nodeForId(nodeId), {pseudoId});
+ }
+
+ // Public
+
+ get node() { return this._node; }
+ get pseudoId() { return this._pseudoId; }
+
+ get displayName()
+ {
+ if (this._pseudoId)
+ return WI.CSSManager.displayNameForPseudoId(this._pseudoId);
+ return this._node.displayName;
+ }
+};
Modified: trunk/Source/WebInspectorUI/UserInterface/Test.html (288622 => 288623)
--- trunk/Source/WebInspectorUI/UserInterface/Test.html 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebInspectorUI/UserInterface/Test.html 2022-01-26 17:41:07 UTC (rev 288623)
@@ -152,6 +152,7 @@
<script src=""
<script src=""
<script src=""
+ <script src=""
<script src=""
<script src=""
<script src=""
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/AnimationCollectionContentView.js (288622 => 288623)
--- trunk/Source/WebInspectorUI/UserInterface/Views/AnimationCollectionContentView.js 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/AnimationCollectionContentView.js 2022-01-26 17:41:07 UTC (rev 288623)
@@ -96,10 +96,10 @@
return;
let animation = contentView.representedObject;
- animation.requestEffectTarget((node) => {
- if (!node || !node.ownerDocument)
+ animation.requestEffectTarget((styleable) => {
+ if (!styleable.node || !styleable.node.ownerDocument)
return;
- node.highlight();
+ styleable.node.highlight();
});
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/AnimationContentView.js (288622 => 288623)
--- trunk/Source/WebInspectorUI/UserInterface/Views/AnimationContentView.js 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/AnimationContentView.js 2022-01-26 17:41:07 UTC (rev 288623)
@@ -162,12 +162,12 @@
_refreshSubtitle()
{
- this.representedObject.requestEffectTarget((domNode) => {
- this._animationTargetDOMNode = domNode;
+ this.representedObject.requestEffectTarget((styleable) => {
+ this._animationTargetDOMNode = styleable.node;
this._subtitleElement.removeChildren();
- if (domNode)
- this._subtitleElement.appendChild(WI.linkifyNodeReference(domNode));
+ if (styleable)
+ this._subtitleElement.appendChild(WI.linkifyStyleable(styleable));
});
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/AnimationDetailsSidebarPanel.js (288622 => 288623)
--- trunk/Source/WebInspectorUI/UserInterface/Views/AnimationDetailsSidebarPanel.js 2022-01-26 16:59:14 UTC (rev 288622)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/AnimationDetailsSidebarPanel.js 2022-01-26 17:41:07 UTC (rev 288623)
@@ -179,8 +179,8 @@
this._cssTransitionPropertyRow.value = cssTransitionProperty;
this._targetRow.value = null;
- this._animation.requestEffectTarget((domNode) => {
- this._targetRow.value = domNode ? WI.linkifyNodeReference(domNode) : null;
+ this._animation.requestEffectTarget((styleable) => {
+ this._targetRow.value = WI.linkifyStyleable(styleable);
});
}