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
Родитель 3a08f54e99
Коммит 0b1d5ef941
4 изменённых файлов: 20 добавлений и 1 удалений

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

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

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

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

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

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

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

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