@@ -14,7 +14,7 @@ const { AppConstants } = ChromeUtils.import(
1414var TabModalPrompt = class {
1515 constructor ( win ) {
1616 this . win = win ;
17- let newPrompt = ( this . element = win . document . createXULElement (
17+ let newPrompt = ( this . element = win . document . createElement (
1818 "tabmodalprompt"
1919 ) ) ;
2020 newPrompt . setAttribute ( "role" , "dialog" ) ;
@@ -25,50 +25,38 @@ var TabModalPrompt = class {
2525 newPrompt . appendChild (
2626 win . MozXULElement . parseXULToFragment (
2727 `
28- <spacer class="spacer-top" flex="1"/>
29- <hbox pack="center">
30- <vbox class="tabmodalprompt-mainContainer">
31- <grid class="tabmodalprompt-topContainer" flex="1">
32- <columns>
33- <column/>
34- <column flex="1"/>
35- </columns>
36-
37- <rows class="tabmodalprompt-rows">
38- <vbox class="tabmodalprompt-infoContainer" align="center" pack="center" flex="1">
39- <description class="tabmodalprompt-infoTitle infoTitle" hidden="true" />
40- <description class="tabmodalprompt-infoBody infoBody" id="infoBody-${ randomIdSuffix } "/>
41- </vbox>
42-
43- <row class="tabmodalprompt-loginContainer" hidden="true" align="center">
44- <label class="tabmodalprompt-loginLabel" value="&editfield0.label;" control="loginTextbox-${ randomIdSuffix } "/>
45- <html:input class="tabmodalprompt-loginTextbox" id="loginTextbox-${ randomIdSuffix } "/>
46- </row>
47-
48- <row class="tabmodalprompt-password1Container" hidden="true" align="center">
49- <label class="tabmodalprompt-password1Label" value="&editfield1.label;" control="password1Textbox-${ randomIdSuffix } "/>
50- <html:input class="tabmodalprompt-password1Textbox" type="password" id="password1Textbox-${ randomIdSuffix } "/>
51- </row>
52-
53- <row class="tabmodalprompt-checkboxContainer" hidden="true">
54- <spacer/>
55- <checkbox class="tabmodalprompt-checkbox"/>
56- </row>
57-
58- <!-- content goes here -->
59- </rows>
60- </grid>
61- <hbox class="tabmodalprompt-buttonContainer">
62- <button class="tabmodalprompt-button3" hidden="true"/>
63- <spacer class="tabmodalprompt-buttonSpacer" flex="1"/>
64- <button class="tabmodalprompt-button0" label="&okButton.label;"/>
65- <button class="tabmodalprompt-button2" hidden="true"/>
66- <button class="tabmodalprompt-button1" label="&cancelButton.label;"/>
67- </hbox>
68- </vbox>
69- </hbox>
70- <spacer flex="2"/>
71- ` ,
28+ <div class="tabmodalprompt-mainContainer" xmlns="http://www.w3.org/1999/xhtml" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
29+ <div class="tabmodalprompt-topContainer">
30+ <div class="tabmodalprompt-infoContainer">
31+ <div class="tabmodalprompt-infoTitle infoTitle" hidden="hidden"/>
32+ <div class="tabmodalprompt-infoBody infoBody" id="infoBody-${ randomIdSuffix } " tabindex="-1"/>
33+ </div>
34+
35+ <div class="tabmodalprompt-loginContainer" hidden="hidden">
36+ <xul:label class="tabmodalprompt-loginLabel" value="&editfield0.label;" control="loginTextbox-${ randomIdSuffix } "/>
37+ <input class="tabmodalprompt-loginTextbox" id="loginTextbox-${ randomIdSuffix } "/>
38+ </div>
39+
40+ <div class="tabmodalprompt-password1Container" hidden="hidden">
41+ <xul:label class="tabmodalprompt-password1Label" value="&editfield1.label;" control="password1Textbox-${ randomIdSuffix } "/>
42+ <input class="tabmodalprompt-password1Textbox" type="password" id="password1Textbox-${ randomIdSuffix } "/>
43+ </div>
44+
45+ <div class="tabmodalprompt-checkboxContainer" hidden="hidden">
46+ <div/>
47+ <xul:checkbox class="tabmodalprompt-checkbox"/>
48+ </div>
49+
50+ <!-- content goes here -->
51+ </div>
52+ <div class="tabmodalprompt-buttonContainer">
53+ <xul:button class="tabmodalprompt-button3" hidden="true"/>
54+ <div class="tabmodalprompt-buttonSpacer"/>
55+ <xul:button class="tabmodalprompt-button0" label="&okButton.label;"/>
56+ <xul:button class="tabmodalprompt-button2" hidden="true"/>
57+ <xul:button class="tabmodalprompt-button1" label="&cancelButton.label;"/>
58+ </div>
59+ </div>` ,
7260 [
7361 "chrome://global/locale/commonDialog.dtd" ,
7462 "chrome://global/locale/dialogOverlay.dtd" ,
@@ -94,7 +82,7 @@ var TabModalPrompt = class {
9482 infoBody : newPrompt . querySelector ( ".tabmodalprompt-infoBody" ) ,
9583 infoTitle : newPrompt . querySelector ( ".tabmodalprompt-infoTitle" ) ,
9684 infoIcon : null ,
97- rows : newPrompt . querySelector ( ".tabmodalprompt-rows " ) ,
85+ rows : newPrompt . querySelector ( ".tabmodalprompt-topContainer " ) ,
9886 checkbox : newPrompt . querySelector ( ".tabmodalprompt-checkbox" ) ,
9987 checkboxContainer : newPrompt . querySelector (
10088 ".tabmodalprompt-checkboxContainer"
@@ -250,8 +238,6 @@ var TabModalPrompt = class {
250238
251239
252240
253-
254- this . onResize ( ) ;
255241 }
256242
257243 shutdownPrompt ( ) {
@@ -280,58 +266,13 @@ var TabModalPrompt = class {
280266
281267 handleEvent ( aEvent ) {
282268 switch ( aEvent . type ) {
283- case "resize" :
284- this . onResize ( ) ;
285- break ;
286269 case "unload" :
287270 case "TabClose" :
288271 this . abortPrompt ( ) ;
289272 break ;
290273 }
291274 }
292275
293- onResize ( ) {
294- let availWidth = this . element . clientWidth ;
295- let availHeight = this . element . clientHeight ;
296- if ( availWidth == this . availWidth && availHeight == this . availHeight ) {
297- return ;
298- }
299- this . availWidth = availWidth ;
300- this . availHeight = availHeight ;
301-
302- let main = this . ui . mainContainer ;
303- let info = this . ui . infoContainer ;
304- let body = this . ui . infoBody ;
305-
306-
307- if ( ! this . minWidth ) {
308- this . minWidth = parseInt ( this . win . getComputedStyle ( main ) . minWidth ) ;
309- }
310- if ( ! this . minHeight ) {
311- this . minHeight = parseInt ( this . win . getComputedStyle ( main ) . minHeight ) ;
312- }
313- let maxWidth =
314- Math . max ( Math . floor ( availWidth * 0.6 ) , this . minWidth ) +
315- info . clientWidth -
316- main . clientWidth ;
317- let maxHeight =
318- Math . max ( Math . floor ( availHeight * 0.6 ) , this . minHeight ) +
319- info . clientHeight -
320- main . clientHeight ;
321- body . style . maxWidth = maxWidth + "px" ;
322- info . style . overflow = info . style . width = info . style . height = "" ;
323-
324-
325- if ( info . clientWidth > maxWidth ) {
326- info . style . overflow = "auto" ;
327- info . style . width = maxWidth + "px" ;
328- }
329- if ( info . clientHeight > maxHeight ) {
330- info . style . overflow = "auto" ;
331- info . style . height = maxHeight + "px" ;
332- }
333- }
334-
335276 onButtonClick ( buttonNum ) {
336277
337278
0 commit comments