Bug 1387176 - switch nsFrameSelection to use per-member defaults. r=TYLin
authorJeremy Chen <jeremychen@mozilla.com>
Fri, 17 Nov 2017 17:03:15 +0800
changeset 446684 8053ce4e6ab8131f8dbe9ecde24c13426050f10d
parent 446683 27f247440ce78a1c65af4ca270cabf2594da465f
child 446685 490462a742891f90452c9cd73a9bc7dcf2ba46a1
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersTYLin
bugs1387176
milestone59.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 1387176 - switch nsFrameSelection to use per-member defaults. r=TYLin Many members of nsFrameSelection are uninitialized, which could cause some potential issues. In this patch, we use per-member defaults for nsFrameSelection, and make sure we initialize all the members properly. MozReview-Commit-ID: H9MMlSZoinh
layout/generic/nsFrameSelection.h
--- a/layout/generic/nsFrameSelection.h
+++ b/layout/generic/nsFrameSelection.h
@@ -742,27 +742,27 @@ private:
   nsCOMPtr<nsIContent> mEndSelectedCell;
   nsCOMPtr<nsIContent> mAppendStartSelectedCell;
   nsCOMPtr<nsIContent> mUnselectCellOnMouseUp;
   int32_t  mSelectingTableCellMode = 0;
   int32_t  mSelectedCellIndex = 0;
 
   // maintain selection
   RefPtr<nsRange> mMaintainRange;
-  nsSelectionAmount mMaintainedAmount;
+  nsSelectionAmount mMaintainedAmount = eSelectNoAmount;
 
   //batching
   int32_t mBatching = 0;
 
   // Limit selection navigation to a child of this node.
   nsCOMPtr<nsIContent> mLimiter;
   // Limit selection navigation to a descendant of this node.
   nsCOMPtr<nsIContent> mAncestorLimiter;
 
-  nsIPresShell *mShell;
+  nsIPresShell* mShell = nullptr;
   // Reason for notifications of selection changing.
   int16_t mSelectionChangeReason = nsISelectionListener::NO_REASON;
   // For visual display purposes.
   int16_t mDisplaySelection = nsISelectionController::SELECTION_OFF;
 
   // Hint to tell if the selection is at the end of this line or beginning of next.
   CaretAssociateHint mHint = mozilla::CARET_ASSOCIATE_BEFORE;
   nsBidiLevel mCaretBidiLevel = BIDI_LEVEL_UNDEFINED;
@@ -774,20 +774,20 @@ private:
   // mDelayedMouseEventValid is true, and setting mDelayedMouseEventValid
   // always overrides these values.
   uint32_t mDelayedMouseEventClickCount = 0;
   bool mDelayedMouseEventIsShift = false;
 
   bool mChangesDuringBatching = false;
   bool mNotifyFrames = true;
   bool mDragSelectingCells = false;
-  bool mDragState;   //for drag purposes
+  bool mDragState = false;   //for drag purposes
   bool mMouseDoubleDownState = false; //has the doubleclick down happened
   bool mDesiredPosSet = false;
   bool mAccessibleCaretEnabled = false;
 
-  int8_t mCaretMovementStyle;
+  int8_t mCaretMovementStyle = 0;
 
   static bool sSelectionEventsEnabled;
   static bool sSelectionEventsOnTextControlsEnabled;
 };
 
 #endif /* nsFrameSelection_h___ */