Diff
Modified: trunk/LayoutTests/ChangeLog (105066 => 105067)
--- trunk/LayoutTests/ChangeLog 2012-01-16 16:47:19 UTC (rev 105066)
+++ trunk/LayoutTests/ChangeLog 2012-01-16 16:56:19 UTC (rev 105067)
@@ -1,3 +1,17 @@
+2012-01-16 Pavel Feldman <[email protected]>
+
+ Web Inspector: do not merge iframes into a single DOM hierarchy.
+ https://bugs.webkit.org/show_bug.cgi?id=76383
+
+ Reviewed by Timothy Hatcher.
+
+ * http/tests/inspector/elements-test.js:
+ (initialize_ElementTest.InspectorTest.findNode.processChildren):
+ * inspector/console/console-dirxml-expected.txt:
+ * inspector/console/console-tests-expected.txt:
+ * inspector/elements/set-outer-html-body.html:
+ * inspector/styles/styles-iframe.html:
+
2012-01-16 Philippe Normand <[email protected]>
Unreviewed, GTK rebaseline after r105061.
Modified: trunk/LayoutTests/http/tests/inspector/elements-test.js (105066 => 105067)
--- trunk/LayoutTests/http/tests/inspector/elements-test.js 2012-01-16 16:47:19 UTC (rev 105066)
+++ trunk/LayoutTests/http/tests/inspector/elements-test.js 2012-01-16 16:56:19 UTC (rev 105067)
@@ -19,11 +19,6 @@
callback(result);
return;
}
- if (childNode.shadowRoot && matchFunction(childNode.shadowRoot)) {
- result = childNode.shadowRoot;
- callback(result);
- return;
- }
pendingRequests++;
childNode.getChildNodes(processChildren.bind(null, false));
}
Modified: trunk/LayoutTests/inspector/console/console-dirxml-expected.txt (105066 => 105067)
--- trunk/LayoutTests/inspector/console/console-dirxml-expected.txt 2012-01-16 16:47:19 UTC (rev 105066)
+++ trunk/LayoutTests/inspector/console/console-dirxml-expected.txt 2012-01-16 16:56:19 UTC (rev 105067)
@@ -4,7 +4,7 @@
CONSOLE MESSAGE: line 15: [object HTMLParagraphElement]
Tests that console logging dumps proper messages.
-console-dirxml.html:12Document
+console-dirxml.html:12#document
console-dirxml.html:13Document Fragment
console-dirxml.html:14<p></p>
console-dirxml.html:15[<p></p>]
Modified: trunk/LayoutTests/inspector/console/console-tests-expected.txt (105066 => 105067)
--- trunk/LayoutTests/inspector/console/console-tests-expected.txt 2012-01-16 16:47:19 UTC (rev 105066)
+++ trunk/LayoutTests/inspector/console/console-tests-expected.txt 2012-01-16 16:56:19 UTC (rev 105067)
@@ -38,7 +38,7 @@
console-tests.html:24true console-message console-log-level
console-tests.html:25null console-message console-log-level
console-tests.html:26undefined console-message console-log-level
-console-tests.html:27Document console-message console-log-level
+console-tests.html:27#document console-message console-log-level
console-tests.html:28function () { } console-message console-log-level
console-tests.html:29function f() { } console-message console-log-level
console-tests.html:30[1, 2, 3] console-message console-log-level
Modified: trunk/LayoutTests/inspector/elements/set-outer-html-body.html (105066 => 105067)
--- trunk/LayoutTests/inspector/elements/set-outer-html-body.html 2012-01-16 16:47:19 UTC (rev 105066)
+++ trunk/LayoutTests/inspector/elements/set-outer-html-body.html 2012-01-16 16:56:19 UTC (rev 105067)
@@ -49,7 +49,6 @@
{
function dump()
{
- // User console.log for output since body has been overwritten.
DOMAgent.getOuterHTML(htmlNode.id, callback);
function callback(error, text)
{
Modified: trunk/LayoutTests/inspector/styles/styles-iframe.html (105066 => 105067)
--- trunk/LayoutTests/inspector/styles/styles-iframe.html 2012-01-16 16:47:19 UTC (rev 105066)
+++ trunk/LayoutTests/inspector/styles/styles-iframe.html 2012-01-16 16:56:19 UTC (rev 105067)
@@ -13,7 +13,7 @@
{
var iframe = document.createElement("iframe");
iframe.src = ""
- document.body.appendChild(iframe);
+ document.getElementById("main").appendChild(iframe);
}
function test()
Modified: trunk/Source/WebCore/ChangeLog (105066 => 105067)
--- trunk/Source/WebCore/ChangeLog 2012-01-16 16:47:19 UTC (rev 105066)
+++ trunk/Source/WebCore/ChangeLog 2012-01-16 16:56:19 UTC (rev 105067)
@@ -1,3 +1,32 @@
+2012-01-16 Pavel Feldman <[email protected]>
+
+ Web Inspector: do not merge iframes into a single DOM hierarchy.
+ https://bugs.webkit.org/show_bug.cgi?id=76383
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/DOMEditor.h:
+ * inspector/Inspector.json:
+ * inspector/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::unbind):
+ (WebCore::InspectorDOMAgent::buildObjectForNode):
+ (WebCore::InspectorDOMAgent::innerFirstChild):
+ (WebCore::InspectorDOMAgent::innerParentNode):
+ * inspector/front-end/CSSStyleModel.js:
+ (WebInspector.CSSStyleModel.prototype.setRuleSelector.callback):
+ (WebInspector.CSSStyleModel.prototype.setRuleSelector):
+ (WebInspector.CSSStyleModel.prototype.addRule.callback):
+ (WebInspector.CSSStyleModel.prototype.addRule):
+ (WebInspector.CSSStyleModel.prototype._ownerDocumentId):
+ * inspector/front-end/DOMAgent.js:
+ (WebInspector.DOMNode):
+ (WebInspector.DOMNode.prototype.getChildNodes):
+ (WebInspector.DOMNode.prototype._insertChild):
+ (WebInspector.DOMNode.prototype._setChildrenPayload):
+ (WebInspector.DOMDocument):
+ (WebInspector.DOMAgent.prototype._setDetachedRoot):
+ * inspector/front-end/ElementsTreeOutline.js:
+
2012-01-16 Vsevolod Vlasov <[email protected]>
Web Inspector: setCurrentFocusElement should not update selection when focus is moved to text field or text area.
Modified: trunk/Source/WebCore/inspector/DOMEditor.h (105066 => 105067)
--- trunk/Source/WebCore/inspector/DOMEditor.h 2012-01-16 16:47:19 UTC (rev 105066)
+++ trunk/Source/WebCore/inspector/DOMEditor.h 2012-01-16 16:56:19 UTC (rev 105067)
@@ -43,7 +43,6 @@
class ContainerNode;
class Document;
-class HTMLElement;
class NamedNodeMap;
class Node;
Modified: trunk/Source/WebCore/inspector/Inspector.json (105066 => 105067)
--- trunk/Source/WebCore/inspector/Inspector.json 2012-01-16 16:47:19 UTC (rev 105066)
+++ trunk/Source/WebCore/inspector/Inspector.json 2012-01-16 16:56:19 UTC (rev 105067)
@@ -1143,7 +1143,8 @@
{ "name": "internalSubset", "type": "string", "optional": true, "description": "<code>DocumentType</code>'s internalSubset." },
{ "name": "xmlVersion", "type": "string", "optional": true, "description": "<code>Document</code>'s XML version in case of XML documents." },
{ "name": "name", "type": "string", "optional": true, "description": "<code>Attr</code>'s name." },
- { "name": "value", "type": "string", "optional": true, "description": "<code>Attr</code>'s value." }
+ { "name": "value", "type": "string", "optional": true, "description": "<code>Attr</code>'s value." },
+ { "name": "contentDocument", "$ref": "Node", "optional": true, "description": "Content document for frame owner elements." }
],
"description": "DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type."
},
Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (105066 => 105067)
--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp 2012-01-16 16:47:19 UTC (rev 105066)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp 2012-01-16 16:56:19 UTC (rev 105067)
@@ -292,16 +292,19 @@
void InspectorDOMAgent::unbind(Node* node, NodeToIdMap* nodesMap)
{
+ int id = nodesMap->get(node);
+ if (!id)
+ return;
+
+ m_idToNode.remove(id);
+
if (node->isFrameOwnerElement()) {
const HTMLFrameOwnerElement* frameOwner = static_cast<const HTMLFrameOwnerElement*>(node);
if (m_domListener)
m_domListener->didRemoveDocument(frameOwner->contentDocument());
+ unbind(frameOwner->contentDocument(), nodesMap);
}
- int id = nodesMap->get(node);
- if (!id)
- return;
- m_idToNode.remove(id);
nodesMap->remove(node);
bool childrenRequested = m_childrenRequested.contains(id);
if (childrenRequested) {
@@ -1145,7 +1148,9 @@
value->setArray("attributes", buildArrayForElementAttributes(element));
if (node->isFrameOwnerElement()) {
HTMLFrameOwnerElement* frameOwner = static_cast<HTMLFrameOwnerElement*>(node);
- value->setDocumentURL(documentURLString(frameOwner->contentDocument()));
+ Document* doc = frameOwner->contentDocument();
+ if (doc)
+ value->setContentDocument(buildObjectForNode(doc, 0, nodesMap));
}
} else if (node->nodeType() == Node::DOCUMENT_NODE) {
Document* document = static_cast<Document*>(node);
@@ -1226,12 +1231,6 @@
Node* InspectorDOMAgent::innerFirstChild(Node* node)
{
- if (node->isFrameOwnerElement()) {
- HTMLFrameOwnerElement* frameOwner = static_cast<HTMLFrameOwnerElement*>(node);
- Document* doc = frameOwner->contentDocument();
- if (doc)
- return doc->firstChild();
- }
node = node->firstChild();
while (isWhitespace(node))
node = node->nextSibling();
@@ -1267,10 +1266,7 @@
Node* InspectorDOMAgent::innerParentNode(Node* node)
{
- ContainerNode* parent = node->parentNode();
- if (parent && parent->isDocumentNode())
- return static_cast<Document*>(parent)->ownerElement();
- return parent;
+ return node->parentNode();
}
bool InspectorDOMAgent::isWhitespace(Node* node)
Modified: trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js (105066 => 105067)
--- trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js 2012-01-16 16:47:19 UTC (rev 105066)
+++ trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js 2012-01-16 16:56:19 UTC (rev 105067)
@@ -197,9 +197,9 @@
if (error)
failureCallback();
else {
- var documentElementId = this._documentElementId(nodeId);
- if (documentElementId)
- WebInspector.domAgent.querySelectorAll(documentElementId, newSelector, checkAffectsCallback.bind(this, nodeId, successCallback, rulePayload));
+ var ownerDocumentId = this._ownerDocumentId(nodeId);
+ if (ownerDocumentId)
+ WebInspector.domAgent.querySelectorAll(ownerDocumentId, newSelector, checkAffectsCallback.bind(this, nodeId, successCallback, rulePayload));
else
failureCallback();
}
@@ -240,9 +240,9 @@
// Invalid syntax for a selector
failureCallback();
} else {
- var documentElementId = this._documentElementId(nodeId);
- if (documentElementId)
- WebInspector.domAgent.querySelectorAll(documentElementId, selector, checkAffectsCallback.bind(this, nodeId, successCallback, rulePayload));
+ var ownerDocumentId = this._ownerDocumentId(nodeId);
+ if (ownerDocumentId)
+ WebInspector.domAgent.querySelectorAll(ownerDocumentId, selector, checkAffectsCallback.bind(this, nodeId, successCallback, rulePayload));
else
failureCallback();
}
@@ -256,12 +256,12 @@
this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.MediaQueryResultChanged);
},
- _documentElementId: function(nodeId)
+ _ownerDocumentId: function(nodeId)
{
var node = WebInspector.domAgent.nodeForId(nodeId);
if (!node)
return null;
- return node.ownerDocumentElement().id;
+ return node.ownerDocument ? node.ownerDocument.id : null;
},
/**
Modified: trunk/Source/WebCore/inspector/front-end/DOMAgent.js (105066 => 105067)
--- trunk/Source/WebCore/inspector/front-end/DOMAgent.js 2012-01-16 16:47:19 UTC (rev 105066)
+++ trunk/Source/WebCore/inspector/front-end/DOMAgent.js 2012-01-16 16:56:19 UTC (rev 105067)
@@ -31,10 +31,12 @@
/**
* @constructor
- * @param {WebInspector.DOMDocument} doc
+ * @param {WebInspector.DOMAgent} domAgent
+ * @param {?WebInspector.DOMDocument} doc
* @param {DOMAgent.Node} payload
*/
-WebInspector.DOMNode = function(doc, payload) {
+WebInspector.DOMNode = function(domAgent, doc, payload) {
+ this._domAgent = domAgent;
this.ownerDocument = doc;
this.id = payload.nodeId;
@@ -60,15 +62,18 @@
if (payload.children)
this._setChildrenPayload(payload.children);
- this._computedStyle = null;
- this.style = null;
- this._matchedCSSRules = [];
+ if (payload.contentDocument) {
+ this._contentDocument = new WebInspector.DOMDocument(domAgent, payload.contentDocument);
+ this.children = [this._contentDocument];
+ this._renumber();
+ this._domAgent._idToDOMNode[this._contentDocument.id] = this._contentDocument;
+ }
if (this._nodeType === Node.ELEMENT_NODE) {
// HTML and BODY from internal iframes should not overwrite top-level ones.
- if (!this.ownerDocument.documentElement && this._nodeName === "HTML")
+ if (this.ownerDocument && !this.ownerDocument.documentElement && this._nodeName === "HTML")
this.ownerDocument.documentElement = this;
- if (!this.ownerDocument.body && this._nodeName === "BODY")
+ if (this.ownerDocument && !this.ownerDocument.body && this._nodeName === "BODY")
this.ownerDocument.body = this;
if (payload.documentURL)
this.documentURL = payload.documentURL;
@@ -241,6 +246,7 @@
if (!error && callback)
callback(this.children);
}
+
DOMAgent.requestChildNodes(this.id, mycallback.bind(this));
},
@@ -371,7 +377,7 @@
*/
_insertChild: function(prev, payload)
{
- var node = new WebInspector.DOMNode(this.ownerDocument, payload);
+ var node = new WebInspector.DOMNode(this._domAgent, this.ownerDocument, payload);
if (!prev) {
if (!this.children) {
// First node
@@ -402,7 +408,7 @@
this.children = [];
for (var i = 0; i < payloads.length; ++i) {
var payload = payloads[i];
- var node = new WebInspector.DOMNode(this.ownerDocument, payload);
+ var node = new WebInspector.DOMNode(this._domAgent, this.ownerDocument, payload);
this.children.push(node);
}
this._renumber();
@@ -468,19 +474,6 @@
},
/**
- * @return {WebInspector.DOMNode}
- */
- ownerDocumentElement: function()
- {
- // document element is the child of the document / frame owner node that has documentURL property.
- // FIXME: return document nodes as a part of the DOM tree structure.
- var node = this;
- while (node.parentNode && !node.parentNode.documentURL)
- node = node.parentNode;
- return node;
- },
-
- /**
* @param {WebInspector.DOMNode} targetNode
* @param {?WebInspector.DOMNode} anchorNode
* @param {function(?Protocol.Error)=} callback
@@ -507,14 +500,13 @@
*/
WebInspector.DOMDocument = function(domAgent, payload)
{
- WebInspector.DOMNode.call(this, this, payload);
+ WebInspector.DOMNode.call(this, domAgent, this, payload);
/**
* @type {string} Document nodes always have documentURL
*/
this.documentURL;
this._listeners = {};
- this._domAgent = domAgent;
}
WebInspector.DOMDocument.prototype.__proto__ = WebInspector.DOMNode.prototype;
@@ -756,7 +748,7 @@
*/
_setDetachedRoot: function(payload)
{
- var root = new WebInspector.DOMNode(this._document, payload);
+ var root = new WebInspector.DOMNode(this, null, payload);
this._idToDOMNode[payload.nodeId] = root;
},
Modified: trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js (105066 => 105067)
--- trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js 2012-01-16 16:47:19 UTC (rev 105066)
+++ trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js 2012-01-16 16:56:19 UTC (rev 105067)
@@ -1518,10 +1518,6 @@
var info = {titleDOM: document.createDocumentFragment(), hasChildren: this.hasChildren};
switch (node.nodeType()) {
- case Node.DOCUMENT_NODE:
- info.titleDOM.appendChild(document.createTextNode("Document"));
- break;
-
case Node.DOCUMENT_FRAGMENT_NODE:
info.titleDOM.appendChild(document.createTextNode("Document Fragment"));
break;