From aab3276276bdef5e971310d4b5188d2f62dfacf6 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 14 Oct 2014 02:22:44 -0400 Subject: [PATCH] Use old-style searchbox in Yosemite pre-Fx34 Yosemite introduces a new search textbox shape, but Firefox still uses the old focus ring shape until 34, so we fake the old searchbox shape for earlier versions. --- .../content/zotero-platform/mac/overlay.css | 48 ++++++++++++++++++ chrome/content/zotero/zoteroPane.js | 6 +++ chrome/skin/default/zotero/mac/moz/Search.png | Bin 0 -> 251 bytes .../skin/default/zotero/mac/moz/Search@2x.png | Bin 0 -> 545 bytes 4 files changed, 54 insertions(+) create mode 100644 chrome/skin/default/zotero/mac/moz/Search.png create mode 100644 chrome/skin/default/zotero/mac/moz/Search@2x.png diff --git a/chrome/content/zotero-platform/mac/overlay.css b/chrome/content/zotero-platform/mac/overlay.css index 001ef8be24..a021651ab7 100644 --- a/chrome/content/zotero-platform/mac/overlay.css +++ b/chrome/content/zotero-platform/mac/overlay.css @@ -47,6 +47,54 @@ padding: 5px 1px 5px 11px; } + +/* + * The searchbox focus ring is incorrect in Yosemite pre-Fx34, so use the old searchbox shape + * (with code borrowed from the Fx Add-ons window and icons borrowed from the Fx searchbar). + * These styles, the 'oldsearchfield' assignment in zoteroPane.js, and the Search.png icons + * can be removed after Fx31 ESR. + * + * Note: This uses navigator.oscpu in zoteroPane.js to test for Yosemite instead of + * -moz-mac-yosemite-theme here because the latter isn't defined in Fx31. + */ +#zotero-pane-stack[oldsearchfield] textbox[type=search] { + margin: 0; + -moz-appearance: none; + padding: 3px 5px 2px; + border: 1px solid rgba(60,73,97,0.5); + border-radius: 10000px; + box-shadow: inset 0 1px 1px rgba(0,0,0,0.15), 0 1px rgba(255,255,255,0.25); + background-clip: padding-box; +} + +#zotero-pane-stack[oldsearchfield] textbox[type=search][focused] { + box-shadow: 0 0 1px -moz-mac-focusring inset, 0 0 4px 1px -moz-mac-focusring, 0 0 1.5px 1px -moz-mac-focusring, inset 0 1px 1px rgba(0,0,0,0.15); + border-color: -moz-mac-focusring; +} + +#zotero-pane-stack[oldsearchfield] textbox[type=search] > .textbox-input-box { + -moz-padding-start: 15px; + background: url("chrome://zotero/skin/mac/moz/Search.png") left no-repeat; + background-size: 14px; +} + +@media (min-resolution: 2dppx) { + #zotero-pane-stack[oldsearchfield] textbox[type=search] > .textbox-input-box { + background: url("chrome://zotero/skin/mac/moz/Search@2x.png") left no-repeat; + background-size: 14px; + } +} + +#zotero-pane-stack[oldsearchfield] textbox[type=search] > .textbox-input-box:-moz-locale-dir(rtl) { + background-position: right; +} + +#zotero-pane-stack[oldsearchfield] textbox[type=search] > .textbox-input-box > html|*.textbox-input::-moz-placeholder { + opacity: 1.0; +} +/* End searchbox focus fix */ + + #zotero-tb-search-menu-button { margin: -6px -2px -6px -16px; diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 7946da7fc5..cc8ef168f6 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -124,6 +124,12 @@ var ZoteroPane = new function() document.getElementById('zotero-pane-stack').setAttribute('platform', 'win'); } + // Use pre-Yosemite search fields before Fx34 + // See note in chrome/content/zotero-platform/mac/overlay.css + if (Zotero.isMac && Zotero.platformMajorVersion < 34 && Zotero.oscpu.contains(' 10.10')) { + document.getElementById('zotero-pane-stack').setAttribute('oldsearchfield', 'true') + } + // register an observer for Zotero reload observerService = Components.classes["@mozilla.org/observer-service;1"] .getService(Components.interfaces.nsIObserverService); diff --git a/chrome/skin/default/zotero/mac/moz/Search.png b/chrome/skin/default/zotero/mac/moz/Search.png new file mode 100644 index 0000000000000000000000000000000000000000..12df282d9d7f0ba06d5287026dbf0891e1802369 GIT binary patch literal 251 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xamUKs7M+SzCeKo%WCj(O<=I|d83Yfz$%6xKW;^iHT(@%QnMRxl>=3TMGK&+(l7KEaEOhg>5}7pXRI2k;~(XQUmNrged5GTWoQFJ^IOwPZbG ud$cs5_pVEJOI8|NlDLAHqNlPI8-qRX!8PZ^HI0A{W$<+Mb6Mw<&;$VAEmST5 literal 0 HcmV?d00001 diff --git a/chrome/skin/default/zotero/mac/moz/Search@2x.png b/chrome/skin/default/zotero/mac/moz/Search@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..a12c4133f83c46a2ac4ed3ffd516d69413a64958 GIT binary patch literal 545 zcmV++0^a?JP)UJU%@lD0rHXW zoF5ddR;#8Xh=2|h@olDHtyVKdK>sMp6s*_lk1l~MDXbub6A{WR1+rZJHP~o0n1VYX z!v;#ccah!3aihG!X0yr4K!y}bvhyjz*1G-R4Ypb>b`4~>;(10_)~)si+wC^H1u}#@ z&nUERZ@s}zr^B{D2F3G?j;-6&8|-$w>^G1>@jRmw>((Fa^?K|lkRjxGMxk}<|4IA( zKD!1otazT$%DUCw;9xLdWgx>Ain8;03tQ{f|F;+phfKj8kYNKQ*}D{B9LZA`jyC z0caqH1k^4V$8jzaWc)b*4dn1?7hEhBxtKxVSpXWy67Pb`