Chromium Code Reviews| Index: third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp |
| diff --git a/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp b/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp |
| index 64ed3bef897a89bf6255d54df379ec09961ea892..79de4b5389ddf7196940a2b97d25c78270c7d412 100644 |
| --- a/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp |
| +++ b/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp |
| @@ -77,43 +77,48 @@ static LayoutUnit computeUnderlineOffsetForUnder( |
| } |
| } |
| -static int computeUnderlineOffset(const TextUnderlinePosition underlinePosition, |
| - const ComputedStyle& style, |
| - const FontMetrics& fontMetrics, |
| - const InlineTextBox* inlineTextBox, |
| - const float textDecorationThickness) { |
| +static int computeUnderlineOffsetForRoman(const FontMetrics& fontMetrics, |
| + const float textDecorationThickness) { |
| // Compute the gap between the font and the underline. Use at least one |
| // pixel gap, if underline is thick then use a bigger gap. |
| int gap = 0; |
| // Underline position of zero means draw underline on Baseline Position, |
| // in Blink we need at least 1-pixel gap to adding following check. |
| - // Positive underline Position means underline should be drawn above baselin e |
| + // Positive underline Position means underline should be drawn above baseline |
| // and negative value means drawing below baseline, negating the value as in |
| - // Blink |
| - // downward Y-increases. |
| + // Blink downward Y-increases. |
| if (fontMetrics.underlinePosition()) |
| gap = -fontMetrics.underlinePosition(); |
| else |
| gap = std::max<int>(1, ceilf(textDecorationThickness / 2.f)); |
| + // Position underline near the alphabetic baseline. |
| + return fontMetrics.ascent() + gap; |
| +} |
| + |
| +static int computeUnderlineOffset(const TextUnderlinePosition underlinePosition, |
| + const ComputedStyle& style, |
| + const FontMetrics& fontMetrics, |
| + const InlineTextBox* inlineTextBox, |
| + const float textDecorationThickness) { |
| // FIXME: We support only horizontal text for now. |
| switch (underlinePosition) { |
| + default: |
|
drott
2017/01/23 08:20:23
Do we parse other values than Auto and Under in CS
|
| + NOTREACHED(); |
| + // Fall through. |
| case TextUnderlinePositionAuto: |
| - return fontMetrics.ascent() + |
| - gap; // Position underline near the alphabetic baseline. |
| + return computeUnderlineOffsetForRoman(fontMetrics, |
| + textDecorationThickness); |
| case TextUnderlinePositionUnder: { |
| - // Position underline relative to the under edge of the lowest element's |
| + // Position underline at the under edge of the lowest element's |
| // content box. |
| LayoutUnit offset = computeUnderlineOffsetForUnder(style, inlineTextBox); |
| offset = inlineTextBox->logicalHeight() + std::max(offset, LayoutUnit()); |
| - return offset.toInt() + gap; |
| + return offset.toInt(); |
| } |
| } |
| - |
| - NOTREACHED(); |
| - return fontMetrics.ascent() + gap; |
| } |
| static bool shouldSetDecorationAntialias( |