Diff
Modified: trunk/LayoutTests/ChangeLog (244268 => 244269)
--- trunk/LayoutTests/ChangeLog 2019-04-15 17:27:27 UTC (rev 244268)
+++ trunk/LayoutTests/ChangeLog 2019-04-15 17:27:40 UTC (rev 244269)
@@ -1,5 +1,16 @@
2019-04-15 Devin Rousso <[email protected]>
+ Web Inspector: DOMDebugger: "Attribute Modified" breakpoints pause after the modification occurs for the style attribute
+ https://bugs.webkit.org/show_bug.cgi?id=196556
+ <rdar://problem/49570681>
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/dom-debugger/attribute-modified-style.html: Added.
+ * inspector/dom-debugger/attribute-modified-style-expected.txt: Added.
+
+2019-04-15 Devin Rousso <[email protected]>
+
Web Inspector: Elements: event listener change events should only be fired for the selected node and it's ancestors
https://bugs.webkit.org/show_bug.cgi?id=196887
<rdar://problem/49870627>
Added: trunk/LayoutTests/inspector/dom-debugger/attribute-modified-style-expected.txt (0 => 244269)
--- trunk/LayoutTests/inspector/dom-debugger/attribute-modified-style-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/dom-debugger/attribute-modified-style-expected.txt 2019-04-15 17:27:40 UTC (rev 244269)
@@ -0,0 +1,61 @@
+Tests functionality of attribute modified DOM breakpoints when modifying the inline style attribute.
+
+Adding attribute modified breakpoint to #test...
+PASS: Added attribute modified breakpoint to #test.
+
+== Running test suite: DOMBreakpoints.AttributeModified.Style
+-- Running test case: DOMBreakpoints.AttributeModified.Style.Add
+Getting 'display'...
+PASS: 'display' should have the value ''.
+Setting 'display: none;'...
+PASS: Paused.
+Getting 'display'...
+PASS: 'display' should have the value ''.
+PASS: Resumed.
+Getting 'display'...
+PASS: 'display' should have the value 'none'.
+
+-- Running test case: DOMBreakpoints.AttributeModified.Style.ReplaceSame
+Getting 'display'...
+PASS: 'display' should have the value 'none'.
+Setting 'display: none;'...
+PASS: Paused.
+Getting 'display'...
+PASS: 'display' should have the value 'none'.
+PASS: Resumed.
+Getting 'display'...
+PASS: 'display' should have the value 'none'.
+
+-- Running test case: DOMBreakpoints.AttributeModified.Style.ReplaceDifferent
+Getting 'display'...
+PASS: 'display' should have the value 'none'.
+Setting 'display: block;'...
+PASS: Paused.
+Getting 'display'...
+PASS: 'display' should have the value 'none'.
+PASS: Resumed.
+Getting 'display'...
+PASS: 'display' should have the value 'block'.
+
+-- Running test case: DOMBreakpoints.AttributeModified.Style.Remove
+Getting 'display'...
+PASS: 'display' should have the value 'block'.
+Removing 'display'...
+PASS: Paused.
+Getting 'display'...
+PASS: 'display' should have the value 'block'.
+PASS: Resumed.
+Getting 'display'...
+PASS: 'display' should have the value ''.
+
+-- Running test case: DOMBreakpoints.AttributeModified.Style.Text
+Getting 'display'...
+PASS: 'display' should have the value ''.
+Setting style text to ''...
+PASS: Paused.
+Getting 'display'...
+PASS: 'display' should have the value ''.
+PASS: Resumed.
+Getting 'display'...
+PASS: 'display' should have the value 'none'.
+
Added: trunk/LayoutTests/inspector/dom-debugger/attribute-modified-style.html (0 => 244269)
--- trunk/LayoutTests/inspector/dom-debugger/attribute-modified-style.html (rev 0)
+++ trunk/LayoutTests/inspector/dom-debugger/attribute-modified-style.html 2019-04-15 17:27:40 UTC (rev 244269)
@@ -0,0 +1,147 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function getProperty(name) {
+ let node = document.getElementById("test");
+ return node.style.getPropertyValue(name);
+}
+
+function setProperty(name, value) {
+ let node = document.getElementById("test");
+ if (value)
+ node.style.setProperty(name, value);
+ else
+ node.style.removeProperty(name);
+}
+
+function test()
+{
+ InspectorTest.debug();
+
+ let suite = InspectorTest.createAsyncSuite("DOMBreakpoints.AttributeModified.Style");
+
+ async function checkPropertyValue(name, expectedValue) {
+ InspectorTest.log(`Getting '${name}'...`);
+ let value = await InspectorTest.evaluateInPage(`getProperty("${name}")`);
+ InspectorTest.expectEqual(value, expectedValue, `'${name}' should have the value '${expectedValue}'.`);
+ }
+
+ function addTestCase({name, propertyName, propertyValueBefore, propertyValueAfter}) {
+ suite.addTestCase({
+ name,
+ async test() {
+ await checkPropertyValue(propertyName, propertyValueBefore);
+
+ let pausedPromise = WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused);
+
+ if (propertyValueAfter)
+ InspectorTest.log(`Setting '${propertyName}: ${propertyValueAfter};'...`);
+ else
+ InspectorTest.log(`Removing '${propertyName}'...`);
+ let evaluatePromise = InspectorTest.evaluateInPage(`setProperty("${propertyName}", "${propertyValueAfter}")`);
+
+ await pausedPromise;
+ InspectorTest.pass("Paused.");
+
+ await checkPropertyValue(propertyName, propertyValueBefore);
+
+ await WI.debuggerManager.resume();
+ InspectorTest.pass("Resumed.");
+
+ await evaluatePromise;
+
+ await checkPropertyValue(propertyName, propertyValueAfter);
+ },
+ });
+ }
+
+ addTestCase({
+ name: "DOMBreakpoints.AttributeModified.Style.Add",
+ propertyName: "display",
+ propertyValueBefore: "",
+ propertyValueAfter: "none",
+ });
+ addTestCase({
+ name: "DOMBreakpoints.AttributeModified.Style.ReplaceSame",
+ propertyName: "display",
+ propertyValueBefore: "none",
+ propertyValueAfter: "none",
+ });
+ addTestCase({
+ name: "DOMBreakpoints.AttributeModified.Style.ReplaceDifferent",
+ propertyName: "display",
+ propertyValueBefore: "none",
+ propertyValueAfter: "block",
+ });
+ addTestCase({
+ name: "DOMBreakpoints.AttributeModified.Style.Remove",
+ propertyName: "display",
+ propertyValueBefore: "block",
+ propertyValueAfter: "",
+ });
+
+ suite.addTestCase({
+ name: "DOMBreakpoints.AttributeModified.Style.Text",
+ async test() {
+ await checkPropertyValue("display", "");
+
+ let pausedPromise = WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused);
+
+ InspectorTest.log(`Setting style text to ''...`);
+ let evaluatePromise = InspectorTest.evaluateInPage(`document.getElementById("test").style.cssText = "display: none;";`);
+
+ await pausedPromise;
+ InspectorTest.pass("Paused.");
+
+ await checkPropertyValue("display", "");
+
+ await WI.debuggerManager.resume();
+ InspectorTest.pass("Resumed.");
+
+ await evaluatePromise;
+
+ await checkPropertyValue("display", "none");
+ },
+ });
+
+ WI.domManager.requestDocument((documentNode) => {
+ if (!documentNode) {
+ InspectorTest.fail("Missing document node");
+ InspectorTest.completeTest();
+ return;
+ }
+
+ WI.domManager.querySelector(documentNode.id, "#test", async (nodeId) => {
+ let testNode = WI.domManager.nodeForId(nodeId);
+ if (!testNode) {
+ InspectorTest.fail("Missing #test node");
+ InspectorTest.completeTest();
+ return;
+ }
+
+ let promise = WI.domDebuggerManager.awaitEvent(WI.DOMDebuggerManager.Event.DOMBreakpointAdded)
+ .then((event) => {
+ InspectorTest.pass("Added attribute modified breakpoint to #test.");
+ });
+
+ InspectorTest.log("Adding attribute modified breakpoint to #test...");
+ WI.domDebuggerManager.addDOMBreakpoint(new WI.DOMBreakpoint(testNode, WI.DOMBreakpoint.Type.AttributeModified));
+ await promise;
+
+ InspectorTest.assert(!WI.debuggerManager.paused, "Should not be paused.");
+
+ suite.runTestCasesAndFinish();
+ });
+ });
+}
+</script>
+</head>
+<body _onload_="runTest()">
+ <p>Tests functionality of attribute modified DOM breakpoints when modifying the inline style attribute.</p>
+ <div id="test"></div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (244268 => 244269)
--- trunk/Source/WebCore/ChangeLog 2019-04-15 17:27:27 UTC (rev 244268)
+++ trunk/Source/WebCore/ChangeLog 2019-04-15 17:27:40 UTC (rev 244269)
@@ -1,5 +1,40 @@
2019-04-15 Devin Rousso <[email protected]>
+ Web Inspector: DOMDebugger: "Attribute Modified" breakpoints pause after the modification occurs for the style attribute
+ https://bugs.webkit.org/show_bug.cgi?id=196556
+ <rdar://problem/49570681>
+
+ Reviewed by Timothy Hatcher.
+
+ Test: inspector/dom-debugger/attribute-modified-style.html
+
+ * css/PropertySetCSSStyleDeclaration.h:
+ * css/PropertySetCSSStyleDeclaration.cpp:
+ (WebCore::StyleAttributeMutationScope::~StyleAttributeMutationScope):
+ (WebCore::InlineCSSStyleDeclaration::willMutate): Added.
+
+ * dom/StyledElement.cpp:
+ (WebCore::StyledElement::styleAttributeChanged):
+ (WebCore::StyledElement::inlineStyleChanged):
+
+ * inspector/InspectorInstrumentation.h:
+ (WebCore::InspectorInstrumentation::willInvalidateStyleAttr): Added.
+ (WebCore::InspectorInstrumentation::didInvalidateStyleAttr):
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::willInvalidateStyleAttrImpl): Added.
+ (WebCore::InspectorInstrumentation::didInvalidateStyleAttrImpl):
+
+ * inspector/agents/InspectorDOMAgent.h:
+ * inspector/agents/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::didInvalidateStyleAttr):
+
+ * inspector/agents/InspectorDOMDebuggerAgent.h:
+ * inspector/agents/InspectorDOMDebuggerAgent.cpp:
+ (WebCore::InspectorDOMDebuggerAgent::willInvalidateStyleAttr): Added.
+ (WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr): Deleted.
+
+2019-04-15 Devin Rousso <[email protected]>
+
Web Inspector: Elements: event listener change events should only be fired for the selected node and it's ancestors
https://bugs.webkit.org/show_bug.cgi?id=196887
<rdar://problem/49870627>
Modified: trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp (244268 => 244269)
--- trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp 2019-04-15 17:27:27 UTC (rev 244268)
+++ trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp 2019-04-15 17:27:40 UTC (rev 244269)
@@ -104,8 +104,9 @@
PropertySetCSSStyleDeclaration* localCopyStyleDecl = s_currentDecl;
s_currentDecl = nullptr;
s_shouldNotifyInspector = false;
- if (localCopyStyleDecl->parentElement())
- InspectorInstrumentation::didInvalidateStyleAttr(localCopyStyleDecl->parentElement()->document(), *localCopyStyleDecl->parentElement());
+
+ if (auto* parentElement = localCopyStyleDecl->parentElement())
+ InspectorInstrumentation::didInvalidateStyleAttr(*parentElement);
}
void enqueueMutationRecord()
@@ -421,6 +422,13 @@
m_propertySet->ref();
}
+bool InlineCSSStyleDeclaration::willMutate()
+{
+ if (m_parentElement)
+ InspectorInstrumentation::willInvalidateStyleAttr(*m_parentElement);
+ return true;
+}
+
void InlineCSSStyleDeclaration::didMutate(MutationType type)
{
if (type == NoChanges)
Modified: trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h (244268 => 244269)
--- trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h 2019-04-15 17:27:27 UTC (rev 244268)
+++ trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h 2019-04-15 17:27:40 UTC (rev 244269)
@@ -134,6 +134,7 @@
StyledElement* parentElement() const final { return m_parentElement; }
void clearParentElement() final { m_parentElement = nullptr; }
+ bool willMutate() final WARN_UNUSED_RETURN;
void didMutate(MutationType) final;
CSSParserContext cssParserContext() const final;
Modified: trunk/Source/WebCore/dom/StyledElement.cpp (244268 => 244269)
--- trunk/Source/WebCore/dom/StyledElement.cpp 2019-04-15 17:27:27 UTC (rev 244268)
+++ trunk/Source/WebCore/dom/StyledElement.cpp 2019-04-15 17:27:40 UTC (rev 244269)
@@ -206,7 +206,7 @@
elementData()->setStyleAttributeIsDirty(false);
invalidateStyle();
- InspectorInstrumentation::didInvalidateStyleAttr(document(), *this);
+ InspectorInstrumentation::didInvalidateStyleAttr(*this);
}
void StyledElement::invalidateStyleAttribute()
@@ -231,7 +231,7 @@
void StyledElement::inlineStyleChanged()
{
invalidateStyleAttribute();
- InspectorInstrumentation::didInvalidateStyleAttr(document(), *this);
+ InspectorInstrumentation::didInvalidateStyleAttr(*this);
}
bool StyledElement::setInlineStyleProperty(CSSPropertyID propertyID, CSSValueID identifier, bool important)
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (244268 => 244269)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2019-04-15 17:27:27 UTC (rev 244268)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2019-04-15 17:27:40 UTC (rev 244269)
@@ -188,14 +188,18 @@
domAgent->didRemoveDOMAttr(element, name);
}
-void InspectorInstrumentation::didInvalidateStyleAttrImpl(InstrumentingAgents& instrumentingAgents, Node& node)
+void InspectorInstrumentation::willInvalidateStyleAttrImpl(InstrumentingAgents& instrumentingAgents, Element& element)
{
- if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
- domAgent->didInvalidateStyleAttr(node);
- if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
- domDebuggerAgent->didInvalidateStyleAttr(node);
+ if (auto* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
+ domDebuggerAgent->willInvalidateStyleAttr(element);
}
+void InspectorInstrumentation::didInvalidateStyleAttrImpl(InstrumentingAgents& instrumentingAgents, Element& element)
+{
+ if (auto* domAgent = instrumentingAgents.inspectorDOMAgent())
+ domAgent->didInvalidateStyleAttr(element);
+}
+
void InspectorInstrumentation::documentDetachedImpl(InstrumentingAgents& instrumentingAgents, Document& document)
{
if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent())
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (244268 => 244269)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2019-04-15 17:27:27 UTC (rev 244268)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2019-04-15 17:27:40 UTC (rev 244269)
@@ -115,7 +115,8 @@
static void didModifyDOMAttr(Document&, Element&, const AtomicString& name, const AtomicString& value);
static void didRemoveDOMAttr(Document&, Element&, const AtomicString& name);
static void characterDataModified(Document&, CharacterData&);
- static void didInvalidateStyleAttr(Document&, Node&);
+ static void willInvalidateStyleAttr(Element&);
+ static void didInvalidateStyleAttr(Element&);
static void documentDetached(Document&);
static void frameWindowDiscarded(Frame&, DOMWindow*);
static void mediaQueryResultChanged(Document&);
@@ -308,7 +309,8 @@
static void didModifyDOMAttrImpl(InstrumentingAgents&, Element&, const AtomicString& name, const AtomicString& value);
static void didRemoveDOMAttrImpl(InstrumentingAgents&, Element&, const AtomicString& name);
static void characterDataModifiedImpl(InstrumentingAgents&, CharacterData&);
- static void didInvalidateStyleAttrImpl(InstrumentingAgents&, Node&);
+ static void willInvalidateStyleAttrImpl(InstrumentingAgents&, Element&);
+ static void didInvalidateStyleAttrImpl(InstrumentingAgents&, Element&);
static void documentDetachedImpl(InstrumentingAgents&, Document&);
static void frameWindowDiscardedImpl(InstrumentingAgents&, DOMWindow*);
static void mediaQueryResultChangedImpl(InstrumentingAgents&);
@@ -552,13 +554,20 @@
didRemoveDOMAttrImpl(*instrumentingAgents, element, name);
}
-inline void InspectorInstrumentation::didInvalidateStyleAttr(Document& document, Node& node)
+inline void InspectorInstrumentation::willInvalidateStyleAttr(Element& element)
{
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
- didInvalidateStyleAttrImpl(*instrumentingAgents, node);
+ if (auto* instrumentingAgents = instrumentingAgentsForDocument(element.document()))
+ willInvalidateStyleAttrImpl(*instrumentingAgents, element);
}
+inline void InspectorInstrumentation::didInvalidateStyleAttr(Element& element)
+{
+ FAST_RETURN_IF_NO_FRONTENDS(void());
+ if (auto* instrumentingAgents = instrumentingAgentsForDocument(element.document()))
+ didInvalidateStyleAttrImpl(*instrumentingAgents, element);
+}
+
inline void InspectorInstrumentation::documentDetached(Document& document)
{
FAST_RETURN_IF_NO_FRONTENDS(void());
Modified: trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp (244268 => 244269)
--- trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp 2019-04-15 17:27:27 UTC (rev 244268)
+++ trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp 2019-04-15 17:27:40 UTC (rev 244269)
@@ -2311,15 +2311,15 @@
m_frontendDispatcher->characterDataModified(id, characterData.data());
}
-void InspectorDOMAgent::didInvalidateStyleAttr(Node& node)
+void InspectorDOMAgent::didInvalidateStyleAttr(Element& element)
{
- int id = m_documentNodeToIdMap.get(&node);
+ int id = m_documentNodeToIdMap.get(&element);
if (!id)
return;
if (!m_revalidateStyleAttrTask)
m_revalidateStyleAttrTask = std::make_unique<RevalidateStyleAttributeTask>(this);
- m_revalidateStyleAttrTask->scheduleFor(downcast<Element>(&node));
+ m_revalidateStyleAttrTask->scheduleFor(&element);
}
void InspectorDOMAgent::didPushShadowRoot(Element& host, ShadowRoot& root)
Modified: trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.h (244268 => 244269)
--- trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.h 2019-04-15 17:27:27 UTC (rev 244268)
+++ trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.h 2019-04-15 17:27:40 UTC (rev 244269)
@@ -146,7 +146,7 @@
void didModifyDOMAttr(Element&, const AtomicString& name, const AtomicString& value);
void didRemoveDOMAttr(Element&, const AtomicString& name);
void characterDataModified(CharacterData&);
- void didInvalidateStyleAttr(Node&);
+ void didInvalidateStyleAttr(Element&);
void didPushShadowRoot(Element& host, ShadowRoot&);
void willPopShadowRoot(Element& host, ShadowRoot&);
void didChangeCustomElementState(Element&);
Modified: trunk/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp (244268 => 244269)
--- trunk/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp 2019-04-15 17:27:27 UTC (rev 244268)
+++ trunk/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp 2019-04-15 17:27:40 UTC (rev 244269)
@@ -170,14 +170,14 @@
m_eventBreakpoints.remove(std::make_pair(*breakpointType, eventName));
}
-void InspectorDOMDebuggerAgent::didInvalidateStyleAttr(Node& node)
+void InspectorDOMDebuggerAgent::willInvalidateStyleAttr(Element& element)
{
if (!m_debuggerAgent->breakpointsActive())
return;
- if (hasBreakpoint(&node, AttributeModified)) {
+ if (hasBreakpoint(&element, AttributeModified)) {
Ref<JSON::Object> eventData = JSON::Object::create();
- descriptionForDOMEvent(node, AttributeModified, false, eventData.get());
+ descriptionForDOMEvent(element, AttributeModified, false, eventData.get());
m_debuggerAgent->breakProgram(Inspector::DebuggerFrontendDispatcher::Reason::DOM, WTFMove(eventData));
}
}
Modified: trunk/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.h (244268 => 244269)
--- trunk/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.h 2019-04-15 17:27:27 UTC (rev 244268)
+++ trunk/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.h 2019-04-15 17:27:40 UTC (rev 244269)
@@ -69,7 +69,7 @@
// InspectorInstrumentation
void willInsertDOMNode(Node& parent);
- void didInvalidateStyleAttr(Node&);
+ void willInvalidateStyleAttr(Element&);
void didInsertDOMNode(Node&);
void willRemoveDOMNode(Node&);
void didRemoveDOMNode(Node&);