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

Unified Diff: third_party/WebKit/Source/devtools/front_end/main/Main.js

Issue 2138123003: DevTools: remove panel-based clipboard events dispatching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lcean Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeOutline.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/main/Main.js
diff --git a/third_party/WebKit/Source/devtools/front_end/main/Main.js b/third_party/WebKit/Source/devtools/front_end/main/Main.js
index 1e7cf982faf3dd2988611398b1b2afbc6c03bf68..bddafee38a9afece34dcdc045d3f2a3f18e13031 100644
--- a/third_party/WebKit/Source/devtools/front_end/main/Main.js
+++ b/third_party/WebKit/Source/devtools/front_end/main/Main.js
@@ -493,34 +493,18 @@ WebInspector.Main.prototype = {
WebInspector.shortcutRegistry.handleShortcut(event);
},
- _documentCanCopy: function(event)
+ /**
+ * @param {!Event} event
+ */
+ _redispatchClipboardEvent: function(event)
{
- var panel = WebInspector.inspectorView.currentPanel();
- if (panel && panel["handleCopyEvent"])
+ var eventCopy = new CustomEvent("clipboard-" + event.type);
+ eventCopy["original"] = event;
lushnikov 2016/07/12 03:21:55 Can we use CustomEvent.detail for this? https://de
pfeldman 2016/07/12 20:56:46 Did not work for me.
+ event.deepActiveElement().dispatchEvent(eventCopy);
+ if (eventCopy.handled)
lushnikov 2016/07/12 03:21:55 Can we check for eventCopy.defaultPrevented here?
pfeldman 2016/07/12 20:56:46 It does not work on custom events.
event.preventDefault();
},
- _documentCopy: function(event)
- {
- var panel = WebInspector.inspectorView.currentPanel();
- if (panel && panel["handleCopyEvent"])
- panel["handleCopyEvent"](event);
- },
-
- _documentCut: function(event)
- {
- var panel = WebInspector.inspectorView.currentPanel();
- if (panel && panel["handleCutEvent"])
- panel["handleCutEvent"](event);
- },
-
- _documentPaste: function(event)
- {
- var panel = WebInspector.inspectorView.currentPanel();
- if (panel && panel["handlePasteEvent"])
- panel["handlePasteEvent"](event);
- },
-
_contextMenuEventFired: function(event)
{
if (event.handled || event.target.classList.contains("popup-glasspane"))
@@ -533,10 +517,10 @@ WebInspector.Main.prototype = {
_addMainEventListeners: function(document)
{
document.addEventListener("keydown", this._postDocumentKeyDown.bind(this), false);
- document.addEventListener("beforecopy", this._documentCanCopy.bind(this), true);
- document.addEventListener("copy", this._documentCopy.bind(this), false);
- document.addEventListener("cut", this._documentCut.bind(this), false);
- document.addEventListener("paste", this._documentPaste.bind(this), false);
+ document.addEventListener("beforecopy", this._redispatchClipboardEvent.bind(this), true);
+ document.addEventListener("copy", this._redispatchClipboardEvent.bind(this), false);
+ document.addEventListener("cut", this._redispatchClipboardEvent.bind(this), false);
+ document.addEventListener("paste", this._redispatchClipboardEvent.bind(this), false);
document.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
document.addEventListener("click", this._documentClick.bind(this), false);
},
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeOutline.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698