Fix display of tag colorpicker in Firefox 44

(And make the colorpicker work in high-contrast mode, according to the
Mozilla bug that broke this [1].)

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1047595
This commit is contained in:
Dan Stillman 2016-03-15 03:06:48 -04:00
parent e9c2b4b76e
commit 322852ff67

View File

@ -15,7 +15,7 @@
<content> <content>
<vbox anonid="tiles" flex="1" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <vbox anonid="tiles" flex="1" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<hbox> <hbox>
<spacer class="colorpickertile" style="background-color: #000000" color="#000000"/> <image class="colorpickertile" color="#000000"/>
</hbox> </hbox>
</vbox> </vbox>
</content> </content>
@ -90,17 +90,21 @@
let light = color.charAt(0) == 'L'; let light = color.charAt(0) == 'L';
color = light ? color.substr(1) : color; color = light ? color.substr(1) : color;
var spacer = document.createElement('spacer'); let image = document.createElement('image');
spacer.className = 'colorpickertile' + (light ? ' cp-light' : ''); image.className = 'colorpickertile' + (light ? ' cp-light' : '');
spacer.setAttribute('style', 'background-color: ' + color); image.setAttribute('color', color);
spacer.setAttribute('color', color);
let dataURI = "data:image/svg+xml,<svg style='background-color: "
+ encodeURIComponent(color) + "' xmlns='http://www.w3.org/2000/svg' />";
image.setAttribute('src', dataURI);
if (tileWidth) { if (tileWidth) {
spacer.width = tileWidth; image.width = tileWidth;
} }
if (tileHeight) { if (tileHeight) {
spacer.height = tileHeight; image.height = tileHeight;
} }
hbox.appendChild(spacer); hbox.appendChild(image);
} }
tiles.appendChild(hbox); tiles.appendChild(hbox);
} }
@ -117,7 +121,7 @@
<stylesheet src="chrome://zotero/skin/bindings/customcolorpicker.css"/> <stylesheet src="chrome://zotero/skin/bindings/customcolorpicker.css"/>
</resources> </resources>
<content> <content>
<xul:hbox class="colorpicker-button-colorbox" anonid="colorbox" flex="1" xbl:inherits="disabled"/> <xul:image class="colorpicker-button-colorbox" anonid="colorbox" flex="1" xbl:inherits="disabled"/>
<xul:panel class="colorpicker-button-menupopup" <xul:panel class="colorpicker-button-menupopup"
anonid="colorpopup" noautofocus="true" level="top" anonid="colorpopup" noautofocus="true" level="top"