Bug 407015. Dropdown listboxes should not propagate computed height from the scrollframe to its scrolled content. r+sr=dbaron

This commit is contained in:
roc+@cs.cmu.edu 2007-12-06 16:10:31 -08:00
parent 58638809df
commit 21900626e0
4 changed files with 20 additions and 1 deletions

View File

@ -787,6 +787,12 @@ nsListControlFrame::GetScrollbarStyles() const
verticalStyle);
}
PRBool
nsListControlFrame::ShouldPropagateComputedHeightToScrolledContent() const
{
return !IsInDropDownMode();
}
//---------------------------------------------------------
PRBool
nsListControlFrame::IsOptionElement(nsIContent* aContent)

View File

@ -144,6 +144,7 @@ public:
virtual void SetFocus(PRBool aOn = PR_TRUE, PRBool aRepaint = PR_FALSE);
virtual nsGfxScrollFrameInner::ScrollbarStyles GetScrollbarStyles() const;
virtual PRBool ShouldPropagateComputedHeightToScrolledContent() const;
// for accessibility purposes
#ifdef ACCESSIBILITY

View File

@ -437,6 +437,11 @@ nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState* aState,
nscoord computedHeight = aState->mReflowState.ComputedHeight();
nscoord computedMinHeight = aState->mReflowState.mComputedMinHeight;
nscoord computedMaxHeight = aState->mReflowState.mComputedMaxHeight;
if (!ShouldPropagateComputedHeightToScrolledContent()) {
computedHeight = NS_UNCONSTRAINEDSIZE;
computedMinHeight = 0;
computedMaxHeight = NS_UNCONSTRAINEDSIZE;
}
if (aAssumeHScroll) {
nsSize hScrollbarPrefSize =
mInner.mHScrollbarBox->GetPrefSize(const_cast<nsBoxLayoutState&>(aState->mBoxState));
@ -446,7 +451,7 @@ nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState* aState,
if (computedMaxHeight != NS_UNCONSTRAINEDSIZE)
computedMaxHeight = PR_MAX(0, computedMaxHeight - hScrollbarPrefSize.height);
}
if (aAssumeVScroll) {
nsSize vScrollbarPrefSize =
mInner.mVScrollbarBox->GetPrefSize(const_cast<nsBoxLayoutState&>(aState->mBoxState));

View File

@ -401,6 +401,13 @@ protected:
// NS_FRAME_FIRST_REFLOW set are NOT "initial" as far as we're concerned.
PRBool InInitialReflow() const;
/**
* Override this to return false if computed height/min-height/max-height
* should NOT be propagated to child content.
* nsListControlFrame uses this.
*/
virtual PRBool ShouldPropagateComputedHeightToScrolledContent() const { return PR_TRUE; }
private:
friend class nsGfxScrollFrameInner;
nsGfxScrollFrameInner mInner;