Bug 320799. Fix client* and scroll* for comboboxes to not consider the dropdown's scrollable area. r=roc

This commit is contained in:
Boris Zbarsky 2011-10-18 16:17:45 -04:00
parent ec91f9a696
commit 622bb687dd
3 changed files with 73 additions and 2 deletions

View File

@ -1927,8 +1927,9 @@ nsGenericElement::GetScrollFrame(nsIFrame **aStyledFrame)
}
// menu frames implement GetScrollTargetFrame but we don't want
// to use it here.
if (frame->GetType() != nsGkAtoms::menuFrame) {
// to use it here. Similar for comboboxes.
if (frame->GetType() != nsGkAtoms::menuFrame &&
frame->GetType() != nsGkAtoms::comboboxControlFrame) {
nsIScrollableFrame *scrollFrame = frame->GetScrollTargetFrame();
if (scrollFrame)
return scrollFrame;

View File

@ -86,6 +86,7 @@ _TEST_FILES1 = \
bug298064-subframe.html \
test_xhr_forbidden_headers.html \
test_bug311681.xml \
test_bug320799.html \
test_bug322317.html \
test_bug330925.xhtml \
test_bug331959.html \

View File

@ -0,0 +1,69 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=320799
-->
<head>
<title>Test for Bug 320799</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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=320799">Mozilla Bug 320799</a>
<p id="display">
<select id="s" style="width: 100px">
<option>This is a test, it really is a test I tell you</option>
</select>
<select id="s2">
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
<option>x</option>
</select>
<select id="s3">
<option>x</option>
</select>
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 320799 **/
is($("s").scrollWidth, 100, "Scroll width should not include dropdown contents");
is($("s2").clientWidth, $("s3").clientWidth,
"Client width should not depend on the dropdown's vertical scrollbar");
</script>
</pre>
</body>
</html>