Bug 845437 - Get rid of the aImmediateRedraw from nsSliderFrame methods. r=dholbert.
authorJonathan Watt <jwatt@jwatt.org>
Tue, 26 Feb 2013 21:26:41 +0000
changeset 123083 27c71bbc1675d83775337482b0a9998e90c52483
parent 123082 ce21cc14287762b6db3d526094ef4f36bca8bf7d
child 123084 920e402561568674a2b93e628de9c7fac33cc6cc
push id24372
push useremorley@mozilla.com
push dateWed, 27 Feb 2013 13:22:59 +0000
treeherdermozilla-central@0a91da5f5eab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs845437
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 845437 - Get rid of the aImmediateRedraw from nsSliderFrame methods. r=dholbert.
layout/xul/base/src/nsSliderFrame.cpp
layout/xul/base/src/nsSliderFrame.h
--- a/layout/xul/base/src/nsSliderFrame.cpp
+++ b/layout/xul/base/src/nsSliderFrame.cpp
@@ -226,17 +226,17 @@ NS_IMETHODIMP
 nsSliderFrame::AttributeChanged(int32_t aNameSpaceID,
                                 nsIAtom* aAttribute,
                                 int32_t aModType)
 {
   nsresult rv = nsBoxFrame::AttributeChanged(aNameSpaceID, aAttribute,
                                              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;
   } else if (aAttribute == nsGkAtoms::minpos ||
              aAttribute == nsGkAtoms::maxpos) {
       // bounds check it.
 
       nsIFrame* scrollbarBox = GetScrollbar();
@@ -485,22 +485,22 @@ nsSliderFrame::HandleEvent(nsPresContext
             isMouseOutsideThumb = true;
         }
       }
       if (aEvent->eventStructType == NS_TOUCH_EVENT) {
         *aEventStatus = nsEventStatus_eConsumeNoDefault;
       }
       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;
 
     case NS_TOUCH_END:
     case NS_MOUSE_BUTTON_UP:
       if (aEvent->message == NS_TOUCH_END ||
           static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton ||
           (static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eMiddleButton &&
@@ -544,17 +544,17 @@ nsSliderFrame::HandleEvent(nsPresContext
       return NS_OK;
     }
     nsSize thumbSize = thumbFrame->GetSize();
     nscoord thumbLength = isHorizontal ? thumbSize.width : thumbSize.height;
 
     // 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);
     if (aEvent->eventStructType == NS_TOUCH_EVENT) {
       *aEventStatus = nsEventStatus_eConsumeNoDefault;
     }
 
     if (isHorizontal)
@@ -640,23 +640,22 @@ nsSliderFrame::PageUpDown(nscoord change
 
   // get the new position and make sure it is in bounds
   int32_t newpos = curpos + change * pageIncrement;
   if (newpos < minpos || maxpos < minpos)
     newpos = minpos;
   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;
   scrollbar = GetContentOfBox(scrollbarBox);
 
   // get the current position
   int32_t curPos = GetCurrentPosition(scrollbar);
 
@@ -727,41 +726,41 @@ static void UpdateAttribute(nsIContent* 
   }
 }
 
 // Use this function when you want to set the scroll position via the position
 // of the scrollbar thumb, e.g. when dragging the slider. This function scrolls
 // 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);
   nscoord offset = IsHorizontal() ? crect.x : crect.y;
   int32_t newPos = NSToIntRound((aNewThumbPos - offset) / mRatio);
   
   if (aMaySnap && mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::snap,
                                         nsGkAtoms::_true, eCaseMatters)) {
     // If snap="true", then the slider may only be set to min + (increment * x).
     // Otherwise, the slider may be set to any positive integer.
     int32_t increment = GetIncrement(aScrollbar);
     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.
 // aNewPos should be passed to this function as a position as if the minpos is 0.
 // That is, the minpos will be added to the position by this function. In a reverse
 // 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);
   int32_t maxpos = GetMaxPosition(aScrollbar);
 
   // in reverse direction sliders, flip the value so that it goes from
   // right to left, or bottom to top.
   if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::dir,
@@ -771,23 +770,22 @@ nsSliderFrame::SetCurrentPosition(nsICon
     aNewPos += minpos;
 
   // get the new position and make sure it is in bounds
   if (aNewPos < minpos || maxpos < minpos)
     aNewPos = minpos;
   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();
 
   mUserChanged = true;
 
   nsScrollbarFrame* scrollbarFrame = do_QueryFrame(scrollbarBox);
   if (scrollbarFrame) {
@@ -797,17 +795,17 @@ nsSliderFrame::SetCurrentPositionInterna
       nsRefPtr<nsPresContext> context = PresContext();
       nsCOMPtr<nsIContent> content = GetContent();
       mediator->PositionChanged(scrollbarFrame, GetCurrentPosition(scrollbar), aNewPos);
       // 'mediator' might be dangling now...
       UpdateAttribute(scrollbar, aNewPos, false, aIsSmooth);
       nsIFrame* frame = content->GetPrimaryFrame();
       if (frame && frame->GetType() == nsGkAtoms::sliderFrame) {
         static_cast<nsSliderFrame*>(frame)->
-          CurrentPositionChanged(frame->PresContext(), aImmediateRedraw);
+          CurrentPositionChanged(frame->PresContext());
       }
       mUserChanged = false;
       return;
     }
   }
 
   UpdateAttribute(scrollbar, aNewPos, true, aIsSmooth);
   mUserChanged = false;
@@ -900,17 +898,17 @@ nsSliderFrame::StartDrag(nsIDOMEvent* aE
     nsIFrame* scrollbarBox = GetScrollbar();
     scrollbar = GetContentOfBox(scrollbarBox);
   }
 
   DragThumb(true);
 
   if (scrollToClick) {
     // should aMaySnap be true here?
-    SetCurrentThumbPosition(scrollbar, newpos, false, false, false);
+    SetCurrentThumbPosition(scrollbar, newpos, false, false);
   }
 
   nsIFrame* thumbFrame = mFrames.FirstChild();
   if (!thumbFrame) {
     return NS_OK;
   }
 
   if (isHorizontal)
--- a/layout/xul/base/src/nsSliderFrame.h
+++ b/layout/xul/base/src/nsSliderFrame.h
@@ -125,23 +125,21 @@ public:
 
 private:
 
   bool GetScrollToClick();
   nsIFrame* GetScrollbar();
 
   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();
   void RemoveListener();
   bool isDraggingThumb();
 
   void StartRepeat() {
     nsRepeatService::GetInstance()->Start(Notify, this);