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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js

Issue 2553043003: [DevTools] Remove methods on Common.Event. (Closed)
Patch Set: rebased Created 4 years 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
Index: third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
index 29a80f96cdba911a924871b7fd4b1a8440fb0e03..6295836985d44b5d972a77727427ec8cb8648622 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
@@ -57,7 +57,7 @@ UI.Toolbar = class {
static createActionButton(action, toggledOptions, untoggledOptions) {
var button = new UI.ToolbarToggle(action.title(), action.icon(), action.toggledIcon());
button.setToggleWithRedColor(action.toggleWithRedColor());
- button.addEventListener('click', action.execute, action);
+ button.addEventListener(UI.ToolbarButton.Events.Click, action.execute, action);
action.addEventListener(UI.Action.Events.Enabled, enabledChanged);
action.addEventListener(UI.Action.Events.Toggled, toggled);
/** @type {?UI.LongClickController} */
@@ -107,7 +107,7 @@ UI.Toolbar = class {
function showOptions() {
var buttons = longClickButtons.slice();
var mainButtonClone = new UI.ToolbarToggle(action.title(), action.icon(), action.toggledIcon());
- mainButtonClone.addEventListener('click', clicked);
+ mainButtonClone.addEventListener(UI.ToolbarButton.Events.Click, clicked);
/**
* @param {!Common.Event} event
@@ -511,25 +511,30 @@ UI.ToolbarButton = class extends UI.ToolbarItem {
* @param {!Event} event
*/
_clicked(event) {
- var defaultPrevented = this.dispatchEventToListeners('click', event);
- event.consume(defaultPrevented);
+ this.dispatchEventToListeners(UI.ToolbarButton.Events.Click, event);
}
/**
* @param {!Event} event
*/
_mouseDown(event) {
- this.dispatchEventToListeners('mousedown', event);
+ this.dispatchEventToListeners(UI.ToolbarButton.Events.MouseDown, event);
}
/**
* @param {!Event} event
*/
_mouseUp(event) {
- this.dispatchEventToListeners('mouseup', event);
+ this.dispatchEventToListeners(UI.ToolbarButton.Events.MouseUp, event);
}
};
+UI.ToolbarButton.Events = {
+ Click: Symbol('Click'),
+ MouseDown: Symbol('MouseDown'),
+ MouseUp: Symbol('MouseUp')
+};
+
/**
* @unrestricted
*/
@@ -569,7 +574,7 @@ UI.ToolbarInput = class extends UI.ToolbarItem {
};
UI.ToolbarInput.Event = {
- TextChanged: 'TextChanged'
+ TextChanged: Symbol('TextChanged')
};
/**

Powered by Google App Engine
This is Rietveld 408576698