Bug 1583925 - Replace commonDialog.xul XUL grid with CSS grid. r=dao

This makes use of display: contents; in order to preserve the row-based markup that is needed by JS to hide certain rows.

Differential Revision: https://phabricator.services.mozilla.com/D54243

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tim Nguyen 2019-11-26 13:41:16 +00:00
Родитель 293374b30f
Коммит eddf20e619
6 изменённых файлов: 44 добавлений и 61 удалений

Просмотреть файл

@ -2,7 +2,19 @@
* 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/. */
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
#dialogGrid {
display: grid;
grid-template-columns: auto 1fr;
align-items: center;
}
.dialogRow:not([hidden]) {
display: contents;
}
#iconContainer {
align-self: start;
}
#infoContainer {
max-width: 45em;
@ -17,6 +29,5 @@
}
#loginLabel, #password1Label {
text-align: right;
text-align: end;
}

Просмотреть файл

@ -40,9 +40,6 @@ function commonDialogOnLoad() {
focusTarget: window,
};
// limit the dialog to the screen width
document.getElementById("filler").maxWidth = screen.availWidth;
Dialog = new CommonDialog(args, ui);
document.addEventListener("dialogaccept", function() {
Dialog.onButton0();

Просмотреть файл

@ -13,6 +13,7 @@
<dialog id="commonDialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
aria-describedby="infoBody"
onunload="commonDialogOnUnload();"
buttonpack="center">
@ -47,50 +48,38 @@
</menupopup>
</popupset>
<hbox id="filler" style="min-width: 0%;">
<spacer style="width: 29em;"/>
</hbox>
<grid>
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row>
<hbox id="iconContainer" align="start">
<image id="infoIcon"/>
</hbox>
<vbox id="infoContainer"
<div id="dialogGrid" xmlns="http://www.w3.org/1999/xhtml">
<div class="dialogRow">
<xul:hbox id="iconContainer">
<xul:image id="infoIcon"/>
</xul:hbox>
<xul:vbox id="infoContainer"
#ifndef XP_MACOSX
pack="center"
pack="center"
#endif
>
<!-- Only shown on OS X, since it has no dialog title -->
<description id="infoTitle"
>
<!-- Only shown on OS X, since it has no dialog title -->
<xul:description id="infoTitle"
#ifndef XP_MACOSX
hidden="true"
hidden="true"
#else
style="margin-bottom: 1em"
style="margin-bottom: 1em"
#endif
/>
<description id="infoBody" context="contentAreaContextMenu" noinitialfocus="true"/>
</vbox>
</row>
<row id="loginContainer" hidden="true" align="center">
<label id="loginLabel" value="&editfield0.label;" control="loginTextbox"/>
<html:input id="loginTextbox"/>
</row>
<row id ="password1Container" hidden="true" align="center">
<label id="password1Label" value="&editfield1.label;" control="password1Textbox"/>
<html:input type="password" id="password1Textbox"/>
</row>
<row id="checkboxContainer" hidden="true">
<spacer/>
<checkbox id="checkbox" oncommand="Dialog.onCheckbox()"/>
</row>
</rows>
</grid>
/>
<xul:description id="infoBody" context="contentAreaContextMenu" noinitialfocus="true"/>
</xul:vbox>
</div>
<div id="loginContainer" class="dialogRow" hidden="hidden">
<xul:label id="loginLabel" value="&editfield0.label;" control="loginTextbox"/>
<input id="loginTextbox"/>
</div>
<div id="password1Container" class="dialogRow" hidden="hidden">
<xul:label id="password1Label" value="&editfield1.label;" control="password1Textbox"/>
<input type="password" id="password1Textbox"/>
</div>
<div id="checkboxContainer" class="dialogRow" hidden="hidden">
<div/> <!-- spacer -->
<xul:checkbox id="checkbox" oncommand="Dialog.onCheckbox()"/>
</div>
</div>
</dialog>

Просмотреть файл

@ -2,11 +2,6 @@
* 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/. */
#filler {
margin-inline-start: -8px;
margin-inline-end: -10px;
}
#iconContainer {
-moz-box-pack: center;
min-height: 55px; /* maximum icon height + icon margin */

Просмотреть файл

@ -6,10 +6,6 @@
line-height: 13px;
}
#filler {
margin: 0px -14px;
}
#infoContainer {
max-width: 33em;
}

Просмотреть файл

@ -2,11 +2,6 @@
* 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/. */
#filler {
margin-inline-start: -8px;
margin-inline-end: -10px;
}
#infoIcon {
margin: 3px 5px 4px;
}