From 2d31297cd518fd8f24398d2fc2b4c1d8fceaf072 Mon Sep 17 00:00:00 2001 From: Patrick Brosset Date: Wed, 6 Sep 2017 16:51:50 +0200 Subject: [PATCH] Bug 1382576 - Switch over from the old-event-emitter to event-emitter in the animation inspector; r=jdescottes MozReview-Commit-ID: ftItsTkomw --HG-- extra : rebase_source : eb2facf35130f8b3805fafdb16087cf807471ae7 --- .../animationinspector/animation-controller.js | 2 +- .../client/animationinspector/animation-panel.js | 4 ++-- .../components/animation-details.js | 3 --- .../components/animation-target-node.js | 2 +- .../components/animation-time-block.js | 2 +- .../components/animation-timeline.js | 12 ++++++------ .../animationinspector/components/keyframes.js | 5 +---- .../animationinspector/components/rate-selector.js | 2 +- devtools/client/animationinspector/utils.js | 2 -- 9 files changed, 13 insertions(+), 21 deletions(-) diff --git a/devtools/client/animationinspector/animation-controller.js b/devtools/client/animationinspector/animation-controller.js index f37ea8d8f122a..9a9239e55a66a 100644 --- a/devtools/client/animationinspector/animation-controller.js +++ b/devtools/client/animationinspector/animation-controller.js @@ -18,7 +18,7 @@ var { loader, require } = Cu.import("resource://devtools/shared/Loader.jsm", {}) var { Task } = require("devtools/shared/task"); loader.lazyRequireGetter(this, "promise"); -loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/old-event-emitter"); +loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter"); loader.lazyRequireGetter(this, "AnimationsFront", "devtools/shared/fronts/animation", true); const { LocalizationHelper } = require("devtools/shared/l10n"); diff --git a/devtools/client/animationinspector/animation-panel.js b/devtools/client/animationinspector/animation-panel.js index 272da274923cd..f037c02188ea1 100644 --- a/devtools/client/animationinspector/animation-panel.js +++ b/devtools/client/animationinspector/animation-panel.js @@ -260,7 +260,7 @@ var AnimationsPanel = { * Set the playback rate of all current animations shown in the timeline to * the value of this.rateSelectorEl. */ - onRateChanged: function (e, rate) { + onRateChanged: function (rate) { AnimationsController.setPlaybackRateAll(rate) .then(() => this.refreshAnimationsStateAndUI()) .catch(console.error); @@ -270,7 +270,7 @@ var AnimationsPanel = { this.toggleAllButtonEl.classList.remove("paused"); }, - onTimelineDataChanged: function (e, data) { + onTimelineDataChanged: function (data) { this.timelineData = data; let {isMoving, isUserDrag, time} = data; diff --git a/devtools/client/animationinspector/components/animation-details.js b/devtools/client/animationinspector/components/animation-details.js index 32a048686565b..5e10734b58a73 100644 --- a/devtools/client/animationinspector/components/animation-details.js +++ b/devtools/client/animationinspector/components/animation-details.js @@ -7,7 +7,6 @@ "use strict"; const {Task} = require("devtools/shared/task"); -const EventEmitter = require("devtools/shared/old-event-emitter"); const {createNode, getCssPropertyName} = require("devtools/client/animationinspector/utils"); const {Keyframes} = require("devtools/client/animationinspector/components/keyframes"); @@ -25,8 +24,6 @@ const L10N = * @param {Object} serverTraits The list of server-side capabilities. */ function AnimationDetails(serverTraits) { - EventEmitter.decorate(this); - this.keyframeComponents = []; this.serverTraits = serverTraits; } diff --git a/devtools/client/animationinspector/components/animation-target-node.js b/devtools/client/animationinspector/components/animation-target-node.js index 091fda21922e4..c300e9ce7b244 100644 --- a/devtools/client/animationinspector/components/animation-target-node.js +++ b/devtools/client/animationinspector/components/animation-target-node.js @@ -7,7 +7,7 @@ "use strict"; const {Task} = require("devtools/shared/task"); -const EventEmitter = require("devtools/shared/old-event-emitter"); +const EventEmitter = require("devtools/shared/event-emitter"); const {DomNodePreview} = require("devtools/client/inspector/shared/dom-node-preview"); // Map dom node fronts by animation fronts so we don't have to get them from the diff --git a/devtools/client/animationinspector/components/animation-time-block.js b/devtools/client/animationinspector/components/animation-time-block.js index 6d309f76a36d6..5774f1618bd03 100644 --- a/devtools/client/animationinspector/components/animation-time-block.js +++ b/devtools/client/animationinspector/components/animation-time-block.js @@ -6,7 +6,7 @@ "use strict"; -const EventEmitter = require("devtools/shared/old-event-emitter"); +const EventEmitter = require("devtools/shared/event-emitter"); const {createNode, createSVGNode, TimeScale, getFormattedAnimationTitle} = require("devtools/client/animationinspector/utils"); const {SummaryGraphHelper, getPreferredKeyframesProgressThreshold, diff --git a/devtools/client/animationinspector/components/animation-timeline.js b/devtools/client/animationinspector/components/animation-timeline.js index 0f918cf0720c1..fc92616f373b1 100644 --- a/devtools/client/animationinspector/components/animation-timeline.js +++ b/devtools/client/animationinspector/components/animation-timeline.js @@ -7,7 +7,7 @@ "use strict"; const {Task} = require("devtools/shared/task"); -const EventEmitter = require("devtools/shared/old-event-emitter"); +const EventEmitter = require("devtools/shared/event-emitter"); const { createNode, findOptimalTimeInterval, @@ -314,7 +314,7 @@ AnimationsTimeline.prototype = { }, TIMELINE_BACKGROUND_RESIZE_DEBOUNCE_TIMER); }, - onAnimationSelected: Task.async(function* (e, animation) { + onAnimationSelected: Task.async(function* (animation) { let index = this.animations.indexOf(animation); if (index === -1) { return; @@ -353,7 +353,7 @@ AnimationsTimeline.prototype = { yield this.details.render(animation, this.tracksMap.get(animation)); this.animationAnimationNameEl.textContent = getFormattedAnimationTitle(animation); } - this.onTimelineDataChanged(null, { time: this.currentTime || 0 }); + this.onTimelineDataChanged({ time: this.currentTime || 0 }); this.emit("animation-selected", animation); }), @@ -521,12 +521,12 @@ AnimationsTimeline.prototype = { if (this.animations.length === 1) { // Display animation's detail if there is only one animation, // even if the detail pane is closing. - yield this.onAnimationSelected(null, this.animations[0]); + yield this.onAnimationSelected(this.animations[0]); } else if (this.animationRootEl.classList.contains("animation-detail-visible") && this.animations.indexOf(this.selectedAnimation) >= 0) { // animation's detail displays in case of the previously displayed animation is // included in timeline list and the detail pane is not closing. - yield this.onAnimationSelected(null, this.selectedAnimation); + yield this.onAnimationSelected(this.selectedAnimation); } else { // Otherwise, close detail pane. this.onDetailCloseButtonClick(); @@ -643,7 +643,7 @@ AnimationsTimeline.prototype = { } }, - onTimelineDataChanged: function (e, { time }) { + onTimelineDataChanged: function ({ time }) { this.currentTime = time; const indicateTime = TimeScale.minStartTime === Infinity ? 0 : this.currentTime + TimeScale.minStartTime; diff --git a/devtools/client/animationinspector/components/keyframes.js b/devtools/client/animationinspector/components/keyframes.js index ae9eed70d6cbd..05aff08e9548c 100644 --- a/devtools/client/animationinspector/components/keyframes.js +++ b/devtools/client/animationinspector/components/keyframes.js @@ -6,7 +6,6 @@ "use strict"; -const EventEmitter = require("devtools/shared/old-event-emitter"); const {createNode, createSVGNode} = require("devtools/client/animationinspector/utils"); const {ProgressGraphHelper, getPreferredKeyframesProgressThreshold} = @@ -19,9 +18,7 @@ let LINEAR_GRADIENT_ID_COUNTER = 0; * UI component responsible for displaying a list of keyframes. * Also, shows a graphical graph for the animation progress of one iteration. */ -function Keyframes() { - EventEmitter.decorate(this); -} +function Keyframes() {} exports.Keyframes = Keyframes; diff --git a/devtools/client/animationinspector/components/rate-selector.js b/devtools/client/animationinspector/components/rate-selector.js index 77a97165fa2b3..e46664e6a7d8a 100644 --- a/devtools/client/animationinspector/components/rate-selector.js +++ b/devtools/client/animationinspector/components/rate-selector.js @@ -6,7 +6,7 @@ "use strict"; -const EventEmitter = require("devtools/shared/old-event-emitter"); +const EventEmitter = require("devtools/shared/event-emitter"); const {createNode} = require("devtools/client/animationinspector/utils"); const { LocalizationHelper } = require("devtools/shared/l10n"); const L10N = diff --git a/devtools/client/animationinspector/utils.js b/devtools/client/animationinspector/utils.js index 27ad7e90d7898..88e04a5393519 100644 --- a/devtools/client/animationinspector/utils.js +++ b/devtools/client/animationinspector/utils.js @@ -6,8 +6,6 @@ "use strict"; -loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/old-event-emitter"); - const { LocalizationHelper } = require("devtools/shared/l10n"); const L10N = new LocalizationHelper("devtools/client/locales/animationinspector.properties");