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
Родитель 7445dc1fd9
Коммит 9960ec3300
3 изменённых файлов: 73 добавлений и 2 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -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>