Changeset 56727 in webkit
- Timestamp:
- Mar 29, 2010 10:11:06 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r56722 r56727 1 2010-03-29 Alexander Pavlov <apavlov@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector should highlight when clicking a node's closing tag 6 https://bugs.webkit.org/show_bug.cgi?id=16258 7 8 * inspector/elements-panel-limited-children.html: 9 1 10 2010-03-29 Csaba Osztrogonác <ossy@webkit.org> 2 11 -
trunk/LayoutTests/inspector/elements-panel-limited-children.html
r54819 r56727 43 43 dataElement.appendChild(document.createElement("a")); 44 44 dataElement.removeChild(document.getElementById("id2")); 45 dataElement.insertBefore(document.createElement("a"), document.getElementById("id1")); 45 var aElement = document.createElement("a"); 46 dataElement.insertBefore(aElement, document.getElementById("id1")); 47 dataElement.appendChild(aElement); 48 dataElement.insertBefore(aElement, document.getElementById("id1")); 46 49 evaluateInWebInspector("frontend_dumpNode", nodeDumpBeforeCallback); 47 50 } -
trunk/WebCore/ChangeLog
r56726 r56727 1 2010-03-29 Alexander Pavlov <apavlov@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector should highlight when clicking a node's closing tag 6 https://bugs.webkit.org/show_bug.cgi?id=16258 7 8 * inspector/front-end/ElementsTreeOutline.js: 9 (WebInspector.ElementsTreeOutline.prototype.set suppressRevealAndSelect): 10 (WebInspector.ElementsTreeOutline.prototype.revealAndSelectNode): 11 (WebInspector.ElementsTreeOutline.prototype._keyDown): 12 (WebInspector.ElementsTreeOutline.prototype._onmousemove): 13 (WebInspector.ElementsTreeElement): 14 (WebInspector.ElementsTreeElement.prototype.showChild): 15 (WebInspector.ElementsTreeElement.prototype.onpopulate): 16 (WebInspector.ElementsTreeElement.prototype.updateChildren): 17 (WebInspector.ElementsTreeElement.prototype.insertChildElement): 18 (WebInspector.ElementsTreeElement.prototype.moveChild): 19 (WebInspector.ElementsTreeElement.prototype._updateChildren): 20 (WebInspector.ElementsTreeElement.prototype.onexpand): 21 (WebInspector.ElementsTreeElement.prototype.oncollapse): 22 (WebInspector.ElementsTreeElement.prototype.onselect): 23 (WebInspector.ElementsTreeElement.prototype.ondblclick): 24 (): 25 1 26 2010-03-29 Marcus Bulach <bulach@chromium.org> 2 27 -
trunk/WebCore/inspector/front-end/ElementsTreeOutline.js
r56688 r56727 183 183 }, 184 184 185 set suppressRevealAndSelect(x) 186 { 187 if (this._suppressRevealAndSelect === x) 188 return; 189 this._suppressRevealAndSelect = x; 190 }, 191 185 192 revealAndSelectNode: function(node) 186 193 { 187 if (!node )194 if (!node || this._suppressRevealAndSelect) 188 195 return; 189 196 … … 231 238 if (event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Backspace || 232 239 event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Delete) { 240 var startTagTreeElement = this.findTreeElement(selectedElement.representedObject); 241 if (selectedElement !== startTagTreeElement) 242 selectedElement = startTagTreeElement; 233 243 selectedElement.remove(); 234 244 event.preventDefault(); … … 273 283 } 274 284 275 if (element && !element.elementCloseTag) {285 if (element) { 276 286 element.hovered = true; 277 287 this._previousHoveredElement = element; 278 288 } 279 289 280 WebInspector.hoveredDOMNode = (element && !element.elementCloseTag? element.representedObject : null);290 WebInspector.hoveredDOMNode = (element ? element.representedObject : null); 281 291 }, 282 292 … … 315 325 WebInspector.ElementsTreeOutline.prototype.__proto__ = TreeOutline.prototype; 316 326 317 WebInspector.ElementsTreeElement = function(node )327 WebInspector.ElementsTreeElement = function(node, elementCloseTag) 318 328 { 319 var hasChildrenOverride = node.hasChildNodes() && !this._showInlineText(node); 329 this._elementCloseTag = elementCloseTag; 330 var hasChildrenOverride = !elementCloseTag && node.hasChildNodes() && !this._showInlineText(node); 320 331 321 332 // The title will be updated in onattach. 322 333 TreeElement.call(this, "", node, hasChildrenOverride); 323 334 324 if (this.representedObject.nodeType == Node.ELEMENT_NODE )335 if (this.representedObject.nodeType == Node.ELEMENT_NODE && !elementCloseTag) 325 336 this._canAddAttributes = true; 326 337 this._searchQuery = null; … … 393 404 { 394 405 var count = this.children.length; 395 if (count && this.children[count - 1]. elementCloseTag)406 if (count && this.children[count - 1]._elementCloseTag) 396 407 count--; 397 408 if (count && this.children[count - 1].expandAllButton) … … 402 413 showChild: function(index) 403 414 { 415 if (this._elementCloseTag) 416 return; 417 404 418 if (index >= this.expandedChildrenLimit) { 405 419 this._expandedChildrenLimit = index + 1; … … 413 427 createTooltipForImageNode: function(node, callback) 414 428 { 429 if (this._elementCloseTag) 430 return; 431 415 432 function createTooltipThenCallback(properties) 416 433 { … … 478 495 onpopulate: function() 479 496 { 480 if (this.children.length || this._showInlineText(this.representedObject) )497 if (this.children.length || this._showInlineText(this.representedObject) || this._elementCloseTag) 481 498 return; 482 499 … … 486 503 updateChildren: function(fullRefresh) 487 504 { 505 if (this._elementCloseTag) 506 return; 507 488 508 WebInspector.domAgent.getChildNodesAsync(this.representedObject, this._updateChildren.bind(this, fullRefresh)); 489 509 }, 490 510 491 insertChildElement: function(child, index )492 { 493 var newElement = new WebInspector.ElementsTreeElement(child );511 insertChildElement: function(child, index, closingTag) 512 { 513 var newElement = new WebInspector.ElementsTreeElement(child, closingTag); 494 514 newElement.selectable = this.treeOutline.selectEnabled; 495 515 this.insertChild(newElement, index); … … 500 520 { 501 521 var wasSelected = child.selected; 502 t reeElement.removeChild(child);503 t reeElement.insertChild(child, targetIndex);522 this.removeChild(child); 523 this.insertChild(child, targetIndex); 504 524 if (wasSelected) 505 existingTreeElement.select();525 child.select(); 506 526 }, 507 527 … … 565 585 // Remove any tree elements that no longer have this node (or this node's contentDocument) as their parent. 566 586 for (var i = (this.children.length - 1); i >= 0; --i) { 567 if ("elementCloseTag" in this.children[i])568 continue;569 570 587 var currentChild = this.children[i]; 571 588 var currentNode = currentChild.representedObject; … … 586 603 587 604 var lastChild = this.children[this.children.length - 1]; 588 if (this.representedObject.nodeType == Node.ELEMENT_NODE && (!lastChild || !lastChild.elementCloseTag)) { 589 var title = "<span class=\"webkit-html-tag close\"></" + this.treeOutline.nodeNameToCorrectCase(this.representedObject.nodeName).escapeHTML() + "></span>"; 590 var item = new TreeElement(title, null, false); 591 item.selectable = false; 592 item.elementCloseTag = true; 593 this.appendChild(item); 594 } 605 if (this.representedObject.nodeType == Node.ELEMENT_NODE && (!lastChild || !lastChild._elementCloseTag)) 606 this.insertChildElement(this.representedObject, this.children.length, true); 595 607 596 608 // We want to restore the original selection and tree scroll position after a full refresh, if possible. … … 646 658 onexpand: function() 647 659 { 660 if (this._elementCloseTag) 661 return; 662 648 663 this.updateTitle(); 649 664 this.treeOutline.updateSelection(); … … 652 667 oncollapse: function() 653 668 { 669 if (this._elementCloseTag) 670 return; 671 654 672 this.updateTitle(); 655 673 this.treeOutline.updateSelection(); … … 664 682 onselect: function() 665 683 { 684 this.treeOutline.suppressRevealAndSelect = true; 666 685 this.treeOutline.focusedDOMNode = this.representedObject; 667 686 this.updateSelection(); 687 this.treeOutline.suppressRevealAndSelect = false; 668 688 }, 669 689 … … 688 708 ondblclick: function(event) 689 709 { 690 if (this._editing )710 if (this._editing || this._elementCloseTag) 691 711 return; 692 712 … … 1231 1251 }, 1232 1252 1253 _tagHTML: function(tagName, isClosingTag, isDistinctTreeElement, linkify, tooltipText) 1254 { 1255 var node = this.representedObject; 1256 var result = "<span class=\"webkit-html-tag" + (isClosingTag && isDistinctTreeElement ? " close" : "") + "\"><"; 1257 result += "<span class=\"webkit-html-tag-name\">" + (isClosingTag ? "/" : "") + tagName + "</span>"; 1258 if (!isClosingTag && node.hasAttributes()) { 1259 for (var i = 0; i < node.attributes.length; ++i) { 1260 var attr = node.attributes[i]; 1261 result += " " + this._attributeHTML(attr.name, attr.value, node, linkify, tooltipText); 1262 } 1263 } 1264 result += "></span>​"; 1265 1266 return result; 1267 }, 1268 1233 1269 _nodeTitleInfo: function(linkify, tooltipText) 1234 1270 { … … 1247 1283 case Node.ELEMENT_NODE: 1248 1284 var tagName = this.treeOutline.nodeNameToCorrectCase(node.nodeName).escapeHTML(); 1249 info.title = "<span class=\"webkit-html-tag\"><"; 1250 info.title += "<span class=\"webkit-html-tag-name\">" + tagName + "</span>"; 1251 if (node.hasAttributes()) { 1252 for (var i = 0; i < node.attributes.length; ++i) { 1253 var attr = node.attributes[i]; 1254 info.title += " " + this._attributeHTML(attr.name, attr.value, node, linkify, tooltipText); 1255 } 1285 if (this._elementCloseTag) { 1286 info.title = this._tagHTML(tagName, true, true); 1287 info.hasChildren = false; 1288 break; 1256 1289 } 1257 info.title += "></span>​"; 1258 1259 const closingTagHTML = "<span class=\"webkit-html-tag\"></" + tagName + "></span>​"; 1290 1291 info.title = this._tagHTML(tagName, false, false, linkify, tooltipText); 1292 1260 1293 var textChild = onlyTextChild.call(node); 1261 1294 var showInlineText = textChild && textChild.textContent.length < Preferences.maxInlineTextChildLength; … … 1264 1297 if (this.hasChildren) 1265 1298 info.title += "<span class=\"webkit-html-text-node\">…</span>​"; 1266 info.title += closingTagHTML;1299 info.title += this._tagHTML(tagName, true, false); 1267 1300 } 1268 1301 … … 1271 1304 // create a subtree for them 1272 1305 if (showInlineText) { 1273 info.title += "<span class=\"webkit-html-text-node\">" + textChild.nodeValue.escapeHTML() + "</span>​" + closingTagHTML;1306 info.title += "<span class=\"webkit-html-text-node\">" + textChild.nodeValue.escapeHTML() + "</span>​" + this._tagHTML(tagName, true, false); 1274 1307 info.hasChildren = false; 1275 1308 }
Note: See TracChangeset
for help on using the changeset viewer.