Index: Source/core/rendering/InlineTextBox.cpp |
diff --git a/Source/core/rendering/InlineTextBox.cpp b/Source/core/rendering/InlineTextBox.cpp |
index d36b8b4c49f6af4c5c4e2853ac0735c81c511ac1..7f5d7cb761494296b6ef6326460624776177bb50 100644 |
--- a/Source/core/rendering/InlineTextBox.cpp |
+++ b/Source/core/rendering/InlineTextBox.cpp |
@@ -910,7 +910,17 @@ static int computeUnderlineOffset(const TextUnderlinePosition underlinePosition, |
{ |
// Compute the gap between the font and the underline. Use at least one |
// pixel gap, if underline is thick then use a bigger gap. |
- const int gap = std::max<int>(1, ceilf(textDecorationThickness / 2.f)); |
+ 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 baseline |
+ // and negative value means drawing below baseline, negating the value as in Blink |
+ // downward Y-increases. |
+ if (fontMetrics.underlinePosition()) |
+ gap = -fontMetrics.underlinePosition(); |
+ else |
+ gap = std::max<int>(1, ceilf(textDecorationThickness / 2.f)); |
// FIXME: We support only horizontal text for now. |
switch (underlinePosition) { |