From 5b64b41a7cc777020510824eb265f6804f87ef6d Mon Sep 17 00:00:00 2001 From: "mats.palmgren@bredband.net" Date: Tue, 26 Feb 2008 07:04:14 -0800 Subject: [PATCH] Make nsTypedSelection ctors initialize all members (fixes an UMR) and reorder members to save space. b=417895 r+sr=roc a=blocking1.9 --- layout/generic/nsSelection.cpp | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index bbf80d5e77a..2a526d32887 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -343,8 +343,6 @@ private: // If this requirement is added, the current design makes the most sense, we // can just remove the array sorted by endings. - nsTArray mRanges; - nsTArray mRangeEndings; // references info mRanges #ifdef DEBUG PRBool ValidateRanges(); #endif @@ -366,19 +364,20 @@ private: nsIDOMNode* aEndNode, PRInt32 aEndOffset, PRInt32 aStartSearchingHere); + nsTArray mRanges; + nsTArray mRangeEndings; // references info mRanges nsCOMPtr mAnchorFocusRange; nsCOMPtr mOriginalAnchorRange; //used as a point with range gravity for security - nsDirection mDirection; //FALSE = focus, anchor; TRUE = anchor, focus - PRBool mFixupState; //was there a fixup? - nsFrameSelection *mFrameSelection; - nsWeakPtr mPresShellWeak; //weak reference to presshell. - SelectionType mType;//type of this nsTypedSelection; - nsRefPtr mAutoScrollTimer; // timer for autoscrolling. + nsWeakPtr mPresShellWeak; + nsRefPtr mAutoScrollTimer; nsCOMArray mSelectionListeners; - PRPackedBool mTrueDirection; nsRevocableEventPtr mScrollEvent; CachedOffsetForFrame *mCachedOffsetForFrame; + nsDirection mDirection; + SelectionType mType; + PRPackedBool mTrueDirection; + PRPackedBool mFixupState; }; // Stack-class to turn on/off selection batching for table selection @@ -3987,24 +3986,25 @@ nsFrameSelection::GetDelayedCaretData() // note: this can return a nil anchor node -nsTypedSelection::nsTypedSelection(nsFrameSelection *aList) -{ - mFrameSelection = aList; - mFixupState = PR_FALSE; - mDirection = eDirNext; - mCachedOffsetForFrame = nsnull; -} - - nsTypedSelection::nsTypedSelection() + : mFrameSelection(nsnull) + , mCachedOffsetForFrame(nsnull) + , mDirection(eDirNext) + , mType(nsISelectionController::SELECTION_NORMAL) + , mTrueDirection(PR_FALSE) + , mFixupState(PR_FALSE) { - mFrameSelection = nsnull; - mFixupState = PR_FALSE; - mDirection = eDirNext; - mCachedOffsetForFrame = nsnull; } - +nsTypedSelection::nsTypedSelection(nsFrameSelection *aList) + : mFrameSelection(aList) + , mCachedOffsetForFrame(nsnull) + , mDirection(eDirNext) + , mType(nsISelectionController::SELECTION_NORMAL) + , mTrueDirection(PR_FALSE) + , mFixupState(PR_FALSE) +{ +} nsTypedSelection::~nsTypedSelection() {