| Index: third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
|
| index c99a80a9d223a434ab7161328f1b80811064bbba..3d1618bf95d8add60049c2bde95db2ad9e02aac6 100644
|
| --- a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
|
| @@ -1161,6 +1161,41 @@ inline void InlineFlowBox::addReplacedChildOverflow(
|
| logicalLayoutOverflow.unite(childLogicalLayoutOverflow);
|
| }
|
|
|
| +static void computeGlyphOverflow(
|
| + InlineTextBox* text,
|
| + const LineLayoutText& layoutText,
|
| + GlyphOverflowAndFallbackFontsMap& textBoxDataMap) {
|
| + HashSet<const SimpleFontData*> fallbackFonts;
|
| + FloatRect glyphBounds;
|
| + GlyphOverflow glyphOverflow;
|
| + float measuredWidth =
|
| + layoutText.width(text->start(), text->len(), LayoutUnit(),
|
| + text->direction(), false, &fallbackFonts, &glyphBounds);
|
| + const Font& font = layoutText.style()->font();
|
| + const SimpleFontData* fontData = font.primaryFont();
|
| + DCHECK(fontData);
|
| + glyphOverflow.setFromBounds(
|
| + glyphBounds, fontData ? fontData->getFontMetrics().floatAscent() : 0,
|
| + fontData ? fontData->getFontMetrics().floatDescent() : 0, measuredWidth);
|
| + if (!fallbackFonts.isEmpty()) {
|
| + GlyphOverflowAndFallbackFontsMap::ValueType* it =
|
| + textBoxDataMap
|
| + .insert(text, std::make_pair(Vector<const SimpleFontData*>(),
|
| + GlyphOverflow()))
|
| + .storedValue;
|
| + DCHECK(it->value.first.isEmpty());
|
| + copyToVector(fallbackFonts, it->value.first);
|
| + }
|
| + if (!glyphOverflow.isApproximatelyZero()) {
|
| + GlyphOverflowAndFallbackFontsMap::ValueType* it =
|
| + textBoxDataMap
|
| + .insert(text, std::make_pair(Vector<const SimpleFontData*>(),
|
| + GlyphOverflow()))
|
| + .storedValue;
|
| + it->value.second = glyphOverflow;
|
| + }
|
| +}
|
| +
|
| void InlineFlowBox::computeOverflow(
|
| LayoutUnit lineTop,
|
| LayoutUnit lineBottom,
|
| @@ -1196,7 +1231,15 @@ void InlineFlowBox::computeOverflow(
|
| if (rt.isBR())
|
| continue;
|
| LayoutRect textBoxOverflow(text->logicalFrameRect());
|
| - addTextBoxVisualOverflow(text, textBoxDataMap, textBoxOverflow);
|
| + if (textBoxDataMap.isEmpty()) {
|
| + // An empty glyph map means that we're computing overflow without
|
| + // a layout, so calculate the glyph overflow on the fly.
|
| + GlyphOverflowAndFallbackFontsMap glyphOverflowForText;
|
| + computeGlyphOverflow(text, rt, glyphOverflowForText);
|
| + addTextBoxVisualOverflow(text, glyphOverflowForText, textBoxOverflow);
|
| + } else {
|
| + addTextBoxVisualOverflow(text, textBoxDataMap, textBoxOverflow);
|
| + }
|
| logicalVisualOverflow.unite(textBoxOverflow);
|
| } else if (curr->getLineLayoutItem().isLayoutInline()) {
|
| InlineFlowBox* flow = toInlineFlowBox(curr);
|
|
|