| Index: Source/core/layout/line/BreakingContextInlineHeaders.h
|
| diff --git a/Source/core/layout/line/BreakingContextInlineHeaders.h b/Source/core/layout/line/BreakingContextInlineHeaders.h
|
| index 872c379a4897da50c82a8be1341df502e048a916..157128e0698558419f22473c6927a68cbbcbe5d3 100644
|
| --- a/Source/core/layout/line/BreakingContextInlineHeaders.h
|
| +++ b/Source/core/layout/line/BreakingContextInlineHeaders.h
|
| @@ -509,20 +509,16 @@ ALWAYS_INLINE TextDirection textDirectionFromUnicode(WTF::Unicode::Direction dir
|
| || direction == WTF::Unicode::RightToLeftArabic ? RTL : LTR;
|
| }
|
|
|
| -ALWAYS_INLINE float textWidth(LayoutText* text, unsigned from, unsigned len, const Font& font, float xPos, bool collapseWhiteSpace, HashSet<const SimpleFontData*>* fallbackFonts = nullptr)
|
| +ALWAYS_INLINE float textWidth(LayoutText* text, unsigned from, unsigned len, const Font& font, float xPos, bool collapseWhiteSpace, HashSet<const SimpleFontData*>* fallbackFonts = nullptr, FloatRect* glyphBounds = nullptr)
|
| {
|
| - if ((!from && len == text->textLength()) || text->style()->hasTextCombine()) {
|
| - GlyphOverflow glyphOverflow;
|
| - return text->width(from, len, font, xPos, text->style()->direction(), fallbackFonts,
|
| - // LayoutText caches fallbackFonts and glyphOverflow together, and requires them to be both null or both non-null.
|
| - fallbackFonts ? &glyphOverflow : nullptr);
|
| - }
|
| + if ((!from && len == text->textLength()) || text->style()->hasTextCombine())
|
| + return text->width(from, len, font, xPos, text->style()->direction(), fallbackFonts, glyphBounds);
|
|
|
| TextRun run = constructTextRun(text, font, text, from, len, text->styleRef());
|
| run.setCodePath(text->canUseSimpleFontCodePath() ? TextRun::ForceSimple : TextRun::ForceComplex);
|
| run.setTabSize(!collapseWhiteSpace, text->style()->tabSize());
|
| run.setXPos(xPos);
|
| - return font.width(run, fallbackFonts, nullptr);
|
| + return font.width(run, fallbackFonts, glyphBounds);
|
| }
|
|
|
| inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool& hyphenated)
|
| @@ -643,9 +639,9 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
|
|
|
| float additionalTempWidth;
|
| if (wordTrailingSpaceWidth && c == spaceCharacter)
|
| - additionalTempWidth = textWidth(layoutText, lastSpace, m_current.offset() + 1 - lastSpace, font, m_width.currentWidth(), m_collapseWhiteSpace, &wordMeasurement.fallbackFonts) - wordTrailingSpaceWidth;
|
| + additionalTempWidth = textWidth(layoutText, lastSpace, m_current.offset() + 1 - lastSpace, font, m_width.currentWidth(), m_collapseWhiteSpace, &wordMeasurement.fallbackFonts, &wordMeasurement.glyphBounds) - wordTrailingSpaceWidth;
|
| else
|
| - additionalTempWidth = textWidth(layoutText, lastSpace, m_current.offset() - lastSpace, font, m_width.currentWidth(), m_collapseWhiteSpace, &wordMeasurement.fallbackFonts);
|
| + additionalTempWidth = textWidth(layoutText, lastSpace, m_current.offset() - lastSpace, font, m_width.currentWidth(), m_collapseWhiteSpace, &wordMeasurement.fallbackFonts, &wordMeasurement.glyphBounds);
|
|
|
| wordMeasurement.width = additionalTempWidth + wordSpacingForWordMeasurement;
|
| additionalTempWidth += lastSpaceWordSpacing;
|
| @@ -669,7 +665,7 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
|
| // as candidate width for this line.
|
| bool lineWasTooWide = false;
|
| if (m_width.fitsOnLine() && m_currentCharacterIsSpace && m_currentStyle->breakOnlyAfterWhiteSpace() && !midWordBreak) {
|
| - float charWidth = textWidth(layoutText, m_current.offset(), 1, font, m_width.currentWidth(), m_collapseWhiteSpace, &wordMeasurement.fallbackFonts) + (applyWordSpacing ? wordSpacing : 0);
|
| + float charWidth = textWidth(layoutText, m_current.offset(), 1, font, m_width.currentWidth(), m_collapseWhiteSpace, &wordMeasurement.fallbackFonts, &wordMeasurement.glyphBounds) + (applyWordSpacing ? wordSpacing : 0);
|
| // Check if line is too big even without the extra space
|
| // at the end of the line. If it is not, do nothing.
|
| // If the line needs the extra whitespace to be too long,
|
| @@ -805,7 +801,7 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
|
| wordMeasurement.layoutText = layoutText;
|
|
|
| // IMPORTANT: current.m_pos is > length here!
|
| - float additionalTempWidth = m_ignoringSpaces ? 0 : textWidth(layoutText, lastSpace, m_current.offset() - lastSpace, font, m_width.currentWidth(), m_collapseWhiteSpace, &wordMeasurement.fallbackFonts);
|
| + float additionalTempWidth = m_ignoringSpaces ? 0 : textWidth(layoutText, lastSpace, m_current.offset() - lastSpace, font, m_width.currentWidth(), m_collapseWhiteSpace, &wordMeasurement.fallbackFonts, &wordMeasurement.glyphBounds);
|
| wordMeasurement.startOffset = lastSpace;
|
| wordMeasurement.endOffset = m_current.offset();
|
| wordMeasurement.width = m_ignoringSpaces ? 0 : additionalTempWidth + wordSpacingForWordMeasurement;
|
|
|