зеркало из 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;
|
PRInt32 delta = mCurrentIndex - lastPageTopRow;
|
||||||
if (delta > 0) {
|
if (delta > 0) {
|
||||||
mCurrentIndex = lastPageTopRow;
|
mCurrentIndex = lastPageTopRow;
|
||||||
InternalPositionChanged(PR_TRUE, delta, PR_FALSE);
|
InternalPositionChanged(PR_TRUE, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -592,12 +592,6 @@ nsListBoxBodyFrame::EnsureIndexIsVisible(PRInt32 aRowIndex)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsListBoxBodyFrame::ScrollToIndex(PRInt32 aRowIndex)
|
|
||||||
{
|
|
||||||
return DoScrollToIndex(aRowIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsListBoxBodyFrame::ScrollByLines(PRInt32 aNumLines)
|
nsListBoxBodyFrame::ScrollByLines(PRInt32 aNumLines)
|
||||||
{
|
{
|
||||||
|
@ -864,7 +858,7 @@ nsListBoxBodyFrame::PostReflowCallback()
|
||||||
////////// scrolling
|
////////// scrolling
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsListBoxBodyFrame::DoScrollToIndex(PRInt32 aRowIndex, PRBool aForceDestruct)
|
nsListBoxBodyFrame::ScrollToIndex(PRInt32 aRowIndex)
|
||||||
{
|
{
|
||||||
if (( aRowIndex < 0 ) || (mRowHeight == 0))
|
if (( aRowIndex < 0 ) || (mRowHeight == 0))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -882,7 +876,7 @@ nsListBoxBodyFrame::DoScrollToIndex(PRInt32 aRowIndex, PRBool aForceDestruct)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
mCurrentIndex = newIndex;
|
mCurrentIndex = newIndex;
|
||||||
InternalPositionChanged(up, delta, aForceDestruct);
|
InternalPositionChanged(up, delta);
|
||||||
|
|
||||||
// This change has to happen immediately.
|
// This change has to happen immediately.
|
||||||
// Flush any pending reflow commands.
|
// Flush any pending reflow commands.
|
||||||
|
@ -909,7 +903,7 @@ nsListBoxBodyFrame::InternalPositionChangedCallback()
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsListBoxBodyFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta, PRBool aForceDestruct)
|
nsListBoxBodyFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta)
|
||||||
{
|
{
|
||||||
if (aDelta == 0)
|
if (aDelta == 0)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -925,7 +919,7 @@ nsListBoxBodyFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta, PRBool a
|
||||||
if (mRowHeight)
|
if (mRowHeight)
|
||||||
visibleRows = GetAvailableHeight()/mRowHeight;
|
visibleRows = GetAvailableHeight()/mRowHeight;
|
||||||
|
|
||||||
if (aDelta < visibleRows && !aForceDestruct) {
|
if (aDelta < visibleRows) {
|
||||||
PRInt32 loseRows = aDelta;
|
PRInt32 loseRows = aDelta;
|
||||||
if (aUp) {
|
if (aUp) {
|
||||||
// scrolling up, destroy rows from the bottom downwards
|
// scrolling up, destroy rows from the bottom downwards
|
||||||
|
@ -963,9 +957,6 @@ nsListBoxBodyFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta, PRBool a
|
||||||
|
|
||||||
VerticalScroll(mYPosition);
|
VerticalScroll(mYPosition);
|
||||||
|
|
||||||
if (aForceDestruct)
|
|
||||||
Redraw(state, nsnull, PR_FALSE);
|
|
||||||
|
|
||||||
PRTime end = PR_Now();
|
PRTime end = PR_Now();
|
||||||
|
|
||||||
PRTime difTime;
|
PRTime difTime;
|
||||||
|
|
|
@ -105,9 +105,8 @@ public:
|
||||||
nscoord ComputeIntrinsicWidth(nsBoxLayoutState& aBoxLayoutState);
|
nscoord ComputeIntrinsicWidth(nsBoxLayoutState& aBoxLayoutState);
|
||||||
|
|
||||||
// scrolling
|
// scrolling
|
||||||
NS_IMETHOD DoScrollToIndex(PRInt32 aRowIndex, PRBool aForceDestruct=PR_FALSE);
|
|
||||||
NS_IMETHOD InternalPositionChangedCallback();
|
NS_IMETHOD InternalPositionChangedCallback();
|
||||||
NS_IMETHOD InternalPositionChanged(PRBool aUp, PRInt32 aDelta, PRBool aForceDestruct=PR_FALSE);
|
NS_IMETHOD InternalPositionChanged(PRBool aUp, PRInt32 aDelta);
|
||||||
nsListScrollSmoother* GetSmoother();
|
nsListScrollSmoother* GetSmoother();
|
||||||
void VerticalScroll(PRInt32 aDelta);
|
void VerticalScroll(PRInt32 aDelta);
|
||||||
|
|
||||||
|
|
|
@ -3265,19 +3265,19 @@ nsTreeBodyFrame::ScrollInternal(PRInt32 aRow)
|
||||||
|
|
||||||
mTopRowIndex += delta;
|
mTopRowIndex += delta;
|
||||||
|
|
||||||
float t2p = mPresContext->TwipsToPixels();
|
// See if we have a transparent background or a background image.
|
||||||
nscoord rowHeightAsPixels = NSToCoordRound((float)mRowHeight*t2p);
|
// If we do, then we cannot blit.
|
||||||
|
const nsStyleBackground* background = GetStyleBackground();
|
||||||
// See if we have a background image. If we do, then we cannot blit.
|
if (background->mBackgroundImage || background->IsTransparent() ||
|
||||||
PRBool hasBackground = GetStyleBackground()->mBackgroundImage != nsnull;
|
PR_ABS(delta)*mRowHeight >= mRect.height) {
|
||||||
|
|
||||||
PRInt32 absDelta = PR_ABS(delta);
|
|
||||||
if (hasBackground || absDelta*mRowHeight >= mRect.height)
|
|
||||||
Invalidate();
|
Invalidate();
|
||||||
else {
|
} else {
|
||||||
nsIWidget* widget = nsLeafBoxFrame::GetView()->GetWidget();
|
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);
|
widget->Scroll(0, -delta*rowHeightAsPixels, nsnull);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче