Skip to content

Commit

Permalink
Bug 1361580 - Move the initialization of nsTextFrame members to where…
Browse files Browse the repository at this point in the history
… they are declared. r=dholbert

Differential Revision: https://phabricator.services.mozilla.com/D194408
  • Loading branch information
aethanyc committed Nov 22, 2023
1 parent 25f18e8 commit dc23d61
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions layout/generic/nsTextFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,7 @@ class nsTextFrame : public nsIFrame {

explicit nsTextFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
ClassID aID = kClassID)
: nsIFrame(aStyle, aPresContext, aID),
mNextContinuation(nullptr),
mContentOffset(0),
mContentLengthHint(0),
mAscent(0),
mIsSelected(SelectionState::Unknown) {}
: nsIFrame(aStyle, aPresContext, aID) {}

NS_DECL_FRAMEARENA_HELPERS(nsTextFrame)

Expand Down Expand Up @@ -786,7 +781,7 @@ class nsTextFrame : public nsIFrame {

mutable RefPtr<nsFontMetrics> mFontMetrics;
RefPtr<gfxTextRun> mTextRun;
nsTextFrame* mNextContinuation;
nsTextFrame* mNextContinuation = nullptr;
// The key invariant here is that mContentOffset never decreases along
// a next-continuation chain. And of course mContentOffset is always <= the
// the text node's content length, and the mContentOffset for the first frame
Expand All @@ -796,21 +791,21 @@ class nsTextFrame : public nsIFrame {
// frame's offset, or the text length if there is no next frame. This means
// the frames always map the text node without overlapping or leaving any
// gaps.
int32_t mContentOffset;
int32_t mContentOffset = 0;
// This does *not* indicate the length of text currently mapped by the frame;
// instead it's a hint saying that this frame *wants* to map this much text
// so if we create a new continuation, this is where that continuation should
// start.
int32_t mContentLengthHint;
nscoord mAscent;
int32_t mContentLengthHint = 0;
nscoord mAscent = 0;

// Cached selection state.
enum class SelectionState : uint8_t {
Unknown,
Selected,
NotSelected,
};
mutable SelectionState mIsSelected;
mutable SelectionState mIsSelected = SelectionState::Unknown;

// Flags used to track whether certain properties are present.
// (Public to keep MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS happy.)
Expand Down

0 comments on commit dc23d61

Please sign in to comment.