Firefox addon <;预窗口>;当browser.preferences.animateFadeIn==true时,调整自身大小到错误选项卡
我在扩展的首选项屏幕上遇到了(另一个)错误。当Firefox addon <;预窗口>;当browser.preferences.animateFadeIn==true时,调整自身大小到错误选项卡,firefox-addon,xul,Firefox Addon,Xul,我在扩展的首选项屏幕上遇到了(另一个)错误。当browser.preferences.animateFadeIn设置为true(在Mac上)时,窗口大小应更改,以完全适应切换窗格上的内容。相反,当窗口打开时,它的大小会调整为最大的窗格,但在切换窗格时,它会发生尽可能多的变化。如果这还不太清楚,下面是一个视频: 即使删除了所有元素和大多数窗格,错误仍然会发生: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global
browser.preferences.animateFadeIn
设置为true(在Mac上)时,窗口大小应更改,以完全适应切换窗格上的内容。相反,当窗口打开时,它的大小会调整为最大的窗格,但在切换窗格时,它会发生尽可能多的变化。如果这还不太清楚,下面是一个视频:
即使删除了所有
元素和大多数窗格,错误仍然会发生:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
<?xml-stylesheet href="chrome://nextplease/skin/nextpleasePreferences.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://nextplease/locale/nextplease.dtd">
<prefwindow id="nextpleaseprefs" title="&options.title;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="nextplease.images" label="&options.images.title;" image="chrome://nextplease/skin/Image.png">
<preferences>
<preference id="nextimages" name="nextplease.nextimage.expr0" type="unichar"/>
<preference id="previmages" name="nextplease.previmage.expr0" type="unichar"/>
<preference id="firstimages" name="nextplease.firstimage.expr0" type="unichar"/>
<preference id="lastimages" name="nextplease.lastimage.expr0" type="unichar"/>
</preferences>
<hbox flex="1">
<listbox width="80" onselect="nextplease.selectedPanelChanged(this);">
<listitem label="&options.next;" selected="true"/>
<listitem label="&options.prev;"/>
<listitem label="&options.first;"/>
<listitem label="&options.last;"/>
</listbox>
<separator class="groove" orient="vertical" style="opacity: 0.5; margin-top: 5px; margin-bottom: 5px;"/>
<vbox flex="1">
<deck flex="1">
<listbox id="Next_Image_list" seltype="multiple" flex="1"
onkeypress="nextplease.removeSelectedOnDelete(event, this);" onselect="nextplease.enableDisableRemoveButton(this);" onchange="nextplease.syncListboxToPref(this);"/>
<listbox id="Prev_Image_list" seltype="multiple" flex="1"
onkeypress="nextplease.removeSelectedOnDelete(event, this);" onselect="nextplease.enableDisableRemoveButton(this);" onchange="nextplease.syncListboxToPref(this);"/>
<listbox id="First_Image_list" seltype="multiple" flex="1"
onkeypress="nextplease.removeSelectedOnDelete(event, this);" onselect="nextplease.enableDisableRemoveButton(this);" onchange="nextplease.syncListboxToPref(this);"/>
<listbox id="Last_Image_list" seltype="multiple" flex="1"
onkeypress="nextplease.removeSelectedOnDelete(event, this);" onselect="nextplease.enableDisableRemoveButton(this);" onchange="nextplease.syncListboxToPref(this);"/>
</deck>
<hbox id="images_dummy_texts" collapsed="true">
<textbox id="Next_Image_dummy_text" preference="nextimages" onchange="nextplease.syncPrefToListbox(this);"/>
<textbox id="Prev_Image_dummy_text" preference="previmages" onchange="nextplease.syncPrefToListbox(this);"/>
<textbox id="First_Image_dummy_text" preference="firstimages" onchange="nextplease.syncPrefToListbox(this);"/>
<textbox id="Last_Image_dummy_text" preference="lastimages" onchange="nextplease.syncPrefToListbox(this);"/>
</hbox>
<separator class="thin"/>
<hbox align="stretch">
<textbox type="text" maxlength="256" onkeypress="nextplease.addOnReturn(event, this);"/>
<button label="&options.add;" style="margin-left: 0"
oncommand="nextplease.addToListbox(this);"/>
<spacer flex="1" minwidth="15"/>
<button label="&options.removeSelected;" disabled="true" style="margin-right: 2px"
oncommand="nextplease.removeSelectedFromListbox(this);"/>
<spacer flex="1" minwidth="40"/>
<button label="&options.restoreDefault;"
oncommand="nextplease.restoreDefaultListbox(this);"/>
</hbox>
</vbox>
</hbox>
</prefpane>
<prefpane id="nextplease.debug" label="&options.debug.title;" image="chrome://nextplease/skin/Settings.png">
<preferences>
<preference id="log" name="nextplease.log" type="bool"/>
<preference id="log.detailed" name="nextplease.log.detailed" type="bool"/>
<preference id="log.file" name="nextplease.log.file" type="bool"/>
<preference id="highlight" name="nextplease.highlight" type="bool"/>
<preference id="highlight.color" name="nextplease.highlight.color" type="string"/>
<preference id="highlight.prefetched" name="nextplease.highlight.prefetched" type="bool"/>
<preference id="highlight.prefetched.color" name="nextplease.highlight.prefetched.color" type="string"/>
</preferences>
<vbox>
<checkbox label="&options.log.normal;" preference="log"/>
<checkbox label="&options.log.detailed;" preference="log.detailed"/>
<!--<checkbox id="nextplease.log.file" label="&options.log.file;" preference="log.file/>-->
<separator/>
<hbox>
<checkbox label="&options.highlight;"
preference="highlight"
oncommand="nextplease.enableDisableHighlightColorPickers();"/>
<colorpicker type="button" preference="highlight.color"/>
</hbox>
<hbox>
<checkbox label="&options.highlight.prefetched;"
preference="highlight.prefetched"
oncommand="nextplease.enableDisableHighlightColorPickers();"/>
<colorpicker type="button" preference="highlight.prefetched.color"/>
</hbox>
</vbox>
</prefpane>
</prefwindow>
是的,我同意这是一个bug。加载第一个窗格时,prefwindow会根据其内容调整自身大小。在您的例子中,这包括几个“背景”窗格。不幸的是,在动画的情况下,检测这一点的代码被忽略了。当前代码如下所示:
if (animation) {
if (switching)
animate();
} else {
if (panes > 1)
fixHeight();
}
if (animation && switching)
animate();
else if (panes > 1)
fixHeight();
它应该是这样的:
if (animation) {
if (switching)
animate();
} else {
if (panes > 1)
fixHeight();
}
if (animation && switching)
animate();
else if (panes > 1)
fixHeight();
这将固定第一个窗格的高度,即使在启用动画时也是如此。(如果只有一个窗格,则无需执行任何操作。)