Bug 1417376 Part 1 - Change nsPoint parameter to pass by value for DoAutoScroll(). r=mats
authorTing-Yu Lin <tlin@mozilla.com>
Thu, 16 Nov 2017 10:32:22 +0800
changeset 437178 17c1e67055b113092991a0cf47f7d942a8455883
parent 437177 1fd906fa110de6ef48d0fbeb9a3f40bdd31e76aa
child 437179 cf383c0b3d5f37c3e31a88eadd057e1db19677f3
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
Bug 1417376 Part 1 - Change nsPoint parameter to pass by value for DoAutoScroll(). r=mats This private method DoAutoScroll() modifies aPoint inside of it, and none of other callers (StartAutoScrollTimer() and nsAutoScrollTimer::Notify()) read aPoint afterwards, so we make aPoint pass by value rather than pass by non-const-reference. This is necessary for later parts. MozReview-Commit-ID: 9PtxFXIka7X
--- a/dom/base/Selection.cpp
+++ b/dom/base/Selection.cpp
@@ -2210,17 +2210,17 @@ Selection::StopAutoScrollTimer()
   if (mAutoScrollTimer) {
     return mAutoScrollTimer->Stop();
   return NS_OK;
-Selection::DoAutoScroll(nsIFrame* aFrame, nsPoint& aPoint)
+Selection::DoAutoScroll(nsIFrame* aFrame, nsPoint aPoint)
   NS_PRECONDITION(aFrame, "Need a frame");
   if (mAutoScrollTimer) {
   nsPresContext* presContext = aFrame->PresContext();
--- a/dom/base/Selection.h
+++ b/dom/base/Selection.h
@@ -329,17 +329,17 @@ public:
   nsresult SetTextRangeStyle(nsRange* aRange,
                              const TextRangeStyle& aTextRangeStyle);
   friend class ::nsAutoScrollTimer;
   // Note: DoAutoScroll might destroy arbitrary frames etc.
-  nsresult DoAutoScroll(nsIFrame *aFrame, nsPoint& aPoint);
+  nsresult DoAutoScroll(nsIFrame* aFrame, nsPoint aPoint);
   // We are not allowed to be in nodes whose root is not our document
   bool HasSameRoot(nsINode& aNode);
   // XXX Please don't add additional uses of this method, it's only for
   // XXX supporting broken code (bug 1245883) in the following classes:
   friend class ::nsCopySupport;
   friend class ::nsHTMLCopyEncoder;