Bug 919164 - Rename TEXT_FORCE_TRIM_WHITESPACE to TEXT_IS_IN_TOKEN_MATHML. r=fredw, r=roc

This commit is contained in:
James Kitchener 2013-09-30 11:55:51 -04:00
parent 6a56e8f29f
commit fb2d179c64
4 changed files with 18 additions and 16 deletions

View File

@ -212,10 +212,10 @@ NS_DECLARE_FRAME_PROPERTY(TextFrameGlyphObservers, DestroyGlyphObserverList);
#define TEXT_IN_TEXTRUN_USER_DATA NS_FRAME_STATE_BIT(29)
// nsTextFrame.h has
// #define TEXT_HAS_NONCOLLAPSED_CHARACTERS NS_FRAME_STATE_BIT(30)
// #define TEXT_HAS_NONCOLLAPSED_CHARACTERS NS_FRAME_STATE_BIT(31)
// nsTextFrame.h has
// #define TEXT_FORCE_TRIM_WHITESPACE NS_FRAME_STATE_BIT(31)
// #define TEXT_IS_IN_TOKEN_MATHML NS_FRAME_STATE_BIT(32)
// Set when this text frame is mentioned in the userdata for the
// uninflated textrun property
@ -7669,7 +7669,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
}
}
if ((atStartOfLine && !textStyle->WhiteSpaceIsSignificant()) ||
(GetStateBits() & TEXT_FORCE_TRIM_WHITESPACE)) {
(GetStateBits() & TEXT_IS_IN_TOKEN_MATHML)) {
// Skip leading whitespace. Make sure we don't skip a 'pre-line'
// newline if there is one.
int32_t skipLength = newLineOffset >= 0 ? length - 1 : length;
@ -7835,7 +7835,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
gfxFloat trimmedWidth = 0;
gfxFloat availWidth = aAvailableWidth;
bool canTrimTrailingWhitespace = !textStyle->WhiteSpaceIsSignificant() ||
(GetStateBits() & TEXT_FORCE_TRIM_WHITESPACE);
(GetStateBits() & TEXT_IS_IN_TOKEN_MATHML);
int32_t unusedOffset;
gfxBreakPriority breakPriority;
aLineLayout.GetLastOptionalBreakPosition(&unusedOffset, &breakPriority);
@ -7905,11 +7905,11 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
// to trim it off again in TrimTrailingWhiteSpace, and we'd like to avoid
// having to re-do it.)
if (brokeText ||
(GetStateBits() & TEXT_FORCE_TRIM_WHITESPACE)) {
(GetStateBits() & TEXT_IS_IN_TOKEN_MATHML)) {
// We're definitely going to break so our trailing whitespace should
// definitely be trimmed. Record that we've already done it.
AddStateBits(TEXT_TRIMMED_TRAILING_WHITESPACE);
} else if (!(GetStateBits() & TEXT_FORCE_TRIM_WHITESPACE)) {
} else if (!(GetStateBits() & TEXT_IS_IN_TOKEN_MATHML)) {
// We might not be at the end of the line. (Note that even if this frame
// ends in breakable whitespace, it might not be at the end of the line
// because it might be followed by breakable, but preformatted, whitespace.)

View File

@ -21,9 +21,8 @@ class PropertyProvider;
// reflow
#define TEXT_HAS_NONCOLLAPSED_CHARACTERS NS_FRAME_STATE_BIT(31)
// This state bit is set on frames which are forced to trim their leading and
// trailing whitespaces
#define TEXT_FORCE_TRIM_WHITESPACE NS_FRAME_STATE_BIT(32)
// This state bit is set on children of token MathML elements
#define TEXT_IS_IN_TOKEN_MATHML NS_FRAME_STATE_BIT(32)
#define TEXT_HAS_FONT_INFLATION NS_FRAME_STATE_BIT(61)

View File

@ -80,14 +80,17 @@ nsMathMLTokenFrame::GetMathMLFrameType()
}
void
nsMathMLTokenFrame::ForceTrimChildTextFrames()
nsMathMLTokenFrame::MarkTextFramesAsTokenMathML()
{
// Set flags on child text frames to force them to trim their leading and
// trailing whitespaces.
for (nsIFrame* childFrame = GetFirstPrincipalChild(); childFrame;
childFrame = childFrame->GetNextSibling()) {
if (childFrame->GetType() == nsGkAtoms::textFrame) {
childFrame->AddStateBits(TEXT_FORCE_TRIM_WHITESPACE);
for (nsIFrame* childFrame2 = childFrame->GetFirstPrincipalChild();
childFrame2; childFrame2 = childFrame2->GetNextSibling()) {
if (childFrame2->GetType() == nsGkAtoms::textFrame) {
childFrame2->AddStateBits(TEXT_IS_IN_TOKEN_MATHML);
}
}
}
}
@ -101,7 +104,7 @@ nsMathMLTokenFrame::SetInitialChildList(ChildListID aListID,
if (NS_FAILED(rv))
return rv;
ForceTrimChildTextFrames();
MarkTextFramesAsTokenMathML();
ProcessTextData();
return rv;
@ -115,7 +118,7 @@ nsMathMLTokenFrame::AppendFrames(ChildListID aListID,
if (NS_FAILED(rv))
return rv;
ForceTrimChildTextFrames();
MarkTextFramesAsTokenMathML();
return rv;
}
@ -130,7 +133,7 @@ nsMathMLTokenFrame::InsertFrames(ChildListID aListID,
if (NS_FAILED(rv))
return rv;
ForceTrimChildTextFrames();
MarkTextFramesAsTokenMathML();
return rv;
}

View File

@ -78,7 +78,7 @@ protected:
// depending on its textual content
bool SetTextStyle();
void ForceTrimChildTextFrames();
void MarkTextFramesAsTokenMathML();
};
#endif /* nsMathMLTokentFrame_h___ */