зеркало из https://github.com/mozilla/gecko-dev.git
fixed problem with vertical scrollbar not always appearing.
This commit is contained in:
Родитель
c3240ef91b
Коммит
c8bf7f056d
|
@ -417,41 +417,11 @@ NS_IMETHODIMP nsScrollingView :: SetDimensions(nscoord width, nscoord height, PR
|
||||||
clipRect.SetRect(0, 0, width - showVert, height - showHorz);
|
clipRect.SetRect(0, 0, width - showVert, height - showHorz);
|
||||||
clipRect.Deflate(mInsets);
|
clipRect.Deflate(mInsets);
|
||||||
|
|
||||||
// Position the corner view
|
|
||||||
if (nsnull != mCornerView)
|
|
||||||
{
|
|
||||||
nsSize cornerSize;
|
|
||||||
|
|
||||||
mCornerView->GetDimensions(&cornerSize.width, &cornerSize.height);
|
|
||||||
mCornerView->SetBounds(clipRect.XMost(), clipRect.YMost(), cornerSize.width,
|
|
||||||
cornerSize.height, aPaint);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Size and position the clip view
|
// Size and position the clip view
|
||||||
if (nsnull != mClipView)
|
if (nsnull != mClipView)
|
||||||
{
|
|
||||||
mClipView->SetBounds(clipRect, aPaint);
|
mClipView->SetBounds(clipRect, aPaint);
|
||||||
}
|
|
||||||
|
|
||||||
// Size and position the vertical scrollbar
|
UpdateScrollControls(aPaint);
|
||||||
if (nsnull != mVScrollBarView)
|
|
||||||
{
|
|
||||||
nsSize sbSize;
|
|
||||||
|
|
||||||
mVScrollBarView->GetDimensions(&sbSize.width, &sbSize.height);
|
|
||||||
mVScrollBarView->SetBounds(clipRect.XMost(), clipRect.y, sbSize.width,
|
|
||||||
clipRect.height, aPaint);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Size and position the horizontal scrollbar
|
|
||||||
if (nsnull != mHScrollBarView)
|
|
||||||
{
|
|
||||||
nsSize sbSize;
|
|
||||||
|
|
||||||
mHScrollBarView->GetDimensions(&sbSize.width, &sbSize.height);
|
|
||||||
mHScrollBarView->SetBounds(clipRect.x, clipRect.YMost(), clipRect.width,
|
|
||||||
sbSize.height, aPaint);
|
|
||||||
}
|
|
||||||
|
|
||||||
//this will fix the size of the thumb when we resize the root window,
|
//this will fix the size of the thumb when we resize the root window,
|
||||||
//but unfortunately it will also cause scrollbar flashing. so long as
|
//but unfortunately it will also cause scrollbar flashing. so long as
|
||||||
|
@ -1144,6 +1114,7 @@ NS_IMETHODIMP nsScrollingView :: ComputeContainerSize()
|
||||||
{
|
{
|
||||||
controlRect.width -= vwidth;
|
controlRect.width -= vwidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
mClipView->SetDimensions(controlRect.width, controlRect.height, PR_FALSE);
|
mClipView->SetDimensions(controlRect.width, controlRect.height, PR_FALSE);
|
||||||
|
|
||||||
// Position the scrolled view
|
// Position the scrolled view
|
||||||
|
@ -1202,6 +1173,9 @@ NS_IMETHODIMP nsScrollingView :: ComputeContainerSize()
|
||||||
mOffsetX = mOffsetY = 0;
|
mOffsetX = mOffsetY = 0;
|
||||||
mSizeX = mSizeY = 0;
|
mSizeX = mSizeY = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateScrollControls(PR_TRUE);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1394,6 +1368,46 @@ void nsScrollingView :: AdjustChildWidgets(nsScrollingView *aScrolling, nsIView
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nsScrollingView :: UpdateScrollControls(PRBool aPaint)
|
||||||
|
{
|
||||||
|
nsRect clipRect;
|
||||||
|
|
||||||
|
if (nsnull != mClipView)
|
||||||
|
{
|
||||||
|
mClipView->GetBounds(clipRect);
|
||||||
|
|
||||||
|
// Position the corner view
|
||||||
|
if (nsnull != mCornerView)
|
||||||
|
{
|
||||||
|
nsSize cornerSize;
|
||||||
|
|
||||||
|
mCornerView->GetDimensions(&cornerSize.width, &cornerSize.height);
|
||||||
|
mCornerView->SetBounds(clipRect.XMost(), clipRect.YMost(), cornerSize.width,
|
||||||
|
cornerSize.height, aPaint);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Size and position the vertical scrollbar
|
||||||
|
if (nsnull != mVScrollBarView)
|
||||||
|
{
|
||||||
|
nsSize sbSize;
|
||||||
|
|
||||||
|
mVScrollBarView->GetDimensions(&sbSize.width, &sbSize.height);
|
||||||
|
mVScrollBarView->SetBounds(clipRect.XMost(), clipRect.y, sbSize.width,
|
||||||
|
clipRect.height, aPaint);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Size and position the horizontal scrollbar
|
||||||
|
if (nsnull != mHScrollBarView)
|
||||||
|
{
|
||||||
|
nsSize sbSize;
|
||||||
|
|
||||||
|
mHScrollBarView->GetDimensions(&sbSize.width, &sbSize.height);
|
||||||
|
mHScrollBarView->SetBounds(clipRect.x, clipRect.YMost(), clipRect.width,
|
||||||
|
sbSize.height, aPaint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsScrollingView :: SetScrolledView(nsIView *aScrolledView)
|
NS_IMETHODIMP nsScrollingView :: SetScrolledView(nsIView *aScrolledView)
|
||||||
{
|
{
|
||||||
return mViewManager->InsertChild(mClipView, aScrolledView, 0);
|
return mViewManager->InsertChild(mClipView, aScrolledView, 0);
|
||||||
|
|
|
@ -64,6 +64,7 @@ public:
|
||||||
//private
|
//private
|
||||||
virtual void HandleScrollEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags);
|
virtual void HandleScrollEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags);
|
||||||
virtual void AdjustChildWidgets(nsScrollingView *aScrolling, nsIView *aView, nscoord aDx, nscoord aDy, float aScale);
|
virtual void AdjustChildWidgets(nsScrollingView *aScrolling, nsIView *aView, nscoord aDx, nscoord aDy, float aScale);
|
||||||
|
virtual void UpdateScrollControls(PRBool aPaint);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче