Bug 1642364 - Add a temporary solution for modal dialog centered alignment r=emilio

Spec: https://html.spec.whatwg.org/multipage/#centered-alignment

The spec is opaque about the centered alignment mode and we couldn't
come up a satisfied solution by using the current version of the
spec. There will be discussion in CSSWG to talk about better solutions.
In the meantime, we are adding this patch as a temporary solution with
basic centered alignment support to allow us enabling the feature
in Nightly for more testing.

Differential Revision: https://phabricator.services.mozilla.com/D77678
This commit is contained in:
sefeng 2020-06-02 04:14:04 +00:00
Родитель 5cd323cd6f
Коммит bb650da0c7
2 изменённых файлов: 9 добавлений и 24 удалений

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

@ -828,6 +828,7 @@ dialog {
padding: 1em;
background: white;
width: -moz-fit-content;
height: -moz-fit-content;
}
dialog:not([open]) {
@ -836,6 +837,13 @@ dialog:not([open]) {
dialog:-moz-modal-dialog {
-moz-top-layer: top !important;
/* This is a temporary solution until the relevant CSSWG issues are resolved */
position: fixed;
max-height: 100vh;
max-width: 100vw;
top: 50%;
transform: translateY(-50%);
overflow: auto;
}
/* https://html.spec.whatwg.org/#flow-content-3 */

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

@ -1,34 +1,11 @@
[abspos-dialog-layout.html]
[showModal() should center in the viewport]
expected: FAIL
[The dialog is a positioned element, so the top and bottom should not have style auto.]
expected: FAIL
[Dialog should be recentered if showModal() is called after close()]
expected: FAIL
[Dialog should not recenter on relayout.]
expected: FAIL
[A tall dialog should be positioned at the top of the viewport.]
expected: FAIL
prefs:[dom.dialog_element.enabled:true]
[The dialog should be centered regardless of the presence of a horizontal scrollbar.]
expected: FAIL
[Centering should work when dialog is inside positioned containers.]
expected: FAIL
[A centered dialog's position should survive becoming display:none temporarily.]
expected: FAIL
[Dialog should lose centering when removed from the document.]
expected: FAIL
[Dialog's specified position should survive after close() and showModal().]
expected: FAIL
[Dialog should be recentered if showModal() is called after removing 'open'.]
expected: FAIL