Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js

Issue 1998723003: DevTools: add expand/collapse-subtree to context menu for DOM elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address patch 1 comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 var openTagElement = this._node[this.treeOutline.treeElementSymbol()] || this; 538 var openTagElement = this._node[this.treeOutline.treeElementSymbol()] || this;
539 var isEditable = this.hasEditableNode(); 539 var isEditable = this.hasEditableNode();
540 if (isEditable && !this._editing) 540 if (isEditable && !this._editing)
541 contextMenu.appendItem(WebInspector.UIString("Edit as HTML"), this._ editAsHTML.bind(this)); 541 contextMenu.appendItem(WebInspector.UIString("Edit as HTML"), this._ editAsHTML.bind(this));
542 var isShadowRoot = this._node.isShadowRoot(); 542 var isShadowRoot = this._node.isShadowRoot();
543 543
544 // Place it here so that all "Copy"-ing items stick together. 544 // Place it here so that all "Copy"-ing items stick together.
545 var copyMenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Copy ")); 545 var copyMenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Copy "));
546 var createShortcut = WebInspector.KeyboardShortcut.shortcutToString; 546 var createShortcut = WebInspector.KeyboardShortcut.shortcutToString;
547 var modifier = WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta; 547 var modifier = WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta;
548 var treeOutline = this.treeOutline;
548 var menuItem; 549 var menuItem;
549 if (!isShadowRoot) 550 if (!isShadowRoot)
550 menuItem = copyMenu.appendItem(WebInspector.UIString("Copy outerHTML "), this.treeOutline.performCopyOrCut.bind(this.treeOutline, false, this._node)) ; 551 menuItem = copyMenu.appendItem(WebInspector.UIString("Copy outerHTML "), treeOutline.performCopyOrCut.bind(treeOutline, false, this._node));
551 menuItem.setShortcut(createShortcut("V", modifier)); 552 menuItem.setShortcut(createShortcut("V", modifier));
552 if (this._node.nodeType() === Node.ELEMENT_NODE) 553 if (this._node.nodeType() === Node.ELEMENT_NODE)
553 copyMenu.appendItem(WebInspector.UIString.capitalize("Copy selector" ), this._copyCSSPath.bind(this)); 554 copyMenu.appendItem(WebInspector.UIString.capitalize("Copy selector" ), this._copyCSSPath.bind(this));
554 if (!isShadowRoot) 555 if (!isShadowRoot)
555 copyMenu.appendItem(WebInspector.UIString("Copy XPath"), this._copyX Path.bind(this)); 556 copyMenu.appendItem(WebInspector.UIString("Copy XPath"), this._copyX Path.bind(this));
556 if (!isShadowRoot) { 557 if (!isShadowRoot) {
557 var treeOutline = this.treeOutline;
558 menuItem = copyMenu.appendItem(WebInspector.UIString("Cut element"), treeOutline.performCopyOrCut.bind(treeOutline, true, this._node), !this.hasEdit ableNode()); 558 menuItem = copyMenu.appendItem(WebInspector.UIString("Cut element"), treeOutline.performCopyOrCut.bind(treeOutline, true, this._node), !this.hasEdit ableNode());
559 menuItem.setShortcut(createShortcut("X", modifier)); 559 menuItem.setShortcut(createShortcut("X", modifier));
560 menuItem = copyMenu.appendItem(WebInspector.UIString("Copy element") , treeOutline.performCopyOrCut.bind(treeOutline, false, this._node)); 560 menuItem = copyMenu.appendItem(WebInspector.UIString("Copy element") , treeOutline.performCopyOrCut.bind(treeOutline, false, this._node));
561 menuItem.setShortcut(createShortcut("C", modifier)); 561 menuItem.setShortcut(createShortcut("C", modifier));
562 menuItem = copyMenu.appendItem(WebInspector.UIString("Paste element" ), treeOutline.pasteNode.bind(treeOutline, this._node), !treeOutline.canPaste(th is._node)); 562 menuItem = copyMenu.appendItem(WebInspector.UIString("Paste element" ), treeOutline.pasteNode.bind(treeOutline, this._node), !treeOutline.canPaste(th is._node));
563 menuItem.setShortcut(createShortcut("V", modifier)); 563 menuItem.setShortcut(createShortcut("V", modifier));
564 } 564 }
565 565
566 contextMenu.appendSeparator(); 566 contextMenu.appendSeparator();
567 menuItem = contextMenu.appendCheckboxItem(WebInspector.UIString("Hide el ement"), this.treeOutline.toggleHideElement.bind(this.treeOutline, this._node), this.treeOutline.isToggledToHidden(this._node)); 567 menuItem = contextMenu.appendCheckboxItem(WebInspector.UIString("Hide el ement"), treeOutline.toggleHideElement.bind(treeOutline, this._node), treeOutlin e.isToggledToHidden(this._node));
568 menuItem.setShortcut(WebInspector.shortcutRegistry.shortcutTitleForActio n("elements.hide-element")); 568 menuItem.setShortcut(WebInspector.shortcutRegistry.shortcutTitleForActio n("elements.hide-element"));
569 569
570 570
571 if (isEditable) 571 if (isEditable)
572 contextMenu.appendItem(WebInspector.UIString("Delete element"), this .remove.bind(this)); 572 contextMenu.appendItem(WebInspector.UIString("Delete element"), this .remove.bind(this));
573 contextMenu.appendSeparator(); 573 contextMenu.appendSeparator();
574
575 contextMenu.appendItem(WebInspector.UIString("Expand all"), this.expandR ecursively.bind(this));
576 contextMenu.appendItem(WebInspector.UIString("Collapse all"), this.colla pseRecursively.bind(this));
577 contextMenu.appendSeparator();
574 }, 578 },
575 579
576 _startEditing: function() 580 _startEditing: function()
577 { 581 {
578 if (this.treeOutline.selectedDOMNode() !== this._node) 582 if (this.treeOutline.selectedDOMNode() !== this._node)
579 return; 583 return;
580 584
581 var listItem = this._listItemNode; 585 var listItem = this._listItemNode;
582 586
583 if (this._canAddAttributes) { 587 if (this._canAddAttributes) {
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 }, 1617 },
1614 1618
1615 _editAsHTML: function() 1619 _editAsHTML: function()
1616 { 1620 {
1617 var promise = WebInspector.Revealer.revealPromise(this.node()); 1621 var promise = WebInspector.Revealer.revealPromise(this.node());
1618 promise.then(() => WebInspector.actionRegistry.action("elements.edit-as- html").execute()); 1622 promise.then(() => WebInspector.actionRegistry.action("elements.edit-as- html").execute());
1619 }, 1623 },
1620 1624
1621 __proto__: TreeElement.prototype 1625 __proto__: TreeElement.prototype
1622 } 1626 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698