userChrome/popups: FF >= 108: fix broken touch
Split the #mainPopupSet CSS rule to an extra file popups.before-ff-108.css, and adjust autoconfig.js to skip that file if firefox is newer than >= 108.
This commit is contained in:
parent
e2f29799c6
commit
ee8d8382d5
3 changed files with 39 additions and 12 deletions
|
@ -9,6 +9,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||||
|
|
||||||
|
var ff_major_version;
|
||||||
var updated = false;
|
var updated = false;
|
||||||
var fragments_cache = {}; // cache for css_file_get_fragments()
|
var fragments_cache = {}; // cache for css_file_get_fragments()
|
||||||
|
|
||||||
|
@ -119,6 +120,25 @@ function set_default_prefs() {
|
||||||
defaultPref('browser.newtabpage.enabled', true);
|
defaultPref('browser.newtabpage.enabled', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if a CSS fragment should be used or not, depending on the current
|
||||||
|
// Firefox version.
|
||||||
|
// fragment: e.g. "userChrome/popups.before-ff-108.css"
|
||||||
|
// returns: true if it should be used, false if it must not be used
|
||||||
|
function css_fragment_check_firefox_version(fragment) {
|
||||||
|
if (fragment.indexOf(".before-ff-") !== -1) {
|
||||||
|
var before_ff_version = fragment.split("-").pop().split(".")[0];
|
||||||
|
if (ff_major_version >= before_ff_version) {
|
||||||
|
log("Fragment with FF version check not included: " + fragment);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
log("Fragment with FF version check included: " + fragment);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Get an array of paths to the fragments for one CSS file
|
// Get an array of paths to the fragments for one CSS file
|
||||||
// name: either "userChrome" or "userContent"
|
// name: either "userChrome" or "userContent"
|
||||||
function css_file_get_fragments(name) {
|
function css_file_get_fragments(name) {
|
||||||
|
@ -139,7 +159,9 @@ function css_file_get_fragments(name) {
|
||||||
do {
|
do {
|
||||||
var line = {};
|
var line = {};
|
||||||
has_more = istream.readLine(line);
|
has_more = istream.readLine(line);
|
||||||
ret.push("/etc/mobile-config-firefox/" + line.value);
|
if (css_fragment_check_firefox_version(line.value))
|
||||||
|
ret.push("/etc/mobile-config-firefox/" + line.value);
|
||||||
|
|
||||||
} while (has_more);
|
} while (has_more);
|
||||||
|
|
||||||
istream.close();
|
istream.close();
|
||||||
|
@ -222,6 +244,7 @@ function css_file_merge(name, file) {
|
||||||
|
|
||||||
function css_files_update() {
|
function css_files_update() {
|
||||||
var ff = get_firefox_version();
|
var ff = get_firefox_version();
|
||||||
|
ff_major_version = ff.split(".")[0];
|
||||||
var ff_previous = get_firefox_version_previous();
|
var ff_previous = get_firefox_version_previous();
|
||||||
log("Firefox version: " + ff + " (previous: " + ff_previous + ")");
|
log("Firefox version: " + ff + " (previous: " + ff_previous + ")");
|
||||||
|
|
||||||
|
|
15
src/userChrome/popups.before-ff-108.css
Normal file
15
src/userChrome/popups.before-ff-108.css
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/* Copyright 2022 Oliver Smith
|
||||||
|
* SPDX-License-Identifier: MPL-2.0 */
|
||||||
|
|
||||||
|
@media (max-width: 700px) {
|
||||||
|
/* Hack to prevent popups from flickering around. It looks like e.g. the
|
||||||
|
* editBookmarkPanel has two heights otherwise, and draws one frame with a
|
||||||
|
* short height and one frame with the proper one. */
|
||||||
|
#mainPopupSet {
|
||||||
|
position: fixed !important;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
right: 0px;
|
||||||
|
bottom: 100px;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,17 +2,6 @@
|
||||||
* SPDX-License-Identifier: MPL-2.0 */
|
* SPDX-License-Identifier: MPL-2.0 */
|
||||||
|
|
||||||
@media (max-width: 700px) {
|
@media (max-width: 700px) {
|
||||||
/* Hack to prevent popups from flickering around. It looks like e.g. the
|
|
||||||
* editBookmarkPanel has two heights otherwise, and draws one frame with a
|
|
||||||
* short height and one frame with the proper one. */
|
|
||||||
#mainPopupSet {
|
|
||||||
position: fixed !important;
|
|
||||||
top: 0px;
|
|
||||||
left: 0px;
|
|
||||||
right: 0px;
|
|
||||||
bottom: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now that the navbar is at the bottom, we need to set an offset to have
|
/* Now that the navbar is at the bottom, we need to set an offset to have
|
||||||
* the notifications (like the one for installing addons) displayed
|
* the notifications (like the one for installing addons) displayed
|
||||||
* on-screen. */
|
* on-screen. */
|
||||||
|
|
Loading…
Reference in a new issue