mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 388361, dropdowns in font dialog not always working, make sure to reset cached size when a frame is added or removed, r+sr=bz
This commit is contained in:
parent
6b92c617ca
commit
873f3ed906
@ -1154,6 +1154,7 @@ nsMenuFrame::RemoveFrame(nsIAtom* aListName,
|
|||||||
// Go ahead and remove this frame.
|
// Go ahead and remove this frame.
|
||||||
mPopupFrame->Destroy();
|
mPopupFrame->Destroy();
|
||||||
mPopupFrame = nsnull;
|
mPopupFrame = nsnull;
|
||||||
|
mLastPref.SizeTo(-1, -1);
|
||||||
PresContext()->PresShell()->
|
PresContext()->PresShell()->
|
||||||
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
|
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
|
||||||
NS_FRAME_HAS_DIRTY_CHILDREN);
|
NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||||
@ -1174,6 +1175,7 @@ nsMenuFrame::InsertFrames(nsIAtom* aListName,
|
|||||||
|
|
||||||
if (!mPopupFrame && aFrameList->GetType() == nsGkAtoms::menuPopupFrame) {
|
if (!mPopupFrame && aFrameList->GetType() == nsGkAtoms::menuPopupFrame) {
|
||||||
mPopupFrame = static_cast<nsMenuPopupFrame *>(aFrameList);
|
mPopupFrame = static_cast<nsMenuPopupFrame *>(aFrameList);
|
||||||
|
mLastPref.SizeTo(-1, -1);
|
||||||
|
|
||||||
#ifdef DEBUG_LAYOUT
|
#ifdef DEBUG_LAYOUT
|
||||||
nsBoxLayoutState state(PresContext());
|
nsBoxLayoutState state(PresContext());
|
||||||
@ -1201,6 +1203,7 @@ nsMenuFrame::AppendFrames(nsIAtom* aListName,
|
|||||||
|
|
||||||
if (!mPopupFrame && aFrameList->GetType() == nsGkAtoms::menuPopupFrame) {
|
if (!mPopupFrame && aFrameList->GetType() == nsGkAtoms::menuPopupFrame) {
|
||||||
mPopupFrame = static_cast<nsMenuPopupFrame *>(aFrameList);
|
mPopupFrame = static_cast<nsMenuPopupFrame *>(aFrameList);
|
||||||
|
mLastPref.SizeTo(-1, -1);
|
||||||
|
|
||||||
#ifdef DEBUG_LAYOUT
|
#ifdef DEBUG_LAYOUT
|
||||||
nsBoxLayoutState state(PresContext());
|
nsBoxLayoutState state(PresContext());
|
||||||
|
@ -49,6 +49,7 @@ _TEST_FILES = test_bug360220.xul \
|
|||||||
test_bug365773.xul \
|
test_bug365773.xul \
|
||||||
test_colorpicker_popup.xul \
|
test_colorpicker_popup.xul \
|
||||||
test_popup_coords.xul \
|
test_popup_coords.xul \
|
||||||
|
test_popup_recreate.xul \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libs:: $(_TEST_FILES)
|
libs:: $(_TEST_FILES)
|
||||||
|
81
toolkit/content/tests/widgets/test_popup_recreate.xul
Normal file
81
toolkit/content/tests/widgets/test_popup_recreate.xul
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||||
|
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
|
||||||
|
|
||||||
|
<window title="Popup Recreate Test"
|
||||||
|
onload="setTimeout(init, 0)"
|
||||||
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||||
|
|
||||||
|
<title>Popup Recreate Test</title>
|
||||||
|
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
This is a test for bug 388361.
|
||||||
|
|
||||||
|
This test checks that a menulist's popup is properly created and sized when
|
||||||
|
the popup node is removed and another added in its place.
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
<![CDATA[
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
var gState = "before";
|
||||||
|
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
document.getElementById("menulist").open = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function recreate()
|
||||||
|
{
|
||||||
|
if (gState == "before") {
|
||||||
|
var element = document.getElementById("menulist");
|
||||||
|
while (element.hasChildNodes())
|
||||||
|
element.removeChild(element.firstChild);
|
||||||
|
element.appendItem("Cat");
|
||||||
|
gState = "after";
|
||||||
|
document.getElementById("menulist").open = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkSize()
|
||||||
|
{
|
||||||
|
var menulist = document.getElementById("menulist");
|
||||||
|
var menurect = menulist.getBoundingClientRect();
|
||||||
|
var popuprect = menulist.menupopup.getBoundingClientRect();
|
||||||
|
|
||||||
|
ok(Math.round(menurect.left) == Math.round(popuprect.left) &&
|
||||||
|
Math.round(menurect.right) == Math.round(popuprect.right) &&
|
||||||
|
Math.round(popuprect.right) - Math.round(popuprect.left) > 0,
|
||||||
|
"height " + gState)
|
||||||
|
document.getElementById("menulist").open = false;
|
||||||
|
}
|
||||||
|
]]>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<hbox>
|
||||||
|
<menulist id="menulist" onpopupshown="checkSize();" onpopuphidden="recreate();">
|
||||||
|
<menupopup>
|
||||||
|
<menuitem label="Cat"/>
|
||||||
|
</menupopup>
|
||||||
|
</menulist>
|
||||||
|
</hbox>
|
||||||
|
|
||||||
|
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<p id="display">
|
||||||
|
</p>
|
||||||
|
<div id="content" style="display: none">
|
||||||
|
</div>
|
||||||
|
<pre id="test">
|
||||||
|
</pre>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</window>
|
Loading…
Reference in New Issue
Block a user