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

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

Issue 413413003: DevTools: [Elements] Do not copy nodes if there is a non-collapsed selection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 }, 178 },
179 179
180 /** 180 /**
181 * @param {boolean} isCut 181 * @param {boolean} isCut
182 * @param {!Event} event 182 * @param {!Event} event
183 */ 183 */
184 handleCopyOrCutKeyboardEvent: function(isCut, event) 184 handleCopyOrCutKeyboardEvent: function(isCut, event)
185 { 185 {
186 this._setClipboardData(null); 186 this._setClipboardData(null);
187 187
188 // Don't prevent the normal copy if the user has a selection.
189 if (!window.getSelection().isCollapsed)
190 return;
191
188 // Do not interfere with text editing. 192 // Do not interfere with text editing.
189 var currentFocusElement = WebInspector.currentFocusElement(); 193 var currentFocusElement = WebInspector.currentFocusElement();
190 if (currentFocusElement && WebInspector.isBeingEdited(currentFocusElemen t)) 194 if (currentFocusElement && WebInspector.isBeingEdited(currentFocusElemen t))
191 return; 195 return;
192 196
193 var targetNode = this.selectedDOMNode(); 197 var targetNode = this.selectedDOMNode();
194 if (!targetNode) 198 if (!targetNode)
195 return; 199 return;
196 200
197 event.clipboardData.clearData(); 201 event.clipboardData.clearData();
(...skipping 2631 matching lines...) Expand 10 before | Expand all | Expand 10 after
2829 var treeOutline = new WebInspector.ElementsTreeOutline(node.target(), fa lse, false); 2833 var treeOutline = new WebInspector.ElementsTreeOutline(node.target(), fa lse, false);
2830 treeOutline.rootDOMNode = node; 2834 treeOutline.rootDOMNode = node;
2831 treeOutline.element.classList.add("outline-disclosure"); 2835 treeOutline.element.classList.add("outline-disclosure");
2832 if (!treeOutline.children[0].hasChildren) 2836 if (!treeOutline.children[0].hasChildren)
2833 treeOutline.element.classList.add("single-node"); 2837 treeOutline.element.classList.add("single-node");
2834 treeOutline.setVisible(true); 2838 treeOutline.setVisible(true);
2835 treeOutline.element.treeElementForTest = treeOutline.children[0]; 2839 treeOutline.element.treeElementForTest = treeOutline.children[0];
2836 return treeOutline.element; 2840 return treeOutline.element;
2837 } 2841 }
2838 } 2842 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698