Changeset 107093 in webkit
- Timestamp:
- Feb 8, 2012 8:42:23 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r107090 r107093 1 2012-02-08 Pavel Feldman <pfeldman@google.com> 2 3 Web Inspector: bind entire subtree upon childNodeInserted so that text node were accounted. 4 https://bugs.webkit.org/show_bug.cgi?id=78116 5 6 Reviewed by Yury Semikhatsky. 7 8 * inspector/elements/insert-node-expected.txt: 9 * inspector/elements/insert-node.html: 10 1 11 2012-02-08 Michael Brüning <michael.bruning@nokia.com> 2 12 -
trunk/LayoutTests/inspector/elements/insert-node-expected.txt
r79553 r107093 40 40 </div> 41 41 42 Running: testAppendWithText 43 ======== Appended with text========= 44 - <div id="container"> 45 <div id="child-before"></div> 46 <div id="child1"></div> 47 <div id="child-middle"></div> 48 <div id="child2"></div> 49 <div id="child3"></div> 50 <div id="child-after"></div> 51 <div style="display: none; " id="child-with-text">Text</div> 52 </div> 53 Success: child text is bound 54 -
trunk/LayoutTests/inspector/elements/insert-node.html
r78576 r107093 27 27 var child = document.createElement("div"); 28 28 child.setAttribute("id", "child-after"); 29 container.appendChild(child); 30 } 31 32 function appendChildWithText() 33 { 34 var container = document.getElementById("container"); 35 var child = document.createElement("div"); 36 child.style.display = "none"; 37 child.innerText = "Text"; 38 child.setAttribute("id", "child-with-text"); 29 39 container.appendChild(child); 30 40 } … … 70 80 }, 71 81 72 function testAppend(next) { 82 function testAppend(next) 83 { 73 84 function callback() 74 85 { … … 78 89 } 79 90 InspectorTest.evaluateInPage("appendChild()", callback); 91 }, 92 93 function testAppendWithText(next) 94 { 95 function callback() 96 { 97 InspectorTest.addResult("======== Appended with text========="); 98 InspectorTest.dumpElementsTree(containerNode); 99 var newNode = InspectorTest.expandedNodeWithId("child-with-text"); 100 if (WebInspector.domAgent.nodeForId(newNode.firstChild.id)) 101 InspectorTest.addResult("Success: child text is bound"); 102 else 103 InspectorTest.addResult("Failed: child text is not bound"); 104 next(); 105 } 106 InspectorTest.evaluateInPage("appendChildWithText()", callback); 80 107 } 81 108 ]); -
trunk/Source/WebCore/ChangeLog
r107091 r107093 1 2012-02-08 Pavel Feldman <pfeldman@google.com> 2 3 Web Inspector: bind entire subtree upon childNodeInserted so that text node were accounted. 4 https://bugs.webkit.org/show_bug.cgi?id=78116 5 6 Reviewed by Yury Semikhatsky. 7 8 * inspector/front-end/DOMAgent.js: 9 (WebInspector.DOMNode): 10 (WebInspector.DOMDocument): 11 (WebInspector.DOMAgent.prototype._setDocument): 12 (WebInspector.DOMAgent.prototype._setDetachedRoot): 13 (WebInspector.DOMAgent.prototype._setChildNodes): 14 (WebInspector.DOMAgent.prototype._childNodeRemoved): 15 (WebInspector.DOMAgent.prototype._unbind): 16 1 17 2012-02-08 Peter Rybin <peter.rybin@gmail.com> 2 18 -
trunk/Source/WebCore/inspector/front-end/DOMAgent.js
r106811 r107093 41 41 42 42 this.id = payload.nodeId; 43 domAgent._idToDOMNode[this.id] = this; 43 44 this._nodeType = payload.nodeType; 44 45 this._nodeName = payload.nodeName; … … 645 646 this.documentURL = payload.documentURL || ""; 646 647 this.xmlVersion = payload.xmlVersion; 647 domAgent._idToDOMNode[this.id] = this;648 648 this._listeners = {}; 649 649 } … … 877 877 { 878 878 this._idToDOMNode = {}; 879 if (payload && "nodeId" in payload) {879 if (payload && "nodeId" in payload) 880 880 this._document = new WebInspector.DOMDocument(this, payload); 881 if (this._document.children) 882 this._bindNodes(this._document.children); 883 } else 881 else 884 882 this._document = null; 885 883 this.dispatchEventToListeners(WebInspector.DOMAgent.Events.DocumentUpdated, this._document); … … 891 889 _setDetachedRoot: function(payload) 892 890 { 893 var root = new WebInspector.DOMNode(this, null, payload); 894 this._idToDOMNode[payload.nodeId] = root; 891 new WebInspector.DOMNode(this, null, payload); 895 892 }, 896 893 … … 908 905 var parent = this._idToDOMNode[parentId]; 909 906 parent._setChildrenPayload(payloads); 910 this._bindNodes(parent.children);911 },912 913 /**914 * @param {Array.<WebInspector.DOMNode>} children915 */916 _bindNodes: function(children)917 {918 for (var i = 0; i < children.length; ++i) {919 var child = children[i];920 this._idToDOMNode[child.id] = child;921 if (child.children)922 this._bindNodes(child.children);923 }924 907 }, 925 908 … … 958 941 var node = this._idToDOMNode[nodeId]; 959 942 parent._removeChild(node); 943 this._unbind(node); 960 944 this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeRemoved, {node:node, parent:parent}); 961 delete this._idToDOMNode[nodeId]; 945 }, 946 947 /** 948 * @param {DOMAgent.Node} node 949 */ 950 _unbind: function(node) 951 { 952 delete this._idToDOMNode[node.id]; 953 for (var i = 0; node.children && i < node.children.length; ++i) 954 this._unbind(node.children[i]); 962 955 }, 963 956
Note: See TracChangeset
for help on using the changeset viewer.