| Index: Source/core/rendering/RenderText.cpp
|
| diff --git a/Source/core/rendering/RenderText.cpp b/Source/core/rendering/RenderText.cpp
|
| index 5c2ff91236b44a3f6956448dff3cfa445c9d364e..13d84d9aa8aa899b96369c50f4357126d6e4361e 100644
|
| --- a/Source/core/rendering/RenderText.cpp
|
| +++ b/Source/core/rendering/RenderText.cpp
|
| @@ -141,8 +141,8 @@ RenderText::RenderText(Node* node, PassRefPtr<StringImpl> str)
|
| , m_needsTranscoding(false)
|
| , m_minWidth(-1)
|
| , m_maxWidth(-1)
|
| - , m_beginMinWidth(0)
|
| - , m_endMinWidth(0)
|
| + , m_firstLineMinWidth(0)
|
| + , m_lastLineLineMinWidth(0)
|
| , m_text(str)
|
| , m_firstTextBox(0)
|
| , m_lastTextBox(0)
|
| @@ -768,11 +768,11 @@ ALWAYS_INLINE float RenderText::widthFromCache(const Font& f, int start, int len
|
| }
|
|
|
| void RenderText::trimmedPrefWidths(float leadWidth,
|
| - float& beginMinW, bool& beginWS,
|
| - float& endMinW, bool& endWS,
|
| - bool& hasBreakableChar, bool& hasBreak,
|
| - float& beginMaxW, float& endMaxW,
|
| - float& minW, float& maxW, bool& stripFrontSpaces)
|
| + float& firstLineMinWidth, bool& hasBreakableStart,
|
| + float& lastLineMinWidth, bool& hasBreakableEnd,
|
| + bool& hasBreakableChar, bool& hasBreak,
|
| + float& firstLineMaxWidth, float& lastLineMaxWidth,
|
| + float& minWidth, float& maxWidth, bool& stripFrontSpaces)
|
| {
|
| bool collapseWhiteSpace = style()->collapseWhiteSpace();
|
| if (!collapseWhiteSpace)
|
| @@ -781,27 +781,27 @@ void RenderText::trimmedPrefWidths(float leadWidth,
|
| if (m_hasTab || preferredLogicalWidthsDirty())
|
| computePreferredLogicalWidths(leadWidth);
|
|
|
| - beginWS = !stripFrontSpaces && m_hasBeginWS;
|
| - endWS = m_hasEndWS;
|
| + hasBreakableStart = !stripFrontSpaces && m_hasBreakableStart;
|
| + hasBreakableEnd = m_hasBreakableEnd;
|
|
|
| int len = textLength();
|
|
|
| if (!len || (stripFrontSpaces && text()->containsOnlyWhitespace())) {
|
| - beginMinW = 0;
|
| - endMinW = 0;
|
| - beginMaxW = 0;
|
| - endMaxW = 0;
|
| - minW = 0;
|
| - maxW = 0;
|
| + firstLineMinWidth = 0;
|
| + lastLineMinWidth = 0;
|
| + firstLineMaxWidth = 0;
|
| + lastLineMaxWidth = 0;
|
| + minWidth = 0;
|
| + maxWidth = 0;
|
| hasBreak = false;
|
| return;
|
| }
|
|
|
| - minW = m_minWidth;
|
| - maxW = m_maxWidth;
|
| + minWidth = m_minWidth;
|
| + maxWidth = m_maxWidth;
|
|
|
| - beginMinW = m_beginMinWidth;
|
| - endMinW = m_endMinWidth;
|
| + firstLineMinWidth = m_firstLineMinWidth;
|
| + lastLineMinWidth = m_lastLineLineMinWidth;
|
|
|
| hasBreakableChar = m_hasBreakableChar;
|
| hasBreak = m_hasBreak;
|
| @@ -813,45 +813,47 @@ void RenderText::trimmedPrefWidths(float leadWidth,
|
| if (stripFrontSpaces) {
|
| const UChar space = ' ';
|
| float spaceWidth = font.width(RenderBlock::constructTextRun(this, font, &space, 1, style()));
|
| - maxW -= spaceWidth;
|
| - } else
|
| - maxW += font.wordSpacing();
|
| + maxWidth -= spaceWidth;
|
| + } else {
|
| + maxWidth += font.wordSpacing();
|
| + }
|
| }
|
|
|
| - stripFrontSpaces = collapseWhiteSpace && m_hasEndWS;
|
| + stripFrontSpaces = collapseWhiteSpace && m_hasBreakableEnd;
|
|
|
| - if (!style()->autoWrap() || minW > maxW)
|
| - minW = maxW;
|
| + if (!style()->autoWrap() || minWidth > maxWidth)
|
| + minWidth = maxWidth;
|
|
|
| // Compute our max widths by scanning the string for newlines.
|
| if (hasBreak) {
|
| const Font& f = style()->font(); // FIXME: This ignores first-line.
|
| bool firstLine = true;
|
| - beginMaxW = maxW;
|
| - endMaxW = maxW;
|
| + firstLineMaxWidth = maxWidth;
|
| + lastLineMaxWidth = maxWidth;
|
| for (int i = 0; i < len; i++) {
|
| int linelen = 0;
|
| while (i + linelen < len && text[i + linelen] != '\n')
|
| linelen++;
|
|
|
| if (linelen) {
|
| - endMaxW = widthFromCache(f, i, linelen, leadWidth + endMaxW, 0, 0);
|
| + lastLineMaxWidth = widthFromCache(f, i, linelen, leadWidth + lastLineMaxWidth, 0, 0);
|
| if (firstLine) {
|
| firstLine = false;
|
| leadWidth = 0;
|
| - beginMaxW = endMaxW;
|
| + firstLineMaxWidth = lastLineMaxWidth;
|
| }
|
| i += linelen;
|
| } else if (firstLine) {
|
| - beginMaxW = 0;
|
| + firstLineMaxWidth = 0;
|
| firstLine = false;
|
| leadWidth = 0;
|
| }
|
|
|
| - if (i == len - 1)
|
| + if (i == len - 1) {
|
| // A <pre> run that ends with a newline, as in, e.g.,
|
| // <pre>Some text\n\n<span>More text</pre>
|
| - endMaxW = 0;
|
| + lastLineMaxWidth = 0;
|
| + }
|
| }
|
| }
|
| }
|
| @@ -932,9 +934,9 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
|
| ASSERT(m_hasTab || preferredLogicalWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts);
|
|
|
| m_minWidth = 0;
|
| - m_beginMinWidth = 0;
|
| - m_endMinWidth = 0;
|
| m_maxWidth = 0;
|
| + m_firstLineMinWidth = 0;
|
| + m_lastLineLineMinWidth = 0;
|
|
|
| if (isBR())
|
| return;
|
| @@ -944,8 +946,8 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
|
| m_hasBreakableChar = false;
|
| m_hasBreak = false;
|
| m_hasTab = false;
|
| - m_hasBeginWS = false;
|
| - m_hasEndWS = false;
|
| + m_hasBreakableStart = false;
|
| + m_hasBreakableEnd = false;
|
|
|
| RenderStyle* styleToUse = style();
|
| const Font& f = styleToUse->font(); // FIXME: This ignores first-line.
|
| @@ -1009,9 +1011,9 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
|
| isSpace = c == ' ';
|
|
|
| if ((isSpace || isNewline) && !i)
|
| - m_hasBeginWS = true;
|
| + m_hasBreakableStart = true;
|
| if ((isSpace || isNewline) && i == len - 1)
|
| - m_hasEndWS = true;
|
| + m_hasBreakableEnd = true;
|
|
|
| if (!ignoringSpaces && styleToUse->collapseWhiteSpace() && previousCharacterIsSpace && isSpace)
|
| ignoringSpaces = true;
|
| @@ -1106,9 +1108,9 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
|
| // being appended to a previous text run when considering the total minimum width of the containing block.
|
| if (hasBreak)
|
| m_hasBreakableChar = true;
|
| - m_beginMinWidth = hasBreak ? 0 : currMinWidth;
|
| + m_firstLineMinWidth = hasBreak ? 0 : currMinWidth;
|
| }
|
| - m_endMinWidth = currMinWidth;
|
| + m_lastLineLineMinWidth = currMinWidth;
|
|
|
| if (currMinWidth > m_minWidth)
|
| m_minWidth = currMinWidth;
|
| @@ -1130,7 +1132,7 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
|
| firstLine = false;
|
| leadWidth = 0;
|
| if (!styleToUse->autoWrap())
|
| - m_beginMinWidth = currMaxWidth;
|
| + m_firstLineMinWidth = currMaxWidth;
|
| }
|
|
|
| if (currMaxWidth > m_maxWidth)
|
| @@ -1166,8 +1168,8 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
|
|
|
| if (styleToUse->whiteSpace() == PRE) {
|
| if (firstLine)
|
| - m_beginMinWidth = m_maxWidth;
|
| - m_endMinWidth = currMaxWidth;
|
| + m_firstLineMinWidth = m_maxWidth;
|
| + m_lastLineLineMinWidth = currMaxWidth;
|
| }
|
|
|
| setPreferredLogicalWidthsDirty(false);
|
|
|