Bug 845437 - Get rid of the aImmediateRedraw from nsSliderFrame methods. r=dholbert.

This commit is contained in:
Jonathan Watt 2013-02-26 21:26:41 +00:00
Родитель bb6395acb1
Коммит adbd5211ab
2 изменённых файлов: 17 добавлений и 21 удалений

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

@ -231,7 +231,7 @@ nsSliderFrame::AttributeChanged(int32_t aNameSpaceID,
aModType);
// if the current position changes
if (aAttribute == nsGkAtoms::curpos) {
rv = CurrentPositionChanged(PresContext(), false);
rv = CurrentPositionChanged(PresContext());
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to change position");
if (NS_FAILED(rv))
return rv;
@ -490,12 +490,12 @@ nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
}
if (isMouseOutsideThumb)
{
SetCurrentThumbPosition(scrollbar, mThumbStart, false, true, false);
SetCurrentThumbPosition(scrollbar, mThumbStart, false, false);
return NS_OK;
}
// set it
SetCurrentThumbPosition(scrollbar, pos, false, true, true); // with snapping
SetCurrentThumbPosition(scrollbar, pos, false, true); // with snapping
}
break;
@ -549,7 +549,7 @@ nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
// set it
nsWeakFrame weakFrame(this);
// should aMaySnap be true here?
SetCurrentThumbPosition(scrollbar, pos - thumbLength/2, false, false, false);
SetCurrentThumbPosition(scrollbar, pos - thumbLength/2, false, false);
NS_ENSURE_TRUE(weakFrame.IsAlive(), NS_OK);
DragThumb(true);
@ -645,13 +645,12 @@ nsSliderFrame::PageUpDown(nscoord change)
else if (newpos > maxpos)
newpos = maxpos;
SetCurrentPositionInternal(scrollbar, newpos, true, false);
SetCurrentPositionInternal(scrollbar, newpos, true);
}
// called when the current position changed and we need to update the thumb's location
nsresult
nsSliderFrame::CurrentPositionChanged(nsPresContext* aPresContext,
bool aImmediateRedraw)
nsSliderFrame::CurrentPositionChanged(nsPresContext* aPresContext)
{
nsIFrame* scrollbarBox = GetScrollbar();
nsCOMPtr<nsIContent> scrollbar;
@ -732,7 +731,7 @@ static void UpdateAttribute(nsIContent* aScrollbar, nscoord aNewPos, bool aNotif
// the content in such a way that thumbRect.x/.y becomes aNewThumbPos.
void
nsSliderFrame::SetCurrentThumbPosition(nsIContent* aScrollbar, nscoord aNewThumbPos,
bool aIsSmooth, bool aImmediateRedraw, bool aMaySnap)
bool aIsSmooth, bool aMaySnap)
{
nsRect crect;
GetClientRect(crect);
@ -747,7 +746,7 @@ nsSliderFrame::SetCurrentThumbPosition(nsIContent* aScrollbar, nscoord aNewThumb
newPos = NSToIntRound(newPos / float(increment)) * increment;
}
SetCurrentPosition(aScrollbar, newPos, aIsSmooth, aImmediateRedraw);
SetCurrentPosition(aScrollbar, newPos, aIsSmooth);
}
// Use this function when you know the target scroll position of the scrolled content.
@ -756,7 +755,7 @@ nsSliderFrame::SetCurrentThumbPosition(nsIContent* aScrollbar, nscoord aNewThumb
// direction slider, the newpos should be the distance from the end.
void
nsSliderFrame::SetCurrentPosition(nsIContent* aScrollbar, int32_t aNewPos,
bool aIsSmooth, bool aImmediateRedraw)
bool aIsSmooth)
{
// get min and max position from our content node
int32_t minpos = GetMinPosition(aScrollbar);
@ -776,13 +775,12 @@ nsSliderFrame::SetCurrentPosition(nsIContent* aScrollbar, int32_t aNewPos,
else if (aNewPos > maxpos)
aNewPos = maxpos;
SetCurrentPositionInternal(aScrollbar, aNewPos, aIsSmooth, aImmediateRedraw);
SetCurrentPositionInternal(aScrollbar, aNewPos, aIsSmooth);
}
void
nsSliderFrame::SetCurrentPositionInternal(nsIContent* aScrollbar, int32_t aNewPos,
bool aIsSmooth,
bool aImmediateRedraw)
bool aIsSmooth)
{
nsCOMPtr<nsIContent> scrollbar = aScrollbar;
nsIFrame* scrollbarBox = GetScrollbar();
@ -802,7 +800,7 @@ nsSliderFrame::SetCurrentPositionInternal(nsIContent* aScrollbar, int32_t aNewPo
nsIFrame* frame = content->GetPrimaryFrame();
if (frame && frame->GetType() == nsGkAtoms::sliderFrame) {
static_cast<nsSliderFrame*>(frame)->
CurrentPositionChanged(frame->PresContext(), aImmediateRedraw);
CurrentPositionChanged(frame->PresContext());
}
mUserChanged = false;
return;
@ -905,7 +903,7 @@ nsSliderFrame::StartDrag(nsIDOMEvent* aEvent)
if (scrollToClick) {
// should aMaySnap be true here?
SetCurrentThumbPosition(scrollbar, newpos, false, false, false);
SetCurrentThumbPosition(scrollbar, newpos, false, false);
}
nsIFrame* thumbFrame = mFrames.FirstChild();

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

@ -130,13 +130,11 @@ private:
void PageUpDown(nscoord change);
void SetCurrentThumbPosition(nsIContent* aScrollbar, nscoord aNewPos, bool aIsSmooth,
bool aImmediateRedraw, bool aMaySnap);
void SetCurrentPosition(nsIContent* aScrollbar, int32_t aNewPos, bool aIsSmooth,
bool aImmediateRedraw);
bool aMaySnap);
void SetCurrentPosition(nsIContent* aScrollbar, int32_t aNewPos, bool aIsSmooth);
void SetCurrentPositionInternal(nsIContent* aScrollbar, int32_t pos,
bool aIsSmooth, bool aImmediateRedraw);
nsresult CurrentPositionChanged(nsPresContext* aPresContext,
bool aImmediateRedraw);
bool aIsSmooth);
nsresult CurrentPositionChanged(nsPresContext* aPresContext);
void DragThumb(bool aGrabMouseEvents);
void AddListener();