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

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

Issue 2803483002: Adjust visual overflow rect for rounded/shifted ascent/descent (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
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 d34eda4f1c0fff3c89964ec7c5b100b0120097ca..573967a8f8abf3128c93abec98b33c9534f1cfbc 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp
@@ -1957,6 +1957,22 @@ LayoutRect LayoutText::visualOverflowRect() const {
LayoutUnit logicalHeight =
lastTextBox()->logicalBottomVisualOverflow() - logicalTop;
+ // Inflate visual overflow if we have adjusted ascent/descent causing the
eae 2017/04/07 17:41:57 This is better, thank you. I'm still not convinced
Xianzhu 2017/04/07 18:02:52 What do you think about my previous comment: https
+ // painted glyphs to overflow the layout geometries based on the adjusted
+ // ascent/descent.
+ auto inflationForAscent = styleRef(firstTextBox()->isFirstLineStyle())
+ .font()
+ .primaryFont()
eae 2017/04/07 17:41:57 primaryFont may be null.
Xianzhu 2017/04/07 18:02:53 Done. Should we have DCHECK(primaryFont) here? I
+ ->getFontMetrics()
+ .visualOverflowInflationForAscent();
+ auto inflationForDescent = styleRef(lastTextBox()->isFirstLineStyle())
+ .font()
+ .primaryFont()
+ ->getFontMetrics()
+ .visualOverflowInflationForDescent();
+ logicalTop -= inflationForAscent;
+ logicalHeight += inflationForAscent + inflationForDescent;
+
LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight);
if (!style()->isHorizontalWritingMode())
rect = rect.transposedRect();

Powered by Google App Engine
This is Rietveld 408576698