Bug 1417376 Part 2 - Pass nsPoint parameters by const references instead of references. r=mats
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 15 Nov 2017 18:26:10 +0800
changeset 437179 cf383c0b3d5f37c3e31a88eadd057e1db19677f3
parent 437178 17c1e67055b113092991a0cf47f7d942a8455883
child 437180 25dfc9b677cb24c57124ef0f1bb2ad47eda11771
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
reviewersmats
bugs1417376
milestone59.0a1
Bug 1417376 Part 2 - Pass nsPoint parameters by const references instead of references. r=mats MozReview-Commit-ID: 6TveqwkOvc0
dom/base/Selection.cpp
dom/base/Selection.h
layout/generic/nsFrameSelection.cpp
layout/generic/nsFrameSelection.h
--- a/dom/base/Selection.cpp
+++ b/dom/base/Selection.cpp
@@ -2171,17 +2171,17 @@ Selection::SetTextRangeStyle(nsRange* aR
   RangeData *rd = FindRangeData(aRange);
   if (rd) {
     rd->mTextRangeStyle = aTextRangeStyle;
   }
   return NS_OK;
 }
 
 nsresult
-Selection::StartAutoScrollTimer(nsIFrame* aFrame, nsPoint& aPoint,
+Selection::StartAutoScrollTimer(nsIFrame* aFrame, const nsPoint& aPoint,
                                 uint32_t aDelay)
 {
   NS_PRECONDITION(aFrame, "Need a frame");
 
   nsresult result;
   if (!mFrameSelection) {
     return NS_OK;//nothing to do
   }
--- a/dom/base/Selection.h
+++ b/dom/base/Selection.h
@@ -171,18 +171,18 @@ public:
     int32_t aContentLength,
     UniquePtr<SelectionDetails> aDetailsHead,
     SelectionType aSelectionType,
     bool aSlowCheck);
 
   NS_IMETHOD   Repaint(nsPresContext* aPresContext);
 
   // Note: StartAutoScrollTimer might destroy arbitrary frames etc.
-  nsresult     StartAutoScrollTimer(nsIFrame *aFrame,
-                                    nsPoint& aPoint,
+  nsresult     StartAutoScrollTimer(nsIFrame* aFrame,
+                                    const nsPoint& aPoint,
                                     uint32_t aDelay);
 
   nsresult     StopAutoScrollTimer();
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   // WebIDL methods
   nsINode*     GetAnchorNode();
--- a/layout/generic/nsFrameSelection.cpp
+++ b/layout/generic/nsFrameSelection.cpp
@@ -419,20 +419,20 @@ nsFrameSelection::InvalidateDesiredPos()
 void
 nsFrameSelection::SetDesiredPos(nsPoint aPos)
 {
   mDesiredPos = aPos;
   mDesiredPosSet = true;
 }
 
 nsresult
-nsFrameSelection::ConstrainFrameAndPointToAnchorSubtree(nsIFrame  *aFrame,
-                                                        nsPoint&   aPoint,
-                                                        nsIFrame **aRetFrame,
-                                                        nsPoint&   aRetPoint)
+nsFrameSelection::ConstrainFrameAndPointToAnchorSubtree(nsIFrame* aFrame,
+                                                        const nsPoint& aPoint,
+                                                        nsIFrame** aRetFrame,
+                                                        nsPoint& aRetPoint)
 {
   //
   // The whole point of this method is to return a frame and point that
   // that lie within the same valid subtree as the anchor node's frame,
   // for use with the method GetContentAndOffsetsFromPoint().
   //
   // A valid subtree is defined to be one where all the content nodes in
   // the tree have a valid parent-child relationship.
--- a/layout/generic/nsFrameSelection.h
+++ b/layout/generic/nsFrameSelection.h
@@ -603,19 +603,19 @@ public:
    * Dragging or extending selection will never allow for a subset
    * (or the whole) of the maintained selection to become unselected.
    * Primary use: double click selecting then dragging on second click
    * @param aAmount the initial amount of text selected (word, line or paragraph).
    *                For "line", use eSelectBeginLine.
    */
   nsresult MaintainSelection(nsSelectionAmount aAmount = eSelectNoAmount);
 
-  nsresult ConstrainFrameAndPointToAnchorSubtree(nsIFrame *aFrame,
-                                                 nsPoint& aPoint,
-                                                 nsIFrame **aRetFrame,
+  nsresult ConstrainFrameAndPointToAnchorSubtree(nsIFrame* aFrame,
+                                                 const nsPoint& aPoint,
+                                                 nsIFrame** aRetFrame,
                                                  nsPoint& aRetPoint);
 
   nsFrameSelection();
 
   void StartBatchChanges();
   void EndBatchChanges(int16_t aReason = nsISelectionListener::NO_REASON);
 
   /*unsafe*/