Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutText.cpp

Issue 2797423005: Always use original ascent/descent for FontMetrics::floatAscent|floatDescent (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698