Bug 1557252 - add missing style for in-content dialogs, r=bgrins

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexander Surkov 2019-06-07 11:33:26 +00:00
Родитель 60c8666a31
Коммит 99dfced1b6
1 изменённых файлов: 23 добавлений и 0 удалений

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

@ -57,6 +57,22 @@ class MozDialog extends MozXULElement {
this.attachShadow({mode: "open"});
}
static get observedAttributes() {
return super.observedAttributes.concat("subdialog");
}
attributeChangedCallback(name, oldValue, newValue) {
if (name == "subdialog") {
console.assert(newValue, `Turning off subdialog style is not supported`);
if (this.isConnectedAndReady && !oldValue && newValue) {
this.shadowRoot.appendChild(
MozXULElement.parseXULToFragment(this.inContentStyle));
}
return;
}
super.attributeChangedCallback(name, oldValue, newValue);
}
static get inheritedAttributes() {
return {
".dialog-button-box": "pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient",
@ -64,6 +80,12 @@ class MozDialog extends MozXULElement {
};
}
get inContentStyle() {
return `
<html:link rel="stylesheet" href="chrome://global/skin/in-content/common.css" />
`;
}
get _markup() {
let buttons = AppConstants.platform == "linux" ? `
<hbox class="dialog-button-box">
@ -95,6 +117,7 @@ class MozDialog extends MozXULElement {
return `
<html:link rel="stylesheet" href="chrome://global/content/widgets.css" />
${this.hasAttribute("subdialog") ? this.inContentStyle : ""}
<html:style>
:host([nobuttonspacer]) .spacer {
display: none;