зеркало из https://github.com/mozilla/pjs.git
Bug 167115 - tree/listbox does't work with background styles (-image,
-attachment) correctly. Patch by alfredkayser@nl.ibm.com, r=varga, sr=bryner
This commit is contained in:
Родитель
6cc6c6f3f0
Коммит
887f64d4e6
|
@ -471,7 +471,7 @@ nsListBoxBodyFrame::VisibilityChanged(nsISupports* aScrollbar, PRBool aVisible)
|
|||
PRInt32 delta = mCurrentIndex - lastPageTopRow;
|
||||
if (delta > 0) {
|
||||
mCurrentIndex = lastPageTopRow;
|
||||
InternalPositionChanged(PR_TRUE, delta, PR_FALSE);
|
||||
InternalPositionChanged(PR_TRUE, delta);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -592,12 +592,6 @@ nsListBoxBodyFrame::EnsureIndexIsVisible(PRInt32 aRowIndex)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsListBoxBodyFrame::ScrollToIndex(PRInt32 aRowIndex)
|
||||
{
|
||||
return DoScrollToIndex(aRowIndex);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsListBoxBodyFrame::ScrollByLines(PRInt32 aNumLines)
|
||||
{
|
||||
|
@ -864,7 +858,7 @@ nsListBoxBodyFrame::PostReflowCallback()
|
|||
////////// scrolling
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsListBoxBodyFrame::DoScrollToIndex(PRInt32 aRowIndex, PRBool aForceDestruct)
|
||||
nsListBoxBodyFrame::ScrollToIndex(PRInt32 aRowIndex)
|
||||
{
|
||||
if (( aRowIndex < 0 ) || (mRowHeight == 0))
|
||||
return NS_OK;
|
||||
|
@ -882,7 +876,7 @@ nsListBoxBodyFrame::DoScrollToIndex(PRInt32 aRowIndex, PRBool aForceDestruct)
|
|||
return NS_OK;
|
||||
|
||||
mCurrentIndex = newIndex;
|
||||
InternalPositionChanged(up, delta, aForceDestruct);
|
||||
InternalPositionChanged(up, delta);
|
||||
|
||||
// This change has to happen immediately.
|
||||
// Flush any pending reflow commands.
|
||||
|
@ -909,7 +903,7 @@ nsListBoxBodyFrame::InternalPositionChangedCallback()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsListBoxBodyFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta, PRBool aForceDestruct)
|
||||
nsListBoxBodyFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta)
|
||||
{
|
||||
if (aDelta == 0)
|
||||
return NS_OK;
|
||||
|
@ -925,7 +919,7 @@ nsListBoxBodyFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta, PRBool a
|
|||
if (mRowHeight)
|
||||
visibleRows = GetAvailableHeight()/mRowHeight;
|
||||
|
||||
if (aDelta < visibleRows && !aForceDestruct) {
|
||||
if (aDelta < visibleRows) {
|
||||
PRInt32 loseRows = aDelta;
|
||||
if (aUp) {
|
||||
// scrolling up, destroy rows from the bottom downwards
|
||||
|
@ -963,9 +957,6 @@ nsListBoxBodyFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta, PRBool a
|
|||
|
||||
VerticalScroll(mYPosition);
|
||||
|
||||
if (aForceDestruct)
|
||||
Redraw(state, nsnull, PR_FALSE);
|
||||
|
||||
PRTime end = PR_Now();
|
||||
|
||||
PRTime difTime;
|
||||
|
|
|
@ -105,9 +105,8 @@ public:
|
|||
nscoord ComputeIntrinsicWidth(nsBoxLayoutState& aBoxLayoutState);
|
||||
|
||||
// scrolling
|
||||
NS_IMETHOD DoScrollToIndex(PRInt32 aRowIndex, PRBool aForceDestruct=PR_FALSE);
|
||||
NS_IMETHOD InternalPositionChangedCallback();
|
||||
NS_IMETHOD InternalPositionChanged(PRBool aUp, PRInt32 aDelta, PRBool aForceDestruct=PR_FALSE);
|
||||
NS_IMETHOD InternalPositionChanged(PRBool aUp, PRInt32 aDelta);
|
||||
nsListScrollSmoother* GetSmoother();
|
||||
void VerticalScroll(PRInt32 aDelta);
|
||||
|
||||
|
|
|
@ -3265,19 +3265,19 @@ nsTreeBodyFrame::ScrollInternal(PRInt32 aRow)
|
|||
|
||||
mTopRowIndex += delta;
|
||||
|
||||
float t2p = mPresContext->TwipsToPixels();
|
||||
nscoord rowHeightAsPixels = NSToCoordRound((float)mRowHeight*t2p);
|
||||
|
||||
// See if we have a background image. If we do, then we cannot blit.
|
||||
PRBool hasBackground = GetStyleBackground()->mBackgroundImage != nsnull;
|
||||
|
||||
PRInt32 absDelta = PR_ABS(delta);
|
||||
if (hasBackground || absDelta*mRowHeight >= mRect.height)
|
||||
// See if we have a transparent background or a background image.
|
||||
// If we do, then we cannot blit.
|
||||
const nsStyleBackground* background = GetStyleBackground();
|
||||
if (background->mBackgroundImage || background->IsTransparent() ||
|
||||
PR_ABS(delta)*mRowHeight >= mRect.height) {
|
||||
Invalidate();
|
||||
else {
|
||||
} else {
|
||||
nsIWidget* widget = nsLeafBoxFrame::GetView()->GetWidget();
|
||||
if (widget)
|
||||
if (widget) {
|
||||
float t2p = mPresContext->TwipsToPixels();
|
||||
nscoord rowHeightAsPixels = NSToCoordRound((float)mRowHeight*t2p);
|
||||
widget->Scroll(0, -delta*rowHeightAsPixels, nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче