Bug 1289152 - Switch eyedropperOpen flag in Tooltip when picking color. r=zer0
authorJulian Descottes <jdescottes@mozilla.com>
Mon, 25 Jul 2016 20:39:01 +0200
changeset 349194 80206c1833893617b0413beb27fa85415701603d
parent 349193 329789f1d87f7352c02403e7ff517a38113b878d
child 349195 f5875c1a1fbdb09f7bd586ef9cde06afec36a1ea
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerszer0
bugs1289152
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1289152 - Switch eyedropperOpen flag in Tooltip when picking color. r=zer0 The eyedropper gets hidden when canceled and when selecting a color. The Tooltip should listen to both events to update its internal state flags. MozReview-Commit-ID: KYwmybh9mRo
devtools/client/shared/widgets/Tooltip.js
--- a/devtools/client/shared/widgets/Tooltip.js
+++ b/devtools/client/shared/widgets/Tooltip.js
@@ -845,31 +845,36 @@ Heritage.extend(SwatchBasedEditorTooltip
   _openEyeDropper: function () {
     let {inspector, toolbox, telemetry} = this.inspector;
     telemetry.toolOpened("pickereyedropper");
     inspector.pickColorFromPage({copyOnSelect: false}).catch(e => console.error(e));
 
     inspector.once("color-picked", color => {
       toolbox.win.focus();
       this._selectColor(color);
+      this._onEyeDropperDone();
     });
 
     inspector.once("color-pick-canceled", () => {
-      this.eyedropperOpen = false;
-      this.activeSwatch = null;
+      this._onEyeDropperDone();
     });
 
     this.eyedropperOpen = true;
 
     // close the colorpicker tooltip so that only the eyedropper is open.
     this.hide();
 
     this.tooltip.emit("eyedropper-opened");
   },
 
+  _onEyeDropperDone: function () {
+    this.eyedropperOpen = false;
+    this.activeSwatch = null;
+  },
+
   _colorToRgba: function (color) {
     color = new colorUtils.CssColor(color);
     let rgba = color._getRGBATuple();
     return [rgba.r, rgba.g, rgba.b, rgba.a];
   },
 
   _toDefaultType: function (color) {
     let colorObj = new colorUtils.CssColor(color);