Title: [105620] trunk
Revision
105620
Author
pfeld...@chromium.org
Date
2012-01-23 07:10:01 -0800 (Mon, 23 Jan 2012)

Log Message

Web Inspector: Inspecting an element inside an iframe no longer works
https://bugs.webkit.org/show_bug.cgi?id=76808

Reviewed by Timothy Hatcher.

Source/WebCore:

Test: http/tests/inspector/inspect-element.html

* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::innerParentNode):
* inspector/front-end/DOMAgent.js:
(WebInspector.DOMNode.prototype.getChildNodes.mycallback):
(WebInspector.DOMNode.prototype.getChildNodes):
(WebInspector.DOMNode.prototype._setChildrenPayload):
* inspector/front-end/ElementsTreeOutline.js:
(WebInspector.ElementsTreeOutline.prototype._selectedNodeChanged):

LayoutTests:

* http/tests/inspector/inspect-element-expected.txt: Added.
* http/tests/inspector/inspect-element.html: Added.
* http/tests/inspector/resources/inspect-element-iframe.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (105619 => 105620)


--- trunk/LayoutTests/ChangeLog	2012-01-23 14:52:50 UTC (rev 105619)
+++ trunk/LayoutTests/ChangeLog	2012-01-23 15:10:01 UTC (rev 105620)
@@ -1,3 +1,14 @@
+2012-01-23  Pavel Feldman  <pfeld...@google.com>
+
+        Web Inspector: Inspecting an element inside an iframe no longer works
+        https://bugs.webkit.org/show_bug.cgi?id=76808
+
+        Reviewed by Timothy Hatcher.
+
+        * http/tests/inspector/inspect-element-expected.txt: Added.
+        * http/tests/inspector/inspect-element.html: Added.
+        * http/tests/inspector/resources/inspect-element-iframe.html: Added.
+
 2012-01-23  Anton Muhin  <ant...@chromium.org>
 
         Unreviewed tweaking of test expectations: it should be IMAGE instead of IMAGE+TEXT.

Added: trunk/LayoutTests/http/tests/inspector/inspect-element-expected.txt (0 => 105620)


--- trunk/LayoutTests/http/tests/inspector/inspect-element-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/inspect-element-expected.txt	2012-01-23 15:10:01 UTC (rev 105620)
@@ -0,0 +1,5 @@
+Tests that inspect element action works for iframe children (https://bugs.webkit.org/show_bug.cgi?id=76808).
+
+
+div#div
+
Property changes on: trunk/LayoutTests/http/tests/inspector/inspect-element-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/http/tests/inspector/inspect-element.html (0 => 105620)


--- trunk/LayoutTests/http/tests/inspector/inspect-element.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/inspect-element.html	2012-01-23 15:10:01 UTC (rev 105620)
@@ -0,0 +1,33 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function test()
+{
+    WebInspector.inspectorView.setCurrentPanel(WebInspector.panels.elements);
+    WebInspector.panels.elements.treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, selectedNodeChanged, this);
+    function selectedNodeChanged(event)
+    {
+        var node = event.data;
+        if (node.getAttribute("id") == "div") {
+            InspectorTest.addResult(node.appropriateSelectorFor());
+            InspectorTest.completeTest();
+        }
+    }
+    InspectorTest.evaluateInConsole("inspect(iframeDivElement)");
+}
+
+</script>
+</head>
+
+<body>
+<p>
+Tests that inspect element action works for iframe children (https://bugs.webkit.org/show_bug.cgi?id=76808).
+</p>
+
+<iframe src="" _onload_="runTest()"></iframe>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/http/tests/inspector/inspect-element.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/http/tests/inspector/resources/inspect-element-iframe.html (0 => 105620)


--- trunk/LayoutTests/http/tests/inspector/resources/inspect-element-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/resources/inspect-element-iframe.html	2012-01-23 15:10:01 UTC (rev 105620)
@@ -0,0 +1,11 @@
+<html>
+
+<body>
+<div id="div">Element to inspect</div>
+</body>
+
+<script>
+top.iframeDivElement = document.getElementById("div");
+</script>
+
+</html>
Property changes on: trunk/LayoutTests/http/tests/inspector/resources/inspect-element-iframe.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (105619 => 105620)


--- trunk/Source/WebCore/ChangeLog	2012-01-23 14:52:50 UTC (rev 105619)
+++ trunk/Source/WebCore/ChangeLog	2012-01-23 15:10:01 UTC (rev 105620)
@@ -1,3 +1,21 @@
+2012-01-23  Pavel Feldman  <pfeld...@google.com>
+
+        Web Inspector: Inspecting an element inside an iframe no longer works
+        https://bugs.webkit.org/show_bug.cgi?id=76808
+
+        Reviewed by Timothy Hatcher.
+
+        Test: http/tests/inspector/inspect-element.html
+
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::innerParentNode):
+        * inspector/front-end/DOMAgent.js:
+        (WebInspector.DOMNode.prototype.getChildNodes.mycallback):
+        (WebInspector.DOMNode.prototype.getChildNodes):
+        (WebInspector.DOMNode.prototype._setChildrenPayload):
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeOutline.prototype._selectedNodeChanged):
+
 2012-01-23  Andrey Kosyakov  <ca...@chromium.org>
 
         Web Inspector: response.bodySize in HAR is invalid (negative) for cached resources

Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (105619 => 105620)


--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2012-01-23 14:52:50 UTC (rev 105619)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2012-01-23 15:10:01 UTC (rev 105620)
@@ -1251,6 +1251,10 @@
 
 Node* InspectorDOMAgent::innerParentNode(Node* node)
 {
+    if (node->isDocumentNode()) {
+        Document* document = static_cast<Document*>(node);
+        return document->ownerElement();
+    }
     return node->parentNode();
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/DOMAgent.js (105619 => 105620)


--- trunk/Source/WebCore/inspector/front-end/DOMAgent.js	2012-01-23 14:52:50 UTC (rev 105619)
+++ trunk/Source/WebCore/inspector/front-end/DOMAgent.js	2012-01-23 15:10:01 UTC (rev 105620)
@@ -399,6 +399,10 @@
      */
     _setChildrenPayload: function(payloads)
     {
+        // We set children in the constructor.
+        if (this._contentDocument)
+            return;
+
         this.children = [];
         for (var i = 0; i < payloads.length; ++i) {
             var payload = payloads[i];

Modified: trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js (105619 => 105620)


--- trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2012-01-23 14:52:50 UTC (rev 105619)
+++ trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2012-01-23 15:10:01 UTC (rev 105620)
@@ -184,7 +184,7 @@
 
     _selectedNodeChanged: function()
     {
-        this._eventSupport.dispatchEventToListeners(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged);
+        this._eventSupport.dispatchEventToListeners(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, this._selectedDOMNode);
     },
 
     findTreeElement: function(node)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to