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

Side by Side Diff: Source/devtools/front_end/ElementsTreeOutline.js

Issue 220763004: DevTools: [Elements] Do not add editing-related context menu items for edited nodes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« 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 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 var node = this._node; 1430 var node = this._node;
1431 var forcedPseudoState = (node ? node.getUserProperty("pseudoState") : nu ll) || []; 1431 var forcedPseudoState = (node ? node.getUserProperty("pseudoState") : nu ll) || [];
1432 for (var i = 0; i < pseudoClasses.length; ++i) { 1432 for (var i = 0; i < pseudoClasses.length; ++i) {
1433 var pseudoClassForced = forcedPseudoState.indexOf(pseudoClasses[i]) >= 0; 1433 var pseudoClassForced = forcedPseudoState.indexOf(pseudoClasses[i]) >= 0;
1434 subMenu.appendCheckboxItem(":" + pseudoClasses[i], this.treeOutline. _setPseudoClassCallback.bind(null, node, pseudoClasses[i], !pseudoClassForced), pseudoClassForced, false); 1434 subMenu.appendCheckboxItem(":" + pseudoClasses[i], this.treeOutline. _setPseudoClassCallback.bind(null, node, pseudoClasses[i], !pseudoClassForced), pseudoClassForced, false);
1435 } 1435 }
1436 }, 1436 },
1437 1437
1438 _populateTextContextMenu: function(contextMenu, textNode) 1438 _populateTextContextMenu: function(contextMenu, textNode)
1439 { 1439 {
1440 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Edit text" : "Edit Text"), this._startEditingTextNode.bind(this, t extNode)); 1440 if (!this._editing)
1441 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCa seMenuTitles() ? "Edit text" : "Edit Text"), this._startEditingTextNode.bind(thi s, textNode));
1441 this._populateNodeContextMenu(contextMenu); 1442 this._populateNodeContextMenu(contextMenu);
1442 }, 1443 },
1443 1444
1444 _populateNodeContextMenu: function(contextMenu) 1445 _populateNodeContextMenu: function(contextMenu)
1445 { 1446 {
1446 // Add free-form node-related actions. 1447 // Add free-form node-related actions.
1447 var openTagElement = this.treeOutline.getCachedTreeElement(this.represen tedObject) || this; 1448 var openTagElement = this.treeOutline.getCachedTreeElement(this.represen tedObject) || this;
1448 var isEditable = this.hasEditableNode(); 1449 var isEditable = this.hasEditableNode();
1449 if (isEditable) 1450 if (isEditable && !this._editing)
1450 contextMenu.appendItem(WebInspector.UIString("Edit as HTML"), openTa gElement._editAsHTML.bind(openTagElement)); 1451 contextMenu.appendItem(WebInspector.UIString("Edit as HTML"), openTa gElement._editAsHTML.bind(openTagElement));
1451 var isShadowRoot = this.representedObject.isShadowRoot(); 1452 var isShadowRoot = this.representedObject.isShadowRoot();
1452 if (!isShadowRoot) 1453 if (!isShadowRoot)
1453 contextMenu.appendItem(WebInspector.UIString("Copy as HTML"), this._ copyHTML.bind(this)); 1454 contextMenu.appendItem(WebInspector.UIString("Copy as HTML"), this._ copyHTML.bind(this));
1454 1455
1455 // Place it here so that all "Copy"-ing items stick together. 1456 // Place it here so that all "Copy"-ing items stick together.
1456 if (this.representedObject.nodeType() === Node.ELEMENT_NODE) 1457 if (this.representedObject.nodeType() === Node.ELEMENT_NODE)
1457 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCa seMenuTitles() ? "Copy CSS path" : "Copy CSS Path"), this._copyCSSPath.bind(this )); 1458 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCa seMenuTitles() ? "Copy CSS path" : "Copy CSS Path"), this._copyCSSPath.bind(this ));
1458 if (!isShadowRoot) 1459 if (!isShadowRoot)
1459 contextMenu.appendItem(WebInspector.UIString("Copy XPath"), this._co pyXPath.bind(this)); 1460 contextMenu.appendItem(WebInspector.UIString("Copy XPath"), this._co pyXPath.bind(this));
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
2649 var treeOutline = new WebInspector.ElementsTreeOutline(node.target(), fa lse, false); 2650 var treeOutline = new WebInspector.ElementsTreeOutline(node.target(), fa lse, false);
2650 treeOutline.rootDOMNode = node; 2651 treeOutline.rootDOMNode = node;
2651 treeOutline.element.classList.add("outline-disclosure"); 2652 treeOutline.element.classList.add("outline-disclosure");
2652 if (!treeOutline.children[0].hasChildren) 2653 if (!treeOutline.children[0].hasChildren)
2653 treeOutline.element.classList.add("single-node"); 2654 treeOutline.element.classList.add("single-node");
2654 treeOutline.setVisible(true); 2655 treeOutline.setVisible(true);
2655 treeOutline.element.treeElementForTest = treeOutline.children[0]; 2656 treeOutline.element.treeElementForTest = treeOutline.children[0];
2656 return treeOutline.element; 2657 return treeOutline.element;
2657 } 2658 }
2658 } 2659 }
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