From adbd5211ab3da4c1216a83c74551243f127fe536 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Tue, 26 Feb 2013 21:26:41 +0000 Subject: [PATCH] Bug 845437 - Get rid of the aImmediateRedraw from nsSliderFrame methods. r=dholbert. --- layout/xul/base/src/nsSliderFrame.cpp | 28 +++++++++++++-------------- layout/xul/base/src/nsSliderFrame.h | 10 ++++------ 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/layout/xul/base/src/nsSliderFrame.cpp b/layout/xul/base/src/nsSliderFrame.cpp index f99d896f4b2b..4f3b4a818622 100644 --- a/layout/xul/base/src/nsSliderFrame.cpp +++ b/layout/xul/base/src/nsSliderFrame.cpp @@ -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 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 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(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(); diff --git a/layout/xul/base/src/nsSliderFrame.h b/layout/xul/base/src/nsSliderFrame.h index 45c1fc9d366a..545fa1663e05 100644 --- a/layout/xul/base/src/nsSliderFrame.h +++ b/layout/xul/base/src/nsSliderFrame.h @@ -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();