Changeset 243152 in webkit
- Timestamp:
- Mar 19, 2019, 11:03:33 AM (8 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
UserInterface/Models/DOMNode.js (modified) (1 diff)
-
UserInterface/Views/ContextMenuUtilities.js (modified) (7 diffs)
-
UserInterface/Views/DOMTreeElement.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r243087 r243152 1 2019-03-19 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: DOM: "Capture Screenshot" should only be shown if the node is attached 4 https://bugs.webkit.org/show_bug.cgi?id=195793 5 <rdar://problem/48916594> 6 7 Reviewed by Joseph Pecoraro. 8 9 * UserInterface/Models/DOMNode.js: 10 (WI.DOMNode.prototype.get attached): Added. 11 12 * UserInterface/Views/ContextMenuUtilities.js: 13 (WI.appendContextMenuItemsForDOMNode): 14 * UserInterface/Views/DOMTreeElement.js: 15 (WI.DOMTreeElement.prototype._populateTagContextMenu): 16 1 17 2019-03-18 Joseph Pecoraro <pecoraro@apple.com> 2 18 -
trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js
r241547 r243152 192 192 this._frame = WI.networkManager.frameForIdentifier(this.frameIdentifier); 193 193 return this._frame; 194 } 195 196 get attached() 197 { 198 for (let node = this; node; node = node.parentNode) { 199 if (node.ownerDocument === node) 200 return true; 201 } 202 return false; 194 203 } 195 204 -
trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js
r242992 r243152 157 157 158 158 let isElement = domNode.nodeType() === Node.ELEMENT_NODE; 159 if (domNode.ownerDocument && isElement) { 159 let attached = domNode.attached; 160 161 if (isElement && attached) { 160 162 copySubMenu.appendItem(WI.UIString("Selector Path"), () => { 161 163 let cssPath = WI.cssPath(domNode); … … 164 166 } 165 167 166 if ( domNode.ownerDocument && !domNode.isPseudoElement()) {168 if (!domNode.isPseudoElement() && attached) { 167 169 copySubMenu.appendItem(WI.UIString("XPath"), () => { 168 170 let xpath = WI.xpath(domNode); … … 206 208 } 207 209 208 if (WI.domDebuggerManager.supported && isElement && !domNode.isPseudoElement() && domNode.ownerDocument) {210 if (WI.domDebuggerManager.supported && isElement && !domNode.isPseudoElement() && attached) { 209 211 contextMenu.appendSeparator(); 210 212 … … 225 227 } 226 228 227 if (!options.excludeRevealElement && window.DOMAgent && domNode.ownerDocument) {229 if (!options.excludeRevealElement && window.DOMAgent && attached) { 228 230 contextMenu.appendItem(WI.UIString("Reveal in DOM Tree"), () => { 229 231 WI.domManager.inspectElement(domNode.id); … … 231 233 } 232 234 233 if (!options.excludeRevealLayer && window.LayerTreeAgent && domNode.parentNode) {235 if (!options.excludeRevealLayer && window.LayerTreeAgent && attached) { 234 236 contextMenu.appendItem(WI.UIString("Reveal in Layers Tab"), () => { 235 237 WI.showLayersTab({nodeToSelect: domNode}); … … 237 239 } 238 240 239 if (window.PageAgent ) {241 if (window.PageAgent && attached) { 240 242 contextMenu.appendItem(WI.UIString("Capture Screenshot"), () => { 241 243 PageAgent.snapshotNode(domNode.id, (error, dataURL) => { … … 260 262 } 261 263 262 if (isElement ) {264 if (isElement && attached) { 263 265 contextMenu.appendItem(WI.UIString("Scroll Into View"), () => { 264 266 domNode.scrollIntoView(); -
trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
r242811 r243152 728 728 let node = this.representedObject; 729 729 let isNonShadowEditable = !node.isInUserAgentShadowTree() && this.editable; 730 let attached = node.attached; 730 731 731 732 if (event.target && event.target.tagName === "A") { … … 761 762 } 762 763 763 let attributeValue = this.representedObject.getAttribute(attributeName);764 let attributeValue = node.getAttribute(attributeName); 764 765 subMenus.copy.appendItem(WI.UIString("Attribute"), () => { 765 766 let text = attributeName; … … 770 771 771 772 subMenus.delete.appendItem(WI.UIString("Attribute"), () => { 772 this.representedObject.removeAttribute(attributeName);773 node.removeAttribute(attributeName); 773 774 }, !attribute || !isNonShadowEditable); 774 775 … … 779 780 contextMenu.appendSeparator(); 780 781 781 if (WI.cssManager.canForcePseudoClasses() ) {782 if (WI.cssManager.canForcePseudoClasses() && attached) { 782 783 let pseudoSubMenu = contextMenu.appendSubMenuItem(WI.UIString("Forced Pseudo-Classes")); 783 784 784 let enabledPseudoClasses = this.representedObject.enabledPseudoClasses;785 let enabledPseudoClasses = node.enabledPseudoClasses; 785 786 WI.CSSManager.ForceablePseudoClasses.forEach((pseudoClass) => { 786 787 let enabled = enabledPseudoClasses.includes(pseudoClass); 787 788 pseudoSubMenu.appendCheckboxItem(pseudoClass.capitalize(), () => { 788 this.representedObject.setPseudoClassEnabled(pseudoClass, !enabled);789 node.setPseudoClassEnabled(pseudoClass, !enabled); 789 790 }, enabled); 790 791 });
Note:
See TracChangeset
for help on using the changeset viewer.