Bug 775624 Part 19 - Convert NS_INLINE_BREAK_FIRST_LETTER_COMPLETE to use bit-field and methods. r?dholbert
MozReview-Commit-ID: k1CSWJNMns
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -4250,17 +4250,17 @@ nsBlockFrame::ReflowInlineFrame(BlockRef
// Remember that the line has wrapped
if (!aLineLayout.GetLineEndsInBR()) {
aLine->SetLineWrapped(true);
}
// If we just ended a first-letter frame or reflowed a placeholder then
// don't split the line and don't stop the line reflow...
// But if we are going to stop anyways we'd better split the line.
- if ((!(frameReflowStatus & NS_INLINE_BREAK_FIRST_LETTER_COMPLETE) &&
+ if ((!frameReflowStatus.FirstLetterComplete() &&
nsGkAtoms::placeholderFrame != aFrame->GetType()) ||
*aLineReflowStatus == LineReflowStatus::Stop) {
// Split line after the current frame
*aLineReflowStatus = LineReflowStatus::Stop;
SplitLine(aState, aLineLayout, aLine, aFrame->GetNextSibling(), aLineReflowStatus);
}
}
}
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -204,27 +204,29 @@ public:
: mStatus(0)
, mBreakType(StyleClear::None)
, mIncomplete(false)
, mOverflowIncomplete(false)
, mNextInFlowNeedsReflow(false)
, mTruncated(false)
, mInlineBreak(false)
, mInlineBreakAfter(false)
+ , mFirstLetterComplete(false)
{}
// Reset all the bit-fields.
void Reset() {
mBreakType = StyleClear::None;
mIncomplete = false;
mOverflowIncomplete = false;
mNextInFlowNeedsReflow = false;
mTruncated = false;
mInlineBreak = false;
mInlineBreakAfter = false;
+ mFirstLetterComplete = false;
}
nsReflowStatus(uint32_t aStatus)
: mStatus(aStatus)
{}
uint32_t& operator=(uint32_t aRhs) {
mStatus = aRhs;
@@ -340,39 +342,42 @@ public:
// Set the inline line-break-after status. The break type can be changed
// via the optional aBreakType param.
void SetInlineLineBreakAfter(StyleClear aBreakType = StyleClear::Line) {
mBreakType = aBreakType;
mInlineBreak = true;
mInlineBreakAfter = true;
}
+ // mFirstLetterComplete bit flag means the break was induced by
+ // completion of a first-letter.
+ bool FirstLetterComplete() const { return mFirstLetterComplete; }
+ void SetFirstLetterComplete() { mFirstLetterComplete = true; }
+
private:
uint32_t mStatus;
StyleClear mBreakType;
// Frame completion status bit flags.
bool mIncomplete : 1;
bool mOverflowIncomplete : 1;
bool mNextInFlowNeedsReflow : 1;
bool mTruncated : 1;
// Inline break status bit flags.
bool mInlineBreak : 1;
bool mInlineBreakAfter : 1;
+ bool mFirstLetterComplete : 1;
};
#define NS_FRAME_COMPLETE 0 // Note: not a bit!
#define NS_FRAME_NOT_COMPLETE 0x1
#define NS_FRAME_OVERFLOW_INCOMPLETE 0x4
-// Set when a break was induced by completion of a first-letter
-#define NS_INLINE_BREAK_FIRST_LETTER_COMPLETE 0x10000
-
#define NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics) \
aStatus.UpdateTruncated(aReflowInput, aMetrics);
//----------------------------------------------------------------------
/**
* DidReflow status values.
*/
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -9555,17 +9555,17 @@ nsTextFrame::ReflowText(nsLineLayout& aL
// Ends in \n
aStatus.SetInlineLineBreakAfter();
aLineLayout.SetLineEndsInBR(true);
} else if (breakAfter) {
aStatus.SetInlineLineBreakAfter();
}
if (completedFirstLetter) {
aLineLayout.SetFirstLetterStyleOK(false);
- aStatus |= NS_INLINE_BREAK_FIRST_LETTER_COMPLETE;
+ aStatus.SetFirstLetterComplete();
}
// Updated the cached NewlineProperty, or delete it.
if (contentLength < maxContentLength &&
textStyle->NewlineIsSignificant(this) &&
(contentNewLineOffset < 0 ||
mContentOffset + contentLength <= contentNewLineOffset)) {
if (!cachedNewlineOffset) {