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

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: Forbid moving node into self or descendant Created 6 years, 5 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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 event.consume(true); 526 event.consume(true);
527 return; 527 return;
528 } 528 }
529 } 529 }
530 530
531 WebInspector.shortcutRegistry.handleShortcut(event); 531 WebInspector.shortcutRegistry.handleShortcut(event);
532 }, 532 },
533 533
534 _documentCanCopy: function(event) 534 _documentCanCopy: function(event)
535 { 535 {
536 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorV iew.currentPanel()["handleCopyEvent"]) 536 var panel = WebInspector.inspectorView.currentPanel();
537 if (panel && panel["handleCopyEvent"])
537 event.preventDefault(); 538 event.preventDefault();
538 }, 539 },
539 540
540 _documentCopy: function(event) 541 _documentCopy: function(event)
541 { 542 {
542 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorV iew.currentPanel()["handleCopyEvent"]) 543 var panel = WebInspector.inspectorView.currentPanel();
543 WebInspector.inspectorView.currentPanel()["handleCopyEvent"](event); 544 if (panel && panel["handleCopyEvent"])
545 panel["handleCopyEvent"](event);
546 },
547
548 _documentCut: function(event)
549 {
550 var panel = WebInspector.inspectorView.currentPanel();
551 if (panel && panel["handleCutEvent"])
552 panel["handleCutEvent"](event);
553 },
554
555 _documentPaste: function(event)
556 {
557 var panel = WebInspector.inspectorView.currentPanel();
558 if (panel && panel["handlePasteEvent"])
559 panel["handlePasteEvent"](event);
544 }, 560 },
545 561
546 _contextMenuEventFired: function(event) 562 _contextMenuEventFired: function(event)
547 { 563 {
548 if (event.handled || event.target.classList.contains("popup-glasspane")) 564 if (event.handled || event.target.classList.contains("popup-glasspane"))
549 event.preventDefault(); 565 event.preventDefault();
550 }, 566 },
551 567
552 _addMainEventListeners: function(doc) 568 _addMainEventListeners: function(doc)
553 { 569 {
554 doc.addEventListener("keydown", this._postDocumentKeyDown.bind(this), fa lse); 570 doc.addEventListener("keydown", this._postDocumentKeyDown.bind(this), fa lse);
555 doc.addEventListener("beforecopy", this._documentCanCopy.bind(this), tru e); 571 doc.addEventListener("beforecopy", this._documentCanCopy.bind(this), tru e);
556 doc.addEventListener("copy", this._documentCopy.bind(this), false); 572 doc.addEventListener("copy", this._documentCopy.bind(this), false);
573 doc.addEventListener("cut", this._documentCut.bind(this), false);
574 doc.addEventListener("paste", this._documentPaste.bind(this), false);
557 doc.addEventListener("contextmenu", this._contextMenuEventFired.bind(thi s), true); 575 doc.addEventListener("contextmenu", this._contextMenuEventFired.bind(thi s), true);
558 doc.addEventListener("click", this._documentClick.bind(this), false); 576 doc.addEventListener("click", this._documentClick.bind(this), false);
559 }, 577 },
560 578
561 /** 579 /**
562 * @override 580 * @override
563 * @param {!RuntimeAgent.RemoteObject} payload 581 * @param {!RuntimeAgent.RemoteObject} payload
564 * @param {!Object=} hints 582 * @param {!Object=} hints
565 */ 583 */
566 inspect: function(payload, hints) 584 inspect: function(payload, hints)
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 }, 962 },
945 963
946 /** 964 /**
947 * @param {!WebInspector.Event} event 965 * @param {!WebInspector.Event} event
948 */ 966 */
949 _inspectNode: function(event) 967 _inspectNode: function(event)
950 { 968 {
951 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event .data)); 969 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event .data));
952 } 970 }
953 } 971 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698