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 306858 80206c1833893617b0413beb27fa85415701603d
parent 306857 329789f1d87f7352c02403e7ff517a38113b878d
child 306859 f5875c1a1fbdb09f7bd586ef9cde06afec36a1ea
push id20137
push userryanvm@gmail.com
push dateThu, 28 Jul 2016 02:20:00 +0000
treeherderfx-team@f5875c1a1fbd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerszer0
bugs1289152
milestone50.0a1
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);