Bug 1417376 Part 2 - Pass nsPoint parameters by const references instead of references. draft
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 15 Nov 2017 18:26:10 +0800
changeset 700418 15d9d67190144ed328d1244110639ea1c3b321fe
parent 700417 6c00dc91cec25ea8351ba94845e110b540f69b79
child 700419 b497f5501602f9a2f0b4be87d22da95be7d3c905
push id89813
push userbmo:tlin@mozilla.com
push dateMon, 20 Nov 2017 04:09:24 +0000
bugs1417376
milestone59.0a1
Bug 1417376 Part 2 - Pass nsPoint parameters by const references instead of references. 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*/