Bug 553814, don't set listbox minheight, which prevents the scrollbar from appearing when the rows attribute is used, r=neil

This commit is contained in:
Neil Deakin 2010-05-13 09:44:14 -04:00
Родитель 4cf8c78b03
Коммит 08f189d3d3
2 изменённых файлов: 9 добавлений и 29 удалений

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

@ -261,21 +261,8 @@ nsListBoxBodyFrame::AttributeChanged(PRInt32 aNameSpaceID,
nsresult rv = NS_OK;
if (aAttribute == nsGkAtoms::rows) {
nsAutoString rows;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rows, rows);
if (!rows.IsEmpty()) {
PRInt32 dummy;
PRInt32 count = rows.ToInteger(&dummy);
PRInt32 rowHeight = GetRowHeightAppUnits();
rowHeight = nsPresContext::AppUnitsToIntCSSPixels(rowHeight);
nsAutoString value;
value.AppendInt(rowHeight*count);
mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::minheight, value, PR_FALSE);
PresContext()->PresShell()->
FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
}
PresContext()->PresShell()->
FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
}
else
rv = nsBoxFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
@ -660,20 +647,6 @@ nsListBoxBodyFrame::SetRowHeight(nscoord aRowHeight)
{
if (aRowHeight > mRowHeight) {
mRowHeight = aRowHeight;
nsAutoString rows;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rows, rows);
if (rows.IsEmpty())
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::size, rows);
if (!rows.IsEmpty()) {
PRInt32 dummy;
PRInt32 count = rows.ToInteger(&dummy);
PRInt32 rowHeight = nsPresContext::AppUnitsToIntCSSPixels(aRowHeight);
nsAutoString value;
value.AppendInt(rowHeight*count);
mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::minheight, value, PR_FALSE);
}
// signal we need to dirty everything
// and we want to be notified after reflow

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

@ -97,6 +97,13 @@ function testListbox()
{
var id = "listbox";
var listbox = document.getElementById(id);
// Check that a scrollbar is visible by comparing the width of the listitem
// with the width of the listbox. This is a simple way to do this without
// checking the anonymous content.
ok(listbox.firstChild.getBoundingClientRect().width < listbox.getBoundingClientRect().width - 10,
id + ": Scrollbar visible");
listbox.selectedIndex = 0;
sendKey("PAGE_DOWN", id);
is(listbox.selectedItem.id, id + "_item8", id + ": Page down should go to the item one visible page away");