Bug 870917: Fix overlay scrollbars in XUL trees to fade and disappear correctly instead of pulsating continuously. r=roc

This commit is contained in:
Stephen Pohl 2013-07-12 23:19:37 -04:00
Родитель bc708ebead
Коммит 29f1f3b9cf
2 изменённых файлов: 28 добавлений и 5 удалений

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

@ -114,6 +114,7 @@ nsTreeBodyFrame::nsTreeBodyFrame(nsIPresShell* aPresShell, nsStyleContext* aCont
mTopRowIndex(0),
mPageLength(0),
mHorzPosition(0),
mOriginalHorzWidth(-1),
mHorzWidth(0),
mAdjustWidth(0),
mRowHeight(0),
@ -384,16 +385,29 @@ nsTreeBodyFrame::EnsureView()
}
}
void
nsTreeBodyFrame::ManageReflowCallback(const nsRect& aRect, nscoord aHorzWidth)
{
if (!mReflowCallbackPosted &&
(!aRect.IsEqualEdges(mRect) || mHorzWidth != aHorzWidth)) {
PresContext()->PresShell()->PostReflowCallback(this);
mReflowCallbackPosted = true;
mOriginalHorzWidth = mHorzWidth;
}
else if (mReflowCallbackPosted &&
mHorzWidth != aHorzWidth && mOriginalHorzWidth == aHorzWidth) {
PresContext()->PresShell()->CancelReflowCallback(this);
mReflowCallbackPosted = false;
mOriginalHorzWidth = -1;
}
}
void
nsTreeBodyFrame::SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect,
bool aRemoveOverflowArea)
{
nscoord horzWidth = CalcHorzWidth(GetScrollParts());
if ((!aRect.IsEqualEdges(mRect) || mHorzWidth != horzWidth) && !mReflowCallbackPosted) {
mReflowCallbackPosted = true;
PresContext()->PresShell()->PostReflowCallback(this);
}
ManageReflowCallback(aRect, horzWidth);
mHorzWidth = horzWidth;
nsLeafBoxFrame::SetBounds(aBoxLayoutState, aRect, aRemoveOverflowArea);

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

@ -120,6 +120,8 @@ public:
nsresult EndUpdateBatch();
nsresult ClearStyleAndImageCaches();
void ManageReflowCallback(const nsRect& aRect, nscoord aHorzWidth);
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
virtual void SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect,
bool aRemoveOverflowArea = false) MOZ_OVERRIDE;
@ -576,6 +578,13 @@ protected: // Data Members
// The horizontal scroll position
nscoord mHorzPosition;
// The original desired horizontal width before changing it and posting a
// reflow callback. In some cases, the desired horizontal width can first be
// different from the current desired horizontal width, only to return to
// the same value later during the same reflow. In this case, we can cancel
// the posted reflow callback and prevent an unnecessary reflow.
nscoord mOriginalHorzWidth;
// Our desired horizontal width (the width for which we actually have tree
// columns).
nscoord mHorzWidth;