Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Web Inspector: CSS Regions: Removing a content node of a ContentFlow …
…from the DOM will send a 0 nodeId https://bugs.webkit.org/show_bug.cgi?id=123577 Source/WebCore: Reviewed by Timothy Hatcher. Test: inspector-protocol/model/content-flow-content-removal.html Do not send unregister events for the content nodes of a flow when the element is not part of the DOM anymore. We already send an unbind event, so the inspector is already notified that the node was removed. * inspector/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::didUnregisterNamedFlowContentElement): Source/WebInspectorUI: Reviewed by Timothy Hatcher. Fixed the content node removal from the content flow. * UserInterface/ContentFlowTreeContentView.js: * UserInterface/DOMTreeManager.js: (WebInspector.DOMTreeManager): (WebInspector.DOMTreeManager.prototype._createContentFlowFromPayload): Registered all the content nodes in the _contentNodesToFlowsMap. (WebInspector.DOMTreeManager.prototype._unbind): Added call to _removeContentNodeFromFlowIfNeeded. (WebInspector.DOMTreeManager.prototype._removeContentNodeFromFlowIfNeeded): Called from _unbind to check and remove a node from it's parent content flow if needed. (WebInspector.DOMTreeManager.prototype.unregisteredNamedFlowContentElement): LayoutTests: Reviewed by Timothy Hatcher. Added test to check that the notification that an element was removed from the ContentFlow is handled correctly in the WebInspector even if the element is not part of the DOM anymore. * inspector-protocol/model/content-flow-content-removal-expected.txt: Added. * inspector-protocol/model/content-flow-content-removal.html: Added. Canonical link: https://commits.webkit.org/142166@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158854 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
8 changed files
with
156 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
LayoutTests/inspector-protocol/model/content-flow-content-removal-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Testing that the ContentFlows events are correctly dispatched when content nodes are detached from the DOM. | ||
|
||
PASS: ContentFlow was added. | ||
PASS: ContentFlow.contentNodes has a length of 2. | ||
PASS: ContentFlow.contentNodes[0].id is "#contentStatic". | ||
PASS: ContentFlow.contentNodes[1].id is "#contentRemoved". | ||
PASS: "#contentRemoved" was removed. | ||
PASS: "#contentRemoved" cannot be found in the contentNodes list. | ||
|
64 changes: 64 additions & 0 deletions
64
LayoutTests/inspector-protocol/model/content-flow-content-removal.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<style> | ||
.content | ||
{ | ||
-webkit-flow-into: flow; | ||
} | ||
</style> | ||
<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script> | ||
<script> | ||
function changeFlowContent() | ||
{ | ||
document.getElementById("contentRemoved").remove(); | ||
} | ||
|
||
function test() | ||
{ | ||
InspectorTest.importInspectorScripts(); | ||
|
||
var contentFlow; | ||
|
||
WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange, function(event) { | ||
var domTree = WebInspector.frameResourceManager.mainFrame.domTree; | ||
domTree.addEventListener(WebInspector.DOMTree.Event.RootDOMNodeInvalidated, onRootDOMNodeInvalidated, null); | ||
domTree.addEventListener(WebInspector.DOMTree.Event.ContentFlowWasAdded, onContentFlowWasAdded, null); | ||
domTree.requestContentFlowList(); | ||
}); | ||
|
||
function onRootDOMNodeInvalidated() | ||
{ | ||
WebInspector.frameResourceManager.mainFrame.domTree.requestContentFlowList(); | ||
} | ||
|
||
function onContentFlowWasAdded(event) | ||
{ | ||
contentFlow = event.data.flow; | ||
InspectorTest.assert(contentFlow.name === "flow", "ContentFlow was added."); | ||
InspectorTest.assert(contentFlow.contentNodes.length === 2, "ContentFlow.contentNodes has a length of 2."); | ||
InspectorTest.assert(contentFlow.contentNodes[0].getAttribute("id") === "contentStatic", "ContentFlow.contentNodes[0].id is \"#contentStatic\"."); | ||
InspectorTest.assert(contentFlow.contentNodes[1].getAttribute("id") === "contentRemoved", "ContentFlow.contentNodes[1].id is \"#contentRemoved\"."); | ||
|
||
contentFlow.addEventListener(WebInspector.ContentFlow.Event.ContentNodeWasRemoved, onContentNodeWasRemoved, null); | ||
|
||
InspectorTest.sendCommand("Runtime.evaluate", {expression: "changeFlowContent()"}); | ||
} | ||
|
||
function onContentNodeWasRemoved(event) | ||
{ | ||
InspectorTest.assert(event.data.node.getAttribute("id") === "contentRemoved", "\"#contentRemoved\" was removed."); | ||
InspectorTest.assert(contentFlow.contentNodes.indexOf(event.data.node) === -1, "\"#contentRemoved\" cannot be found in the contentNodes list."); | ||
InspectorTest.completeTest(); | ||
} | ||
} | ||
</script> | ||
</head> | ||
<body onload="runTest()"> | ||
<p>Testing that the ContentFlows events are correctly dispatched when content nodes are detached from the DOM.</p> | ||
|
||
<div id="contentStatic" class="content"></div> | ||
<div id="contentRemoved" class="content"></div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters