Title: [200539] trunk/Source
- Revision
- 200539
- Author
- joep...@webkit.org
- Date
- 2016-05-06 22:52:01 -0700 (Fri, 06 May 2016)
Log Message
Web Inspector: Inspect Element and Element Selection searching should work with Shadow DOM Nodes
https://bugs.webkit.org/show_bug.cgi?id=157446
<rdar://problem/24688447>
Reviewed by Ryosuke Niwa.
Source/WebCore:
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::innerParentNode):
The Inspector backend was informing the frontend that all ShadowRoots
were floating and had no parent. Get the host element for ShadowRoots.
* rendering/HitTestResult.cpp:
(WebCore::moveOutOfUserAgentShadowTree):
(WebCore::HitTestResult::setToNonShadowAncestor):
EventHandler::mouseMoved is calling setToNonShadowAncestor before
notifying Page::chrome / Inspector about the moused over element.
This should be the deepest non-user-agent-shadow node.
Source/WebInspectorUI:
* UserInterface/Models/DOMNode.js:
(WebInspector.DOMNode):
Shadow DOM nodes did not have a parent, and so when attempting
to create DOM Tree elements up the chain, we were failing at
shadow boundaries. Create the parent relationship, the parent
already treats it as a child.
* UserInterface/Views/DOMTreeOutline.js:
(WebInspector.DOMTreeOutline.prototype._revealAndSelectNode):
Whenever we try to reveal and select an element in a shadow tree
but the setting to show shadow DOM is disabled, walk up until
we are out of the shadow tree.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (200538 => 200539)
--- trunk/Source/WebCore/ChangeLog 2016-05-07 05:44:40 UTC (rev 200538)
+++ trunk/Source/WebCore/ChangeLog 2016-05-07 05:52:01 UTC (rev 200539)
@@ -1,5 +1,25 @@
2016-05-06 Joseph Pecoraro <pecor...@apple.com>
+ Web Inspector: Inspect Element and Element Selection searching should work with Shadow DOM Nodes
+ https://bugs.webkit.org/show_bug.cgi?id=157446
+ <rdar://problem/24688447>
+
+ Reviewed by Ryosuke Niwa.
+
+ * inspector/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::innerParentNode):
+ The Inspector backend was informing the frontend that all ShadowRoots
+ were floating and had no parent. Get the host element for ShadowRoots.
+
+ * rendering/HitTestResult.cpp:
+ (WebCore::moveOutOfUserAgentShadowTree):
+ (WebCore::HitTestResult::setToNonShadowAncestor):
+ EventHandler::mouseMoved is calling setToNonShadowAncestor before
+ notifying Page::chrome / Inspector about the moused over element.
+ This should be the deepest non-user-agent-shadow node.
+
+2016-05-06 Joseph Pecoraro <pecor...@apple.com>
+
Web Inspector: Misc CommandLineAPI cleanup
https://bugs.webkit.org/show_bug.cgi?id=157450
Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (200538 => 200539)
--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp 2016-05-07 05:44:40 UTC (rev 200538)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp 2016-05-07 05:52:01 UTC (rev 200539)
@@ -1850,6 +1850,8 @@
ASSERT(node);
if (is<Document>(*node))
return downcast<Document>(*node).ownerElement();
+ if (is<ShadowRoot>(*node))
+ return downcast<ShadowRoot>(*node).host();
return node->parentNode();
}
Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (200538 => 200539)
--- trunk/Source/WebCore/rendering/HitTestResult.cpp 2016-05-07 05:44:40 UTC (rev 200538)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp 2016-05-07 05:52:01 UTC (rev 200539)
@@ -121,16 +121,27 @@
return *this;
}
+static Node* moveOutOfUserAgentShadowTree(Node& node)
+{
+ if (node.isInShadowTree()) {
+ if (ShadowRoot* root = node.containingShadowRoot()) {
+ if (root->type() == ShadowRoot::Type::UserAgent)
+ return root->host();
+ }
+ }
+ return &node;
+}
+
void HitTestResult::setToNonShadowAncestor()
{
- Node* node = innerNode();
- if (node)
- node = node->document().ancestorInThisScope(node);
- setInnerNode(node);
- node = innerNonSharedNode();
- if (node)
- node = node->document().ancestorInThisScope(node);
- setInnerNonSharedNode(node);
+ if (Node* node = innerNode()) {
+ node = moveOutOfUserAgentShadowTree(*node);
+ setInnerNode(node);
+ }
+ if (Node *node = innerNonSharedNode()) {
+ node = moveOutOfUserAgentShadowTree(*node);
+ setInnerNonSharedNode(node);
+ }
}
void HitTestResult::setInnerNode(Node* node)
Modified: trunk/Source/WebInspectorUI/ChangeLog (200538 => 200539)
--- trunk/Source/WebInspectorUI/ChangeLog 2016-05-07 05:44:40 UTC (rev 200538)
+++ trunk/Source/WebInspectorUI/ChangeLog 2016-05-07 05:52:01 UTC (rev 200539)
@@ -1,3 +1,24 @@
+2016-05-06 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: Inspect Element and Element Selection searching should work with Shadow DOM Nodes
+ https://bugs.webkit.org/show_bug.cgi?id=157446
+ <rdar://problem/24688447>
+
+ Reviewed by Ryosuke Niwa.
+
+ * UserInterface/Models/DOMNode.js:
+ (WebInspector.DOMNode):
+ Shadow DOM nodes did not have a parent, and so when attempting
+ to create DOM Tree elements up the chain, we were failing at
+ shadow boundaries. Create the parent relationship, the parent
+ already treats it as a child.
+
+ * UserInterface/Views/DOMTreeOutline.js:
+ (WebInspector.DOMTreeOutline.prototype._revealAndSelectNode):
+ Whenever we try to reveal and select an element in a shadow tree
+ but the setting to show shadow DOM is disabled, walk up until
+ we are out of the shadow tree.
+
2016-05-06 Nikita Vasilyev <nvasil...@apple.com>
Web Inspector: Unexpected white border at the bottom of Debugger filter bar
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js (200538 => 200539)
--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js 2016-05-07 05:44:40 UTC (rev 200538)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js 2016-05-07 05:52:01 UTC (rev 200539)
@@ -71,11 +71,13 @@
this._enabledPseudoClasses = [];
+ // FIXME: The logic around this._shadowRoots and this._children is very confusing.
this._shadowRoots = [];
if (payload.shadowRoots) {
for (var i = 0; i < payload.shadowRoots.length; ++i) {
var root = payload.shadowRoots[i];
var node = new WebInspector.DOMNode(this._domTreeManager, this.ownerDocument, true, root);
+ node.parentNode = this;
this._shadowRoots.push(node);
}
}
@@ -87,6 +89,8 @@
if (payload.children)
this._setChildrenPayload(payload.children);
+ else if (!this._children && this._shadowRoots.length)
+ this._children = this._shadowRoots.slice();
this._pseudoElements = new Map;
if (payload.pseudoElements) {
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js (200538 => 200539)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js 2016-05-07 05:44:40 UTC (rev 200538)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js 2016-05-07 05:52:01 UTC (rev 200539)
@@ -282,6 +282,13 @@
if (!node || this._suppressRevealAndSelect)
return;
+ if (!WebInspector.showShadowDOMSetting.value) {
+ while (node && node.isInShadowTree())
+ node = node.parentNode;
+ if (!node)
+ return;
+ }
+
var treeElement = this.createTreeElementFor(node);
if (!treeElement)
return;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes