Modified: trunk/Source/WebCore/ChangeLog (183798 => 183799)
--- trunk/Source/WebCore/ChangeLog 2015-05-05 07:39:23 UTC (rev 183798)
+++ trunk/Source/WebCore/ChangeLog 2015-05-05 07:49:13 UTC (rev 183799)
@@ -1,3 +1,17 @@
+2015-05-05 Myles C. Maxfield <[email protected]>
+
+ Small cleanup in RenderText::computePreferredLogicalWidths()
+ https://bugs.webkit.org/show_bug.cgi?id=144615
+
+ Reviewed by Simon Fraser.
+
+ A little bit of cleanup before I tackle dependent widths in this function.
+
+ No new tests because there is no behavior change.
+
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::computePreferredLogicalWidths):
+
2015-05-05 Joanmarie Diggs <[email protected]>
[ATK] AX: figure out platform difference for ATK to make accessibility/table-cell-display-block.html work
Modified: trunk/Source/WebCore/rendering/RenderText.cpp (183798 => 183799)
--- trunk/Source/WebCore/rendering/RenderText.cpp 2015-05-05 07:39:23 UTC (rev 183798)
+++ trunk/Source/WebCore/rendering/RenderText.cpp 2015-05-05 07:49:13 UTC (rev 183799)
@@ -692,7 +692,6 @@
m_endMinWidth = 0;
m_maxWidth = 0;
- float currMinWidth = 0;
float currMaxWidth = 0;
m_hasBreakableChar = false;
m_hasBreak = false;
@@ -735,7 +734,7 @@
minimumSuffixLength = 2;
}
- int firstGlyphLeftOverflow = -1;
+ Optional<int> firstGlyphLeftOverflow;
bool breakNBSP = style.autoWrap() && style.nbspMode() == SPACE;
bool breakAll = (style.wordBreak() == BreakAllWordBreak || style.wordBreak() == BreakWordBreak) && style.autoWrap();
@@ -768,12 +767,9 @@
if ((isSpace || isNewline) && i == len - 1)
m_hasEndWS = true;
- if (!ignoringSpaces && style.collapseWhiteSpace() && previousCharacterIsSpace && isSpace)
- ignoringSpaces = true;
+ ignoringSpaces |= style.collapseWhiteSpace() && previousCharacterIsSpace && isSpace;
+ ignoringSpaces &= isSpace;
- if (ignoringSpaces && !isSpace)
- ignoringSpaces = false;
-
// Ignore spaces and soft hyphens
if (ignoringSpaces) {
ASSERT(lastWordBoundary == i);
@@ -781,7 +777,7 @@
continue;
} else if (c == softHyphen && style.hyphens() != HyphensNone) {
currMaxWidth += widthFromCache(font, lastWordBoundary, i - lastWordBoundary, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow, style);
- if (firstGlyphLeftOverflow < 0)
+ if (!firstGlyphLeftOverflow)
firstGlyphLeftOverflow = glyphOverflow.left;
lastWordBoundary = i + 1;
continue;
@@ -805,6 +801,7 @@
int wordLen = j - i;
if (wordLen) {
+ float currMinWidth = 0;
bool isSpace = (j < len) && isSpaceAccordingToStyle(c, style);
float w;
if (wordTrailingSpaceWidth && isSpace)
@@ -812,7 +809,7 @@
else {
w = widthFromCache(font, i, wordLen, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow, style);
if (c == softHyphen && style.hyphens() != HyphensNone)
- currMinWidth += hyphenWidth(this, font);
+ currMinWidth = hyphenWidth(this, font);
}
if (w > maxWordWidth) {
@@ -834,7 +831,7 @@
maxWordWidth = w;
}
- if (firstGlyphLeftOverflow < 0)
+ if (!firstGlyphLeftOverflow)
firstGlyphLeftOverflow = glyphOverflow.left;
currMinWidth += w;
if (betweenWords) {
@@ -851,7 +848,7 @@
// Add in wordSpacing to our currMaxWidth, but not if this is the last word on a line or the
// last word in the run.
- if (wordSpacing && (isSpace || isCollapsibleWhiteSpace) && !containsOnlyWhitespace(j, len-j))
+ if ((isSpace || isCollapsibleWhiteSpace) && !containsOnlyWhitespace(j, len-j))
currMaxWidth += wordSpacing;
if (firstWord) {
@@ -865,9 +862,7 @@
}
m_endMinWidth = currMinWidth;
- if (currMinWidth > m_minWidth)
- m_minWidth = currMinWidth;
- currMinWidth = 0;
+ m_minWidth = std::max(currMinWidth, m_minWidth);
i += wordLen - 1;
} else {
@@ -876,10 +871,6 @@
if (style.autoWrap() || isNewline)
m_hasBreakableChar = true;
- if (currMinWidth > m_minWidth)
- m_minWidth = currMinWidth;
- currMinWidth = 0;
-
if (isNewline) { // Only set if preserveNewline was true and we saw a newline.
if (firstLine) {
firstLine = false;
@@ -907,13 +898,11 @@
}
}
- if (firstGlyphLeftOverflow > 0)
- glyphOverflow.left = firstGlyphLeftOverflow;
+ glyphOverflow.left = firstGlyphLeftOverflow.valueOr(glyphOverflow.left);
if ((needsWordSpacing && len > 1) || (ignoringSpaces && !firstWord))
currMaxWidth += wordSpacing;
- m_minWidth = std::max(currMinWidth, m_minWidth);
m_maxWidth = std::max(currMaxWidth, m_maxWidth);
if (!style.autoWrap())