Bug 1584283 - Stop using xul:wizard as a root element and migrate consumers to xul:window[role=dialog] with the wizard as the only child r=surkov. On a CLOSED TREE

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

--HG--
extra : source : 01007f3333ea182c83bced4ff750c96b22925e80
extra : amend_source : 3b06af7be6009d6bd94798e14f30a2550f1c4c4f
extra : histedit_source : be50ba403a84dda5af1c902438c918c17a971578
This commit is contained in:
Kirk Steuber 2019-10-17 21:25:53 +00:00
Родитель 35b75665eb
Коммит 047d40ee73
9 изменённых файлов: 31 добавлений и 24 удалений

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

@ -83,11 +83,11 @@ ENameValueFlag RootAccessible::Name(nsString& aName) const {
}
role RootAccessible::NativeRole() const {
// If it's a <dialog> or <wizard>, use roles::DIALOG instead
// If it's a <dialog>, use roles::DIALOG instead
dom::Element* rootElm = mDocumentNode->GetRootElement();
if (rootElm &&
rootElm->IsAnyOfXULElements(nsGkAtoms::dialog, nsGkAtoms::wizard))
if (rootElm && rootElm->IsXULElement(nsGkAtoms::dialog)) {
return roles::DIALOG;
}
return DocAccessibleWrap::NativeRole();
}

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

@ -29,7 +29,7 @@ var MigrationWizard = {
os.addObserver(this, "Migration:ItemError");
os.addObserver(this, "Migration:Ended");
this._wiz = document.documentElement;
this._wiz = document.querySelector("wizard");
let args = window.arguments;
let entryPointId = args[0] || MigrationUtils.MIGRATION_ENTRYPOINT_UNKNOWN;
@ -225,7 +225,7 @@ var MigrationWizard = {
Services.telemetry
.getHistogramById("FX_MIGRATION_SOURCE_BROWSER")
.add(MigrationUtils.getSourceIdForTelemetry("nothing"));
document.documentElement.cancel();
this._wiz.cancel();
event.preventDefault();
}

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

@ -7,7 +7,7 @@
<!DOCTYPE dialog SYSTEM "chrome://browser/locale/migration/migration.dtd" >
<wizard id="migrationWizard"
<window id="migrationWizard"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
windowtype="Browser:MigrationWizard"
title="&migrationWizard.title;"
@ -16,6 +16,7 @@
style="width: 40em;"
buttons="accept,cancel"
branded="true">
<wizard>
<script src="chrome://global/content/customElements.js"/>
<script src="chrome://browser/content/migration/migration.js"/>
@ -86,3 +87,4 @@
</wizardpage>
</wizard>
</window>

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

@ -950,8 +950,7 @@ nsresult nsBoxFrame::AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
// Ignore 'width', 'height', 'screenX', 'screenY' and 'sizemode' on a
// <window>.
if (mContent->IsAnyOfXULElements(nsGkAtoms::window, nsGkAtoms::dialog,
nsGkAtoms::wizard) &&
if (mContent->IsAnyOfXULElements(nsGkAtoms::window, nsGkAtoms::dialog) &&
(nsGkAtoms::width == aAttribute || nsGkAtoms::height == aAttribute ||
nsGkAtoms::screenX == aAttribute || nsGkAtoms::screenY == aAttribute ||
nsGkAtoms::sizemode == aAttribute)) {

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

@ -99,13 +99,15 @@
return;
}
document.documentElement.setAttribute("role", "dialog");
this.pageCount = this.wizardPages.length;
this._initPages();
this.advance(); // start off on the first page
window.addEventListener("close", event => {
if (document.documentElement.cancel()) {
if (this.cancel()) {
event.preventDefault();
}
});
@ -114,12 +116,12 @@
// onload completes, see bug 103197.
window.addEventListener("load", () =>
window.setTimeout(() => {
document.documentElement._hasLoaded = true;
this._hasLoaded = true;
if (!document.commandDispatcher.focusedElement) {
document.commandDispatcher.advanceFocusIntoSubtree(this);
}
try {
let button = document.documentElement._wizardButtons.defaultButton;
let button = this._wizardButtons.defaultButton;
if (button) {
window.notifyDefaultButtonLoaded(button);
}
@ -461,6 +463,8 @@
class MozWizardButtons extends MozXULElement {
connectedCallback() {
this._wizard = this.getRootNode().host;
this.textContent = "";
this.appendChild(MozXULElement.parseXULToFragment(this._markup, kDTDs));
@ -469,12 +473,12 @@
this.initializeAttributeInheritance();
const listeners = [
["back", () => document.documentElement.rewind()],
["next", () => document.documentElement.advance()],
["finish", () => document.documentElement.advance()],
["cancel", () => document.documentElement.cancel()],
["extra1", () => document.documentElement.extra1()],
["extra2", () => document.documentElement.extra2()],
["back", () => this._wizard.rewind()],
["next", () => this._wizard.advance()],
["finish", () => this._wizard.advance()],
["cancel", () => this._wizard.cancel()],
["extra1", () => this._wizard.extra1()],
["extra2", () => this._wizard.extra2()],
];
for (let [name, listener] of listeners) {
let btn = this.getButton(name);

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

@ -541,8 +541,8 @@ dialog:root /* override :root from above */ {
/********** wizard **********/
wizard,
wizard:root /* override :root from above */ {
wizard {
-moz-box-flex: 1;
-moz-box-orient: vertical;
width: 40em;
height: 30em;

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

@ -153,7 +153,8 @@ function chooseProfileFolder() {
// Checks the current user input for validity and triggers an error message accordingly.
function checkCurrentInput(currentInput) {
var finishButton = document.documentElement.getButton("finish");
let wizard = document.querySelector("wizard");
var finishButton = wizard.getButton("finish");
var finishText = document.getElementById("finishText");
var canAdvance;
@ -177,7 +178,7 @@ function checkCurrentInput(currentInput) {
canAdvance = false;
}
document.documentElement.canAdvance = canAdvance;
wizard.canAdvance = canAdvance;
finishButton.disabled = !canAdvance;
updateProfileDisplay();
@ -226,7 +227,7 @@ function profileExists(aName) {
// Called when the first wizard page is shown.
function enableNextButton() {
document.documentElement.canAdvance = true;
document.querySelector("wizard").canAdvance = true;
}
function onFinish(event) {

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

@ -12,13 +12,14 @@
%profileDTD;
]>
<wizard id="createProfileWizard"
<window id="createProfileWizard"
title="&newprofile.title;"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="initWizard();"
style="&window.size;">
<wizard>
<script src="chrome://global/content/customElements.js"/>
<script src="chrome://global/content/globalOverlay.js"/>
<script src="chrome://global/content/editMenuOverlay.js"/>
@ -74,3 +75,4 @@
</wizardpage>
</wizard>
</window>

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

@ -1266,7 +1266,6 @@ STATIC_ATOMS = [
Atom("headerWindowTarget", "window-target"),
Atom("windowtype", "windowtype"),
Atom("withParam", "with-param"),
Atom("wizard", "wizard"),
Atom("wrap", "wrap"),
Atom("headerDNSPrefetchControl", "x-dns-prefetch-control"),
Atom("headerCSP", "content-security-policy"),