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

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: Make DOMAgent.copyTo hidden 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 event.consume(true); 530 event.consume(true);
531 return; 531 return;
532 } 532 }
533 } 533 }
534 534
535 WebInspector.shortcutRegistry.handleShortcut(event); 535 WebInspector.shortcutRegistry.handleShortcut(event);
536 }, 536 },
537 537
538 _documentCanCopy: function(event) 538 _documentCanCopy: function(event)
539 { 539 {
540 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorV iew.currentPanel()["handleCopyEvent"]) 540 var panel = WebInspector.inspectorView.currentPanel();
541 if (panel && panel["handleCopyEvent"])
541 event.preventDefault(); 542 event.preventDefault();
542 }, 543 },
543 544
544 _documentCopy: function(event) 545 _documentCopy: function(event)
545 { 546 {
546 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorV iew.currentPanel()["handleCopyEvent"]) 547 var panel = WebInspector.inspectorView.currentPanel();
547 WebInspector.inspectorView.currentPanel()["handleCopyEvent"](event); 548 if (panel && panel["handleCopyEvent"])
549 panel["handleCopyEvent"](event);
550 },
551
552 _documentCut: function(event)
553 {
554 var panel = WebInspector.inspectorView.currentPanel();
555 if (panel && panel["handleCutEvent"])
556 panel["handleCutEvent"](event);
557 },
558
559 _documentPaste: function(event)
560 {
561 var panel = WebInspector.inspectorView.currentPanel();
562 if (panel && panel["handlePasteEvent"])
563 panel["handlePasteEvent"](event);
548 }, 564 },
549 565
550 _contextMenuEventFired: function(event) 566 _contextMenuEventFired: function(event)
551 { 567 {
552 if (event.handled || event.target.classList.contains("popup-glasspane")) 568 if (event.handled || event.target.classList.contains("popup-glasspane"))
553 event.preventDefault(); 569 event.preventDefault();
554 }, 570 },
555 571
556 _addMainEventListeners: function(doc) 572 _addMainEventListeners: function(doc)
557 { 573 {
558 doc.addEventListener("keydown", this._postDocumentKeyDown.bind(this), fa lse); 574 doc.addEventListener("keydown", this._postDocumentKeyDown.bind(this), fa lse);
559 doc.addEventListener("beforecopy", this._documentCanCopy.bind(this), tru e); 575 doc.addEventListener("beforecopy", this._documentCanCopy.bind(this), tru e);
560 doc.addEventListener("copy", this._documentCopy.bind(this), false); 576 doc.addEventListener("copy", this._documentCopy.bind(this), false);
577 doc.addEventListener("cut", this._documentCut.bind(this), false);
578 doc.addEventListener("paste", this._documentPaste.bind(this), false);
561 doc.addEventListener("contextmenu", this._contextMenuEventFired.bind(thi s), true); 579 doc.addEventListener("contextmenu", this._contextMenuEventFired.bind(thi s), true);
562 doc.addEventListener("click", this._documentClick.bind(this), false); 580 doc.addEventListener("click", this._documentClick.bind(this), false);
563 }, 581 },
564 582
565 /** 583 /**
566 * @override 584 * @override
567 * @param {!RuntimeAgent.RemoteObject} payload 585 * @param {!RuntimeAgent.RemoteObject} payload
568 * @param {!Object=} hints 586 * @param {!Object=} hints
569 */ 587 */
570 inspect: function(payload, hints) 588 inspect: function(payload, hints)
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 906
889 WebInspector.Main.InspectedNodeRevealer.prototype = { 907 WebInspector.Main.InspectedNodeRevealer.prototype = {
890 /** 908 /**
891 * @param {!WebInspector.Event} event 909 * @param {!WebInspector.Event} event
892 */ 910 */
893 _inspectNode: function(event) 911 _inspectNode: function(event)
894 { 912 {
895 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event .data)); 913 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event .data));
896 } 914 }
897 } 915 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698