Chromium Code Reviews| Index: Source/core/layout/LayoutBlockFlowLine.cpp |
| diff --git a/Source/core/layout/LayoutBlockFlowLine.cpp b/Source/core/layout/LayoutBlockFlowLine.cpp |
| index d2f019afb8326c13d52344df1aeed22f5ecdb944..c1d4c091d63ec54f163981369528efd87bc404d7 100644 |
| --- a/Source/core/layout/LayoutBlockFlowLine.cpp |
| +++ b/Source/core/layout/LayoutBlockFlowLine.cpp |
| @@ -398,7 +398,7 @@ static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* ru |
| int lastEndOffset = run->m_start; |
| for (size_t i = 0, size = wordMeasurements.size(); i < size && lastEndOffset < run->m_stop; ++i) { |
| const WordMeasurement& wordMeasurement = wordMeasurements[i]; |
| - if (wordMeasurement.width <=0 || wordMeasurement.startOffset == wordMeasurement.endOffset) |
| + if (wordMeasurement.startOffset == wordMeasurement.endOffset) |
| continue; |
| if (wordMeasurement.layoutText != layoutText || wordMeasurement.startOffset != lastEndOffset || wordMeasurement.endOffset > run->m_stop) |
| continue; |
| @@ -421,16 +421,22 @@ static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* ru |
| fallbackFonts.add(*it); |
| } |
| } |
| - if (measuredWidth && lastEndOffset != run->m_stop) { |
| + if (lastEndOffset != run->m_stop) { |
| // If we don't have enough cached data, we'll measure the run again. |
| - measuredWidth = 0; |
| + canUseSimpleFontCodePath = false; |
| fallbackFonts.clear(); |
| } |
| } |
| - if (!measuredWidth) |
| + // Don't put this into 'else' part of the above 'if' because canUseSimpleFontCodePath may be modified in the 'if' block. |
| + if (!canUseSimpleFontCodePath) |
| measuredWidth = layoutText->width(run->m_start, run->m_stop - run->m_start, xPos, run->direction(), lineInfo.isFirstLine(), &fallbackFonts, &glyphBounds); |
| + if (measuredWidth < 0) { |
|
eae
2015/06/23 22:28:54
This could use a comment.
Xianzhu
2015/06/23 22:43:32
Done.
|
| + glyphBounds.move(measuredWidth, 0); |
| + measuredWidth = 0; |
| + } |
| + |
| glyphOverflow.setFromBounds(glyphBounds, font.fontMetrics().floatAscent(), font.fontMetrics().floatDescent(), measuredWidth); |
| run->m_box->setLogicalWidth(measuredWidth + hyphenWidth); |