Bug 1792730 - Keep dialogs stretching over their preferred width after bug 1665476. r=Gijs,preferences-reviewers,eemeli

width gets honored properly now. What these want is really a min-width.

Differential Revision: https://phabricator.services.mozilla.com/D158286
This commit is contained in:
Emilio Cobos Álvarez 2022-10-02 01:40:13 +00:00
parent 74dbbb7a93
commit 789b0bc2c6
35 changed files with 327 additions and 99 deletions

View File

@ -9,7 +9,7 @@
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
data-l10n-id="add-engine-window"
data-l10n-id="add-engine-window2"
data-l10n-attrs="title, style"
persist="width height">

View File

@ -9,7 +9,7 @@
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload="gAppManagerDialog.onLoad();"
data-l10n-id="app-manager-window"
data-l10n-id="app-manager-window2"
data-l10n-attrs="title, style">
<dialog id="appManager"
buttons="accept,cancel">

View File

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
<window id="BlocklistsDialog"
data-l10n-id="blocklist-window"
data-l10n-id="blocklist-window2"
data-l10n-attrs="title, style"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"

View File

@ -10,7 +10,7 @@
<window type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
data-l10n-id="browser-languages-window"
data-l10n-id="browser-languages-window2"
data-l10n-attrs="title, style"
onload="gBrowserLanguagesDialog.onLoad();">
<dialog id="BrowserLanguagesDialog"

View File

@ -11,7 +11,7 @@
<window id="ClearSiteDataDialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
data-l10n-id="clear-site-data-window"
data-l10n-id="clear-site-data-window2"
data-l10n-attrs="title, style"
persist="width height">

View File

@ -11,7 +11,7 @@
<window type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
data-l10n-id="colors-dialog"
data-l10n-id="colors-dialog2"
data-l10n-attrs="title, style"
persist="lastSelected">
<dialog id="ColorsDialog"

View File

@ -10,7 +10,7 @@
<window type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
data-l10n-id="connection-window"
data-l10n-id="connection-window2"
data-l10n-attrs="title, style"
persist="lastSelected"
onload="gConnectionsDialog.checkForSystemProxy();">

View File

@ -14,11 +14,11 @@ function setTitle() {
let winElem = document.documentElement;
if (params.userContextId) {
document.l10n.setAttributes(winElem, "containers-window-update-settings", {
document.l10n.setAttributes(winElem, "containers-window-update-settings2", {
name: params.identity.name,
});
} else {
document.l10n.setAttributes(winElem, "containers-window-new");
document.l10n.setAttributes(winElem, "containers-window-new2");
}
}
setTitle();

View File

@ -10,7 +10,7 @@
<window type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
data-l10n-id="webpage-languages-window"
data-l10n-id="webpage-languages-window2"
data-l10n-attrs="title, style"
persist="lastSelected"
onload="gLanguagesDialog.onLoad();">

View File

@ -8,27 +8,27 @@ var { AppConstants } = ChromeUtils.import(
const permissionExceptionsL10n = {
trackingprotection: {
window: "permissions-exceptions-etp-window",
window: "permissions-exceptions-etp-window2",
description: "permissions-exceptions-etp-desc",
},
cookie: {
window: "permissions-exceptions-cookie-window",
window: "permissions-exceptions-cookie-window2",
description: "permissions-exceptions-cookie-desc",
},
popup: {
window: "permissions-exceptions-popup-window",
window: "permissions-exceptions-popup-window2",
description: "permissions-exceptions-popup-desc",
},
"login-saving": {
window: "permissions-exceptions-saved-logins-window",
window: "permissions-exceptions-saved-logins-window2",
description: "permissions-exceptions-saved-logins-desc",
},
"https-only-load-insecure": {
window: "permissions-exceptions-https-only-window",
window: "permissions-exceptions-https-only-window2",
description: "permissions-exceptions-https-only-desc",
},
install: {
window: "permissions-exceptions-addons-window",
window: "permissions-exceptions-addons-window2",
description: "permissions-exceptions-addons-desc",
},
};

View File

@ -11,7 +11,7 @@
<window id="PermissionsDialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
data-l10n-id="permissions-window"
data-l10n-id="permissions-window2"
data-l10n-attrs="title, style"
onload="gPermissionManager.onLoad();"
onunload="gPermissionManager.uninit();"

View File

@ -11,7 +11,7 @@
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
data-l10n-id="select-bookmark-window"
data-l10n-id="select-bookmark-window2"
data-l10n-attrs="title, style"
persist="width height"
onload="SelectBookmarkDialog.init();">

View File

@ -13,7 +13,7 @@
data-l10n-attrs="title"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
style="width: 45em;"
style="min-width: 45em;"
onload="gSiteDataSettings.init();"
onkeypress="gSiteDataSettings.onKeyPress(event);"
persist="width height">

View File

@ -13,37 +13,37 @@ const { SitePermissions } = ChromeUtils.import(
const sitePermissionsL10n = {
"desktop-notification": {
window: "permissions-site-notification-window",
window: "permissions-site-notification-window2",
description: "permissions-site-notification-desc",
disableLabel: "permissions-site-notification-disable-label",
disableDescription: "permissions-site-notification-disable-desc",
},
geo: {
window: "permissions-site-location-window",
window: "permissions-site-location-window2",
description: "permissions-site-location-desc",
disableLabel: "permissions-site-location-disable-label",
disableDescription: "permissions-site-location-disable-desc",
},
xr: {
window: "permissions-site-xr-window",
window: "permissions-site-xr-window2",
description: "permissions-site-xr-desc",
disableLabel: "permissions-site-xr-disable-label",
disableDescription: "permissions-site-xr-disable-desc",
},
camera: {
window: "permissions-site-camera-window",
window: "permissions-site-camera-window2",
description: "permissions-site-camera-desc",
disableLabel: "permissions-site-camera-disable-label",
disableDescription: "permissions-site-camera-disable-desc",
},
microphone: {
window: "permissions-site-microphone-window",
window: "permissions-site-microphone-window2",
description: "permissions-site-microphone-desc",
disableLabel: "permissions-site-microphone-disable-label",
disableDescription: "permissions-site-microphone-disable-desc",
},
"autoplay-media": {
window: "permissions-site-autoplay-window",
window: "permissions-site-autoplay-window2",
description: "permissions-site-autoplay-desc",
},
};

View File

@ -11,7 +11,7 @@
<window id="SitePermissionsDialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
data-l10n-id="permissions-window"
data-l10n-id="permissions-window2"
data-l10n-attrs="title, style"
onload="gSitePermissionsManager.onLoad();"
onunload="gSitePermissionsManager.uninit();"

View File

@ -11,11 +11,11 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload="gSyncChooseWhatToSync.init();"
data-l10n-id="sync-choose-what-to-sync-dialog"
data-l10n-id="sync-choose-what-to-sync-dialog2"
data-l10n-attrs="title, style">
<dialog id="syncChooseOptions"
buttons="accept,cancel,extra2"
data-l10n-id="sync-choose-what-to-sync-dialog"
data-l10n-id="sync-choose-what-to-sync-dialog2"
data-l10n-attrs="buttonlabelaccept, buttonlabelextra2">
<linkset>

View File

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
<window id="TranslationDialog"
data-l10n-id="translation-window"
data-l10n-id="translation-window2"
data-l10n-attrs="title, style"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"

View File

@ -14,7 +14,7 @@
role="dialog"
onload="gFxaPairDeviceDialog.init();"
onunload="gFxaPairDeviceDialog.uninit()"
data-l10n-id="fxa-pair-device-dialog-sync"
data-l10n-id="fxa-pair-device-dialog-sync2"
data-l10n-attrs="style">
<linkset>

View File

@ -71,7 +71,7 @@
class="homepage-button check-home-page-controlled"
data-l10n-id="choose-bookmark"
preference="pref.browser.homepage.disable_button.bookmark_page"
search-l10n-ids="select-bookmark-window.title, select-bookmark-desc"/>
search-l10n-ids="select-bookmark-window2.title, select-bookmark-desc"/>
</hbox>
</vbox>
</vbox>

View File

@ -344,7 +344,7 @@
class="accessory-button"
data-l10n-id="choose-button"
search-l10n-ids="
webpage-languages-window.title,
webpage-languages-window2.title,
languages-description,
languages-customize-moveup.label,
languages-customize-movedown.label,
@ -786,7 +786,7 @@
data-l10n-id="network-proxy-connection-settings"
searchkeywords="doh trr"
search-l10n-ids="
connection-window.title,
connection-window2.title,
connection-proxy-option-no.label,
connection-proxy-option-auto.label,
connection-proxy-option-system.label,

View File

@ -38,7 +38,7 @@
search-l10n-ids="
permissions-remove.label,
permissions-remove-all.label,
permissions-exceptions-etp-window.title,
permissions-exceptions-etp-window2.title,
permissions-exceptions-etp-desc,
"/>
</hbox>
@ -292,7 +292,7 @@
<label id="changeBlockListLink"
data-l10n-id="content-blocking-tracking-protection-change-block-list"
is="text-link"
search-l10n-ids="blocklist-window.title, blocklist-description, blocklist-dialog.buttonlabelaccept"/>
search-l10n-ids="blocklist-window2.title, blocklist-description, blocklist-dialog.buttonlabelaccept"/>
<hbox class="custom-option" id="contentBlockingCryptominersOption">
<checkbox id="contentBlockingCryptominersCheckbox"
@ -462,7 +462,7 @@
preference="pref.privacy.disable_button.view_passwords_exceptions"
search-l10n-ids="
permissions-address,
permissions-exceptions-saved-logins-window.title,
permissions-exceptions-saved-logins-window2.title,
permissions-exceptions-saved-logins-desc,
"/>
</hbox>
@ -780,7 +780,7 @@
search-l10n-ids="
permissions-remove.label,
permissions-remove-all.label,
permissions-site-location-window.title,
permissions-site-location-window2.title,
permissions-site-location-desc,
permissions-site-location-disable-label,
permissions-site-location-disable-desc,
@ -801,7 +801,7 @@
search-l10n-ids="
permissions-remove.label,
permissions-remove-all.label,
permissions-site-camera-window.title,
permissions-site-camera-window2.title,
permissions-site-camera-desc,
permissions-site-camera-disable-label,
permissions-site-camera-disable-desc,
@ -822,7 +822,7 @@
search-l10n-ids="
permissions-remove.label,
permissions-remove-all.label,
permissions-site-microphone-window.title,
permissions-site-microphone-window2.title,
permissions-site-microphone-desc,
permissions-site-microphone-disable-label,
permissions-site-microphone-disable-desc,
@ -849,7 +849,7 @@
search-l10n-ids="
permissions-remove.label,
permissions-remove-all.label,
permissions-site-notification-window.title,
permissions-site-notification-window2.title,
permissions-site-notification-desc,
permissions-site-notification-disable-label,
permissions-site-notification-disable-desc,
@ -875,7 +875,7 @@
search-l10n-ids="
permissions-remove.label,
permissions-remove-all.label,
permissions-site-autoplay-window.title,
permissions-site-autoplay-window2.title,
permissions-site-autoplay-desc,
" />
</hbox>
@ -894,7 +894,7 @@
search-l10n-ids="
permissions-remove.label,
permissions-remove-all.label,
permissions-site-xr-window.title,
permissions-site-xr-window2.title,
permissions-site-xr-desc,
permissions-site-xr-disable-label,
permissions-site-xr-disable-desc,
@ -918,7 +918,7 @@
data-l10n-attrs="searchkeywords"
search-l10n-ids="
permissions-address,
permissions-exceptions-popup-window.title,
permissions-exceptions-popup-window2.title,
permissions-exceptions-popup-desc,
" />
</hbox>
@ -940,7 +940,7 @@
permissions-allow.label,
permissions-remove.label,
permissions-remove-all.label,
permissions-exceptions-addons-window.title,
permissions-exceptions-addons-window2.title,
permissions-exceptions-addons-desc,
" />
</hbox>

View File

@ -2,9 +2,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
add-engine-window =
add-engine-window2 =
.title = Add Search Engine
.style = width: 32em;
.style = min-width: 32em;
add-engine-button = Add Custom Engine

View File

@ -2,9 +2,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
app-manager-window =
app-manager-window2 =
.title = Application details
.style = width: 30em; min-height: 20em;
.style = min-width: 30em; min-height: 20em;
app-manager-remove =
.label = Remove

View File

@ -2,9 +2,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
blocklist-window =
blocklist-window2 =
.title = Block Lists
.style = width: 55em
.style = min-width: 55em
blocklist-description = Choose the list { -brand-short-name } uses to block online trackers. Lists provided by <a data-l10n-name="disconnect-link" title="Disconnect">Disconnect</a>.
blocklist-close-key =

View File

@ -2,9 +2,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
clear-site-data-window =
clear-site-data-window2 =
.title = Clear Data
.style = width: 35em
.style = min-width: 35em
clear-site-data-description = Clearing all cookies and site data stored by { -brand-short-name } may sign you out of websites and remove offline web content. Clearing cache data will not affect your logins.

View File

@ -2,9 +2,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
colors-dialog =
colors-dialog2 =
.title = Colors
.style = width: 41em;
.style = min-width: 41em;
colors-close-key =
.key = w

View File

@ -2,12 +2,12 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
connection-window =
connection-window2 =
.title = Connection Settings
.style =
{ PLATFORM() ->
[macos] width: 44em
*[other] width: 49em
[macos] min-width: 44em
*[other] min-width: 49em
}
connection-close-key =

View File

@ -2,14 +2,14 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
containers-window-new =
containers-window-new2 =
.title = Add New Container
.style = width: 45em
.style = min-width: 45em
# Variables
# $name (String) - Name of the container
containers-window-update-settings =
containers-window-update-settings2 =
.title = { $name } Container Settings
.style = width: 45em
.style = min-width: 45em
containers-window-close =
.key = w

View File

@ -2,8 +2,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
fxa-pair-device-dialog-sync =
.style = width: 32em;
fxa-pair-device-dialog-sync2 =
.style = min-width: 32em;
fxa-qrcode-pair-title = Sync { -brand-product-name } on your phone or tablet
fxa-qrcode-pair-step1 = 1. Open { -brand-product-name } on your mobile device.

View File

@ -2,9 +2,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
webpage-languages-window =
webpage-languages-window2 =
.title = Webpage Language Settings
.style = width: 40em
.style = min-width: 40em
languages-close-key =
.key = w
@ -49,9 +49,9 @@ languages-code-format =
languages-active-code-format =
.value = { languages-code-format.label }
browser-languages-window =
browser-languages-window2 =
.title = { -brand-short-name } Language Settings
.style = width: 40em
.style = min-width: 40em
browser-languages-description = { -brand-short-name } will display the first language as your default and will display alternate languages if necessary in the order they appear.

View File

@ -2,9 +2,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
permissions-window =
permissions-window2 =
.title = Exceptions
.style = width: 45em
.style = min-width: 45em
permissions-close-key =
.key = w
@ -88,58 +88,58 @@ permissions-invalid-uri-label = Please enter a valid hostname
## Exceptions - Tracking Protection
permissions-exceptions-etp-window =
permissions-exceptions-etp-window2 =
.title = Exceptions for Enhanced Tracking Protection
.style = { permissions-window.style }
.style = { permissions-window2.style }
permissions-exceptions-etp-desc = Youve turned off protections on these websites.
## Exceptions - Cookies
permissions-exceptions-cookie-window =
permissions-exceptions-cookie-window2 =
.title = Exceptions - Cookies and Site Data
.style = { permissions-window.style }
.style = { permissions-window2.style }
permissions-exceptions-cookie-desc = You can specify which websites are always or never allowed to use cookies and site data. Type the exact address of the site you want to manage and then click Block, Allow for Session, or Allow.
## Exceptions - HTTPS-Only Mode
permissions-exceptions-https-only-window =
permissions-exceptions-https-only-window2 =
.title = Exceptions - HTTPS-Only Mode
.style = { permissions-window.style }
.style = { permissions-window2.style }
permissions-exceptions-https-only-desc = You can turn off HTTPS-Only Mode for specific websites. { -brand-short-name } wont attempt to upgrade the connection to secure HTTPS for those sites. Exceptions do not apply to private windows.
## Exceptions - Pop-ups
permissions-exceptions-popup-window =
permissions-exceptions-popup-window2 =
.title = Allowed Websites - Pop-ups
.style = { permissions-window.style }
.style = { permissions-window2.style }
permissions-exceptions-popup-desc = You can specify which websites are allowed to open pop-up windows. Type the exact address of the site you want to allow and then click Allow.
## Exceptions - Saved Logins
permissions-exceptions-saved-logins-window =
permissions-exceptions-saved-logins-window2 =
.title = Exceptions - Saved Logins
.style = { permissions-window.style }
.style = { permissions-window2.style }
permissions-exceptions-saved-logins-desc = Logins for the following websites will not be saved
## Exceptions - Add-ons
permissions-exceptions-addons-window =
permissions-exceptions-addons-window2 =
.title = Allowed Websites - Add-ons Installation
.style = { permissions-window.style }
.style = { permissions-window2.style }
permissions-exceptions-addons-desc = You can specify which websites are allowed to install add-ons. Type the exact address of the site you want to allow and then click Allow.
## Site Permissions - Autoplay
permissions-site-autoplay-window =
permissions-site-autoplay-window2 =
.title = Settings - Autoplay
.style = { permissions-window.style }
.style = { permissions-window2.style }
permissions-site-autoplay-desc = You can manage the sites that do not follow your default autoplay settings here.
## Site Permissions - Notifications
permissions-site-notification-window =
permissions-site-notification-window2 =
.title = Settings - Notification Permissions
.style = { permissions-window.style }
.style = { permissions-window2.style }
permissions-site-notification-desc = The following websites have requested to send you notifications. You can specify which websites are allowed to send you notifications. You can also block new requests asking to allow notifications.
permissions-site-notification-disable-label =
.label = Block new requests asking to allow notifications
@ -147,9 +147,9 @@ permissions-site-notification-disable-desc = This will prevent any websites not
## Site Permissions - Location
permissions-site-location-window =
permissions-site-location-window2 =
.title = Settings - Location Permissions
.style = { permissions-window.style }
.style = { permissions-window2.style }
permissions-site-location-desc = The following websites have requested to access your location. You can specify which websites are allowed to access your location. You can also block new requests asking to access your location.
permissions-site-location-disable-label =
.label = Block new requests asking to access your location
@ -157,9 +157,9 @@ permissions-site-location-disable-desc = This will prevent any websites not list
## Site Permissions - Virtual Reality
permissions-site-xr-window =
permissions-site-xr-window2 =
.title = Settings - Virtual Reality Permissions
.style = { permissions-window.style }
.style = { permissions-window2.style }
permissions-site-xr-desc = The following websites have requested to access your virtual reality devices. You can specify which websites are allowed to access your virtual reality devices. You can also block new requests asking to access your virtual reality devices.
permissions-site-xr-disable-label =
.label = Block new requests asking to access your virtual reality devices
@ -167,9 +167,9 @@ permissions-site-xr-disable-desc = This will prevent any websites not listed abo
## Site Permissions - Camera
permissions-site-camera-window =
permissions-site-camera-window2 =
.title = Settings - Camera Permissions
.style = { permissions-window.style }
.style = { permissions-window2.style }
permissions-site-camera-desc = The following websites have requested to access your camera. You can specify which websites are allowed to access your camera. You can also block new requests asking to access your camera.
permissions-site-camera-disable-label =
.label = Block new requests asking to access your camera
@ -177,9 +177,9 @@ permissions-site-camera-disable-desc = This will prevent any websites not listed
## Site Permissions - Microphone
permissions-site-microphone-window =
permissions-site-microphone-window2 =
.title = Settings - Microphone Permissions
.style = { permissions-window.style }
.style = { permissions-window2.style }
permissions-site-microphone-desc = The following websites have requested to access your microphone. You can specify which websites are allowed to access your microphone. You can also block new requests asking to access your microphone.
permissions-site-microphone-disable-label =
.label = Block new requests asking to access your microphone

View File

@ -884,9 +884,9 @@ sync-change-options =
## The "Choose what to sync" dialog.
sync-choose-what-to-sync-dialog =
sync-choose-what-to-sync-dialog2 =
.title = Choose What To Sync
.style = width: 36em; min-height: 35em;
.style = min-width: 36em; min-height: 35em;
.buttonlabelaccept = Save Changes
.buttonaccesskeyaccept = S
.buttonlabelextra2 = Disconnect…

View File

@ -2,8 +2,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
select-bookmark-window =
select-bookmark-window2 =
.title = Set Home Page
.style = width: 32em;
.style = min-width: 32em;
select-bookmark-desc = Choose a Bookmark to be your Home Page. If you choose a folder, the Bookmarks in that folder will be opened in Tabs.

View File

@ -2,9 +2,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
translation-window =
translation-window2 =
.title = Exceptions - Translation
.style = width: 36em
.style = min-width: 36em
translation-close-key =
.key = w

View File

@ -0,0 +1,228 @@
from fluent.migrate import COPY_PATTERN
from fluent.migrate.helpers import transforms_from
from fluent.migrate.transforms import TransformPattern, REPLACE_IN_TEXT
import fluent.syntax.ast as FTL
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
class REPLACE_PATTERN(TransformPattern):
"""Hacky custom transform that works."""
def __init__(self, ctx, path, key, replacements, **kwargs):
super(REPLACE_PATTERN, self).__init__(path, key, **kwargs)
self.ctx = ctx
self.replacements = replacements
def visit_Pattern(self, source):
source = self.generic_visit(source)
target = FTL.Pattern([])
for element in source.elements:
if isinstance(element, FTL.TextElement):
pattern = REPLACE_IN_TEXT(element, self.replacements)(self.ctx)
target.elements += pattern.elements
else:
target.elements += [element]
return target
def replace_with_min_size_transform(ctx, file, identifier, with_title=True):
attributes = []
if with_title:
attributes.append(
FTL.Attribute(
id=FTL.Identifier("title"),
value=COPY_PATTERN(file, "{}.title".format(identifier)),
)
)
attributes.append(
FTL.Attribute(
id=FTL.Identifier("style"),
value=REPLACE_PATTERN(
ctx,
file,
"{}.style".format(identifier),
{
"width:": FTL.TextElement("min-width:"),
},
),
)
)
return FTL.Message(
id=FTL.Identifier(identifier + "2"),
attributes=attributes,
)
def migrate(ctx):
"""Bug 1792730 - Migrate styles of dialogs to use min-width"""
for window in [
"exceptions-etp",
"exceptions-cookie",
"exceptions-https-only",
"exceptions-popup",
"exceptions-saved-logins",
"exceptions-addons",
"site-autoplay",
"site-notification",
"site-location",
"site-xr",
"site-camera",
"site-microphone",
]:
ctx.add_transforms(
"browser/browser/preferences/permissions.ftl",
"browser/browser/preferences/permissions.ftl",
transforms_from(
"""
permissions-{0}-window2 =
.title = {{COPY_PATTERN(from_path, "permissions-{0}-window.title")}}
.style = {{permissions-window2.style}}
""".format(
window
),
from_path="browser/browser/preferences/permissions.ftl",
),
)
# It'd be great to not duplicate this using something like the following.
# for (file, identifier) in [
# ("browser/browser/preferences/addEngine.ftl", "add-engine-window"),
# ...
# ]:
#
# But the test migration stuff chokes on it and fails.
ctx.add_transforms(
"browser/browser/preferences/addEngine.ftl",
"browser/browser/preferences/addEngine.ftl",
[
replace_with_min_size_transform(
ctx, "browser/browser/preferences/addEngine.ftl", "add-engine-window"
)
],
)
ctx.add_transforms(
"browser/browser/preferences/applicationManager.ftl",
"browser/browser/preferences/applicationManager.ftl",
[
replace_with_min_size_transform(
ctx,
"browser/browser/preferences/applicationManager.ftl",
"app-manager-window",
)
],
)
ctx.add_transforms(
"browser/browser/preferences/clearSiteData.ftl",
"browser/browser/preferences/clearSiteData.ftl",
[
replace_with_min_size_transform(
ctx,
"browser/browser/preferences/clearSiteData.ftl",
"clear-site-data-window",
)
],
)
ctx.add_transforms(
"browser/browser/preferences/colors.ftl",
"browser/browser/preferences/colors.ftl",
[
replace_with_min_size_transform(
ctx, "browser/browser/preferences/colors.ftl", "colors-dialog"
)
],
)
ctx.add_transforms(
"browser/browser/preferences/blocklists.ftl",
"browser/browser/preferences/blocklists.ftl",
[
replace_with_min_size_transform(
ctx, "browser/browser/preferences/blocklists.ftl", "blocklist-window"
)
],
)
ctx.add_transforms(
"browser/browser/preferences/blocklists.ftl",
"browser/browser/preferences/blocklists.ftl",
[
replace_with_min_size_transform(
ctx, "browser/browser/preferences/blocklists.ftl", "blocklist-window"
)
],
)
ctx.add_transforms(
"browser/browser/preferences/connection.ftl",
"browser/browser/preferences/connection.ftl",
[
replace_with_min_size_transform(
ctx, "browser/browser/preferences/connection.ftl", "connection-window"
)
],
)
ctx.add_transforms(
"browser/browser/preferences/containers.ftl",
"browser/browser/preferences/containers.ftl",
[
replace_with_min_size_transform(
ctx,
"browser/browser/preferences/containers.ftl",
"containers-window-new",
)
],
)
ctx.add_transforms(
"browser/browser/preferences/containers.ftl",
"browser/browser/preferences/containers.ftl",
[
replace_with_min_size_transform(
ctx,
"browser/browser/preferences/containers.ftl",
"containers-window-update-settings",
)
],
)
ctx.add_transforms(
"browser/browser/preferences/fxaPairDevice.ftl",
"browser/browser/preferences/fxaPairDevice.ftl",
[
replace_with_min_size_transform(
ctx,
"browser/browser/preferences/fxaPairDevice.ftl",
"fxa-pair-device-dialog-sync",
with_title=False,
)
],
)
ctx.add_transforms(
"browser/browser/preferences/languages.ftl",
"browser/browser/preferences/languages.ftl",
[
replace_with_min_size_transform(
ctx,
"browser/browser/preferences/languages.ftl",
"webpage-languages-window",
)
],
)
ctx.add_transforms(
"browser/browser/preferences/languages.ftl",
"browser/browser/preferences/languages.ftl",
[
replace_with_min_size_transform(
ctx,
"browser/browser/preferences/languages.ftl",
"browser-languages-window",
)
],
)
ctx.add_transforms(
"browser/browser/preferences/permissions.ftl",
"browser/browser/preferences/permissions.ftl",
[
replace_with_min_size_transform(
ctx, "browser/browser/preferences/permissions.ftl", "permissions-window"
)
],
)