bug 392040, <select> menu requires multiple clicks to show up in zoom pages, r=bz, sr=roc, a=blocking1.9+. Also checking in a testcase for bug 404872

git-svn-id: svn://10.0.0.236/trunk@242019 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
hwaara%gmail.com 2007-12-22 21:07:59 +00:00
parent e74817a8da
commit 226ed12ee2
4 changed files with 61 additions and 1 deletions

View File

@ -185,6 +185,7 @@ include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += \
-I$(srcdir) \
-I$(srcdir)/../base \
-I$(srcdir)/../forms \
-I$(srcdir)/../tables \
-I$(srcdir)/../xul/base/src \
-I$(srcdir)/../../content/xul/content/src \

View File

@ -68,6 +68,7 @@
#include "nsDisplayList.h"
#include "nsContentErrors.h"
#include "nsIEventStateManager.h"
#include "nsListControlFrame.h"
#ifdef NS_DEBUG
#undef NOISY
@ -429,6 +430,24 @@ nsContainerFrame::PositionFrameView(nsIFrame* aKidFrame)
vm->MoveViewTo(view, pt.x, pt.y);
}
static PRBool
IsMenuPopup(nsIFrame *aFrame)
{
nsIAtom *frameType = aFrame->GetType();
// We're a menupopup if we're the list control frame dropdown for a combobox.
if (frameType == nsGkAtoms::listControlFrame) {
nsListControlFrame *listControlFrame = static_cast<nsListControlFrame*>(aFrame);
if (listControlFrame) {
return listControlFrame->IsInDropDownMode();
}
}
// ... or if we're a XUL menupopup frame.
return (frameType == nsGkAtoms::menuPopupFrame);
}
static void
SyncFrameViewGeometryDependentProperties(nsPresContext* aPresContext,
nsIFrame* aFrame,
@ -532,7 +551,7 @@ nsContainerFrame::SyncFrameViewProperties(nsPresContext* aPresContext,
// visible in all cases because the scrollbars will be showing
// XXXldb Does the view system really enforce this correctly?
viewIsVisible = PR_FALSE;
} else if (aFrame->GetType() == nsGkAtoms::menuPopupFrame) {
} else if (IsMenuPopup(aFrame)) {
// if the view is for a popup, don't show the view if the popup is closed
nsIWidget* widget = aView->GetWidget();
if (widget) {

View File

@ -57,6 +57,7 @@ _TEST_FILES = test_bug288789.html \
test_bug394173.html \
test_bug394239.html \
test_bug402380.html \
test_bug404872.html \
test_bug405178.html \
test_character_movement.html \
test_word_movement.html \

View File

@ -0,0 +1,39 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=404872
-->
<head>
<title>Test for Bug 404872</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=404872">Mozilla Bug 404872</a>
<p id="display">
<select multiple id="a">
<option name="value1">value1</option>
<option name="value2">value2</option>
<option name="value3">value3</option>
</select>
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/* Focus, press key down twice, and make sure we successfully selected the second item. */
$('a').focus();
synthesizeKey("VK_DOWN", {});
synthesizeKey("VK_DOWN", {});
is($("a").value, "value2", "value2 should be selected!");
</script>
</pre>
</body>
</html>