Index: third_party/WebKit/Source/core/layout/LayoutText.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.cpp b/third_party/WebKit/Source/core/layout/LayoutText.cpp |
index 18e7f754968885ef4adeea12ae6fa1634406cb2b..34d0e3672bc13c05feb455235ee1fb6226a8c9ae 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutText.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp |
@@ -1957,23 +1957,21 @@ LayoutRect LayoutText::visualOverflowRect() const { |
LayoutUnit logicalHeight = |
lastTextBox()->logicalBottomVisualOverflow() - logicalTop; |
- // Inflate visual overflow if we have adjusted ascent/descent causing the |
- // painted glyphs to overflow the layout geometries based on the adjusted |
+ // Inflate visual overflow if we have rounded down ascent/descent causing the |
+ // painted glyphs to overflow the layout geometries based on the rounded down |
// ascent/descent. |
int inflationForAscent = 0; |
int inflationForDescent = 0; |
const auto* font = |
styleRef(firstTextBox()->isFirstLineStyle()).font().primaryFont(); |
- if (font) { |
- inflationForAscent = |
- font->getFontMetrics().visualOverflowInflationForAscent(); |
- } |
+ if (font && |
+ font->getFontMetrics().ascent() < font->getFontMetrics().floatAscent()) |
+ inflationForAscent = 1; |
if (lastTextBox()->isFirstLineStyle() != firstTextBox()->isFirstLineStyle()) |
font = styleRef(lastTextBox()->isFirstLineStyle()).font().primaryFont(); |
- if (font) { |
- inflationForDescent = |
- font->getFontMetrics().visualOverflowInflationForDescent(); |
- } |
+ if (font && |
+ font->getFontMetrics().descent() < font->getFontMetrics().floatDescent()) |
+ inflationForDescent = 1; |
logicalTop -= inflationForAscent; |
logicalHeight += inflationForAscent + inflationForDescent; |