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

Side by Side Diff: Source/devtools/front_end/main/Main.js

Issue 397303002: DevTools: [Elements] Implement shortcut-based node cut-copy-pasting (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments 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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 event.consume(true); 522 event.consume(true);
523 return; 523 return;
524 } 524 }
525 } 525 }
526 526
527 WebInspector.shortcutRegistry.handleShortcut(event); 527 WebInspector.shortcutRegistry.handleShortcut(event);
528 }, 528 },
529 529
530 _documentCanCopy: function(event) 530 _documentCanCopy: function(event)
531 { 531 {
532 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorV iew.currentPanel()["handleCopyEvent"]) 532 var panel = WebInspector.inspectorView.currentPanel();
533 if (panel && panel["handleCopyEvent"])
533 event.preventDefault(); 534 event.preventDefault();
534 }, 535 },
535 536
536 _documentCopy: function(event) 537 _documentCopy: function(event)
537 { 538 {
538 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorV iew.currentPanel()["handleCopyEvent"]) 539 var panel = WebInspector.inspectorView.currentPanel();
539 WebInspector.inspectorView.currentPanel()["handleCopyEvent"](event); 540 if (panel && panel["handleCopyEvent"])
541 panel["handleCopyEvent"](event);
542 },
543
544 _documentCut: function(event)
545 {
546 var panel = WebInspector.inspectorView.currentPanel();
547 if (panel && panel["handleCutEvent"])
548 panel["handleCutEvent"](event);
549 },
550
551 _documentPaste: function(event)
552 {
553 var panel = WebInspector.inspectorView.currentPanel();
554 if (panel && panel["handlePasteEvent"])
555 panel["handlePasteEvent"](event);
540 }, 556 },
541 557
542 _contextMenuEventFired: function(event) 558 _contextMenuEventFired: function(event)
543 { 559 {
544 if (event.handled || event.target.classList.contains("popup-glasspane")) 560 if (event.handled || event.target.classList.contains("popup-glasspane"))
545 event.preventDefault(); 561 event.preventDefault();
546 }, 562 },
547 563
548 _addMainEventListeners: function(doc) 564 _addMainEventListeners: function(doc)
549 { 565 {
550 doc.addEventListener("keydown", this._postDocumentKeyDown.bind(this), fa lse); 566 doc.addEventListener("keydown", this._postDocumentKeyDown.bind(this), fa lse);
551 doc.addEventListener("beforecopy", this._documentCanCopy.bind(this), tru e); 567 doc.addEventListener("beforecopy", this._documentCanCopy.bind(this), tru e);
552 doc.addEventListener("copy", this._documentCopy.bind(this), false); 568 doc.addEventListener("copy", this._documentCopy.bind(this), false);
569 doc.addEventListener("cut", this._documentCut.bind(this), false);
570 doc.addEventListener("paste", this._documentPaste.bind(this), false);
553 doc.addEventListener("contextmenu", this._contextMenuEventFired.bind(thi s), true); 571 doc.addEventListener("contextmenu", this._contextMenuEventFired.bind(thi s), true);
554 doc.addEventListener("click", this._documentClick.bind(this), false); 572 doc.addEventListener("click", this._documentClick.bind(this), false);
555 }, 573 },
556 574
557 /** 575 /**
558 * @override 576 * @override
559 * @param {!RuntimeAgent.RemoteObject} payload 577 * @param {!RuntimeAgent.RemoteObject} payload
560 * @param {!Object=} hints 578 * @param {!Object=} hints
561 */ 579 */
562 inspect: function(payload, hints) 580 inspect: function(payload, hints)
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 917
900 WebInspector.Main.InspectedNodeRevealer.prototype = { 918 WebInspector.Main.InspectedNodeRevealer.prototype = {
901 /** 919 /**
902 * @param {!WebInspector.Event} event 920 * @param {!WebInspector.Event} event
903 */ 921 */
904 _inspectNode: function(event) 922 _inspectNode: function(event)
905 { 923 {
906 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event .data)); 924 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event .data));
907 } 925 }
908 } 926 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698