Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 return; | 232 return; |
| 233 | 233 |
| 234 if (!this.selectionElement) { | 234 if (!this.selectionElement) { |
| 235 this.selectionElement = createElement('div'); | 235 this.selectionElement = createElement('div'); |
| 236 this.selectionElement.className = 'selection fill'; | 236 this.selectionElement.className = 'selection fill'; |
| 237 this.selectionElement.style.setProperty('margin-left', (-this._computeLeft Indent()) + 'px'); | 237 this.selectionElement.style.setProperty('margin-left', (-this._computeLeft Indent()) + 'px'); |
| 238 listItemElement.insertBefore(this.selectionElement, listItemElement.firstC hild); | 238 listItemElement.insertBefore(this.selectionElement, listItemElement.firstC hild); |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 | 241 |
| 242 _createHint() { | |
| 243 if (this.listItemElement && !this._hintElement) { | |
| 244 this._hintElement = this.listItemElement.createChild('span', 'selected-hin t'); | |
| 245 this._hintElement.title = Common.UIString('Use $0 in the console to refer to this element.'); | |
| 246 } | |
| 247 } | |
| 248 | |
| 242 /** | 249 /** |
| 243 * @override | 250 * @override |
| 244 */ | 251 */ |
| 245 onbind() { | 252 onbind() { |
| 246 if (!this._elementCloseTag) | 253 if (!this._elementCloseTag) |
| 247 this._node[this.treeOutline.treeElementSymbol()] = this; | 254 this._node[this.treeOutline.treeElementSymbol()] = this; |
| 248 } | 255 } |
| 249 | 256 |
| 250 /** | 257 /** |
| 251 * @override | 258 * @override |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 321 * @return {boolean} | 328 * @return {boolean} |
| 322 */ | 329 */ |
| 323 onselect(selectedByUser) { | 330 onselect(selectedByUser) { |
| 324 this.treeOutline.suppressRevealAndSelect = true; | 331 this.treeOutline.suppressRevealAndSelect = true; |
| 325 this.treeOutline.selectDOMNode(this._node, selectedByUser); | 332 this.treeOutline.selectDOMNode(this._node, selectedByUser); |
| 326 if (selectedByUser) { | 333 if (selectedByUser) { |
| 327 this._node.highlight(); | 334 this._node.highlight(); |
| 328 Host.userMetrics.actionTaken(Host.UserMetrics.Action.ChangeInspectedNodeIn ElementsPanel); | 335 Host.userMetrics.actionTaken(Host.UserMetrics.Action.ChangeInspectedNodeIn ElementsPanel); |
| 329 } | 336 } |
| 330 this._createSelection(); | 337 this._createSelection(); |
| 338 this._createHint(); | |
| 331 this.treeOutline.suppressRevealAndSelect = false; | 339 this.treeOutline.suppressRevealAndSelect = false; |
| 332 return true; | 340 return true; |
| 333 } | 341 } |
| 334 | 342 |
| 335 /** | 343 /** |
| 336 * @override | 344 * @override |
| 337 * @return {boolean} | 345 * @return {boolean} |
| 338 */ | 346 */ |
| 339 ondelete() { | 347 ondelete() { |
| 340 var startTagTreeElement = this.treeOutline.findTreeElement(this._node); | 348 var startTagTreeElement = this.treeOutline.findTreeElement(this._node); |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1041 else | 1049 else |
| 1042 this.childrenListElement.classList.add('shadow-root-depth-' + depth); | 1050 this.childrenListElement.classList.add('shadow-root-depth-' + depth); |
| 1043 } | 1051 } |
| 1044 var highlightElement = createElement('span'); | 1052 var highlightElement = createElement('span'); |
| 1045 highlightElement.className = 'highlight'; | 1053 highlightElement.className = 'highlight'; |
| 1046 highlightElement.appendChild(nodeInfo); | 1054 highlightElement.appendChild(nodeInfo); |
| 1047 this.title = highlightElement; | 1055 this.title = highlightElement; |
| 1048 this.updateDecorations(); | 1056 this.updateDecorations(); |
| 1049 this.listItemElement.insertBefore(this._gutterContainer, this.listItemElem ent.firstChild); | 1057 this.listItemElement.insertBefore(this._gutterContainer, this.listItemElem ent.firstChild); |
| 1050 delete this._highlightResult; | 1058 delete this._highlightResult; |
| 1059 delete this.selectionElement; | |
| 1060 delete this._hintElement; | |
| 1061 if (this.selected) { | |
| 1062 this._createSelection(); | |
| 1063 this._createHint(); | |
| 1064 } | |
|
luoe
2017/03/25 01:38:23
Drive by: It turns out that making tons of search
| |
| 1051 } | 1065 } |
| 1052 | 1066 |
| 1053 delete this.selectionElement; | |
| 1054 if (this.selected) | |
| 1055 this._createSelection(); | |
| 1056 this._highlightSearchResults(); | 1067 this._highlightSearchResults(); |
| 1057 } | 1068 } |
| 1058 | 1069 |
| 1059 /** | 1070 /** |
| 1060 * @return {number} | 1071 * @return {number} |
| 1061 */ | 1072 */ |
| 1062 _computeLeftIndent() { | 1073 _computeLeftIndent() { |
| 1063 var treeElement = this.parent; | 1074 var treeElement = this.parent; |
| 1064 var depth = 0; | 1075 var depth = 0; |
| 1065 while (treeElement !== null) { | 1076 while (treeElement !== null) { |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1609 Elements.ElementsTreeElement.ForbiddenClosingTagElements = new Set([ | 1620 Elements.ElementsTreeElement.ForbiddenClosingTagElements = new Set([ |
| 1610 'area', 'base', 'basefont', 'br', 'canvas', 'col', 'command', 'embed', 'frame', 'hr', | 1621 'area', 'base', 'basefont', 'br', 'canvas', 'col', 'command', 'embed', 'frame', 'hr', |
| 1611 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr' | 1622 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr' |
| 1612 ]); | 1623 ]); |
| 1613 | 1624 |
| 1614 // These tags we do not allow editing their tag name. | 1625 // These tags we do not allow editing their tag name. |
| 1615 Elements.ElementsTreeElement.EditTagBlacklist = new Set(['html', 'head', 'body'] ); | 1626 Elements.ElementsTreeElement.EditTagBlacklist = new Set(['html', 'head', 'body'] ); |
| 1616 | 1627 |
| 1617 /** @typedef {{cancel: function(), commit: function(), resize: function(), edito r:!UI.TextEditor}} */ | 1628 /** @typedef {{cancel: function(), commit: function(), resize: function(), edito r:!UI.TextEditor}} */ |
| 1618 Elements.MultilineEditorController; | 1629 Elements.MultilineEditorController; |
| OLD | NEW |