void 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 // so we can create or destory rows as needed mRowHeightWasSet = PR_TRUE; PostReflowCallback(); } }
void nsListBoxBodyFrame::SetRowHeight(nscoord aRowHeight) { if (aRowHeight > mRowHeight) { mRowHeight = aRowHeight; // signal we need to dirty everything // and we want to be notified after reflow // so we can create or destory rows as needed mRowHeightWasSet = true; PostReflowCallback(); } }
NS_IMETHODIMP nsListBoxBodyFrame::DoLayout(nsBoxLayoutState& aBoxLayoutState) { if (mScrolling) aBoxLayoutState.SetPaintingDisabled(PR_TRUE); nsresult rv = nsBoxFrame::DoLayout(aBoxLayoutState); if (mScrolling) aBoxLayoutState.SetPaintingDisabled(PR_FALSE); // if we are scrolled and the row height changed // make sure we are scrolled to a correct index. if (mAdjustScroll) PostReflowCallback(); return rv; }
NS_IMETHODIMP nsListBoxBodyFrame::DoLayout(nsBoxLayoutState& aBoxLayoutState) { if (mScrolling) aBoxLayoutState.SetPaintingDisabled(true); nsresult rv = nsBoxFrame::DoLayout(aBoxLayoutState); // determine the real height for the scrollable area from the total number // of rows, since non-visible rows don't yet have frames nsRect rect(nsPoint(0, 0), GetSize()); nsOverflowAreas overflow(rect, rect); if (mLayoutManager) { nsIFrame* childFrame = mFrames.FirstChild(); while (childFrame) { ConsiderChildOverflow(overflow, childFrame); childFrame = childFrame->GetNextSibling(); } nsSize prefSize = mLayoutManager->GetPrefSize(this, aBoxLayoutState); NS_FOR_FRAME_OVERFLOW_TYPES(otype) { nsRect& o = overflow.Overflow(otype); o.height = NS_MAX(o.height, prefSize.height); } } FinishAndStoreOverflow(overflow, GetSize()); if (mScrolling) aBoxLayoutState.SetPaintingDisabled(false); // if we are scrolled and the row height changed // make sure we are scrolled to a correct index. if (mAdjustScroll) PostReflowCallback(); return rv; }