diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-02-04 19:51:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-04 19:51:18 +0100 |
commit | fc7d9fade54dfbe275c4808dabe30a19415082e0 (patch) | |
tree | ff92eea0fc9df0be321cd4be0e17f653684f4084 /devtools/client/shared/widgets/tooltip | |
parent | 34cdbd1366224f040136c3a747709ae5e92f5956 (diff) | |
parent | f3aeeab64f6a5ae0639805b2c71e13323258e2c1 (diff) | |
download | UXP-fc7d9fade54dfbe275c4808dabe30a19415082e0.tar UXP-fc7d9fade54dfbe275c4808dabe30a19415082e0.tar.gz UXP-fc7d9fade54dfbe275c4808dabe30a19415082e0.tar.lz UXP-fc7d9fade54dfbe275c4808dabe30a19415082e0.tar.xz UXP-fc7d9fade54dfbe275c4808dabe30a19415082e0.zip |
Merge pull request #7 from janekptacijarabaci/devtools_inspector_cssColor4_1
Support for css-color-4 (finish)
Diffstat (limited to 'devtools/client/shared/widgets/tooltip')
-rw-r--r-- | devtools/client/shared/widgets/tooltip/SwatchColorPickerTooltip.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/devtools/client/shared/widgets/tooltip/SwatchColorPickerTooltip.js b/devtools/client/shared/widgets/tooltip/SwatchColorPickerTooltip.js index bf211b8b9..6a18ec12c 100644 --- a/devtools/client/shared/widgets/tooltip/SwatchColorPickerTooltip.js +++ b/devtools/client/shared/widgets/tooltip/SwatchColorPickerTooltip.js @@ -28,8 +28,12 @@ const XHTML_NS = "http://www.w3.org/1999/xhtml"; * inline editor. * @param {InspectorPanel} inspector * The inspector panel, needed for the eyedropper. + * @param {Function} supportsCssColor4ColorFunction + * A function for checking the supporting of css-color-4 color function. */ -function SwatchColorPickerTooltip(document, inspector) { +function SwatchColorPickerTooltip(document, + inspector, + {supportsCssColor4ColorFunction}) { let stylesheet = "chrome://devtools/content/shared/widgets/spectrum.css"; SwatchBasedEditorTooltip.call(this, document, stylesheet); @@ -40,6 +44,7 @@ function SwatchColorPickerTooltip(document, inspector) { this.spectrum = this.setColorPickerContent([0, 0, 0, 1]); this._onSpectrumColorChange = this._onSpectrumColorChange.bind(this); this._openEyeDropper = this._openEyeDropper.bind(this); + this.cssColor4 = supportsCssColor4ColorFunction(); } SwatchColorPickerTooltip.prototype = Heritage.extend(SwatchBasedEditorTooltip.prototype, { @@ -159,14 +164,14 @@ SwatchColorPickerTooltip.prototype = Heritage.extend(SwatchBasedEditorTooltip.pr }, _colorToRgba: function (color) { - color = new colorUtils.CssColor(color); + color = new colorUtils.CssColor(color, this.cssColor4); let rgba = color._getRGBATuple(); return [rgba.r, rgba.g, rgba.b, rgba.a]; }, _toDefaultType: function (color) { let colorObj = new colorUtils.CssColor(color); - colorObj.setAuthoredUnitFromColor(this._originalColor); + colorObj.setAuthoredUnitFromColor(this._originalColor, this.cssColor4); return colorObj.toString(); }, |