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..3ddf8da83962d55dbc6cf2278acb6df99943fb0e 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutText.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp |
@@ -1939,6 +1939,20 @@ LayoutRect LayoutText::linesBoundingBox() const { |
return result; |
} |
+static int visualOverflowAdjustmentForAscent(const ComputedStyle& style) { |
+ return style.font() |
+ .primaryFont() |
+ ->getFontMetrics() |
+ .visualOverflowAdjustmentForAscent(); |
+} |
+ |
+static int visualOverflowAdjustmentForDescent(const ComputedStyle& style) { |
+ return style.font() |
+ .primaryFont() |
+ ->getFontMetrics() |
+ .visualOverflowAdjustmentForDescent(); |
+} |
+ |
LayoutRect LayoutText::visualOverflowRect() const { |
if (!firstTextBox()) |
return LayoutRect(); |
@@ -1957,6 +1971,19 @@ LayoutRect LayoutText::visualOverflowRect() const { |
LayoutUnit logicalHeight = |
lastTextBox()->logicalBottomVisualOverflow() - logicalTop; |
+ const auto& firstStyle = styleRef(firstTextBox()->isFirstLineStyle()); |
eae
2017/04/07 16:34:56
If I understand the logic right you are inflating
Xianzhu
2017/04/07 17:27:11
This won't work because
1. in many cases floatAsce
|
+ int ascentAdjustment = visualOverflowAdjustmentForAscent(firstStyle); |
+ int descentAdjustment = visualOverflowAdjustmentForDescent(firstStyle); |
+ if (lastTextBox()->isFirstLineStyle() != firstTextBox()->isFirstLineStyle()) { |
+ const auto& lastStyle = styleRef(lastTextBox()->isFirstLineStyle()); |
eae
2017/04/07 16:34:56
The names here are bad. It's not really an ascentA
Xianzhu
2017/04/07 17:27:11
Renamed visualOverflowAdjustmentXxx to visualOverf
|
+ ascentAdjustment = std::max(ascentAdjustment, |
+ visualOverflowAdjustmentForAscent(lastStyle)); |
+ descentAdjustment = std::max(descentAdjustment, |
+ visualOverflowAdjustmentForDescent(lastStyle)); |
+ } |
+ logicalTop -= ascentAdjustment; |
+ logicalHeight += ascentAdjustment + descentAdjustment; |
+ |
LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); |
if (!style()->isHorizontalWritingMode()) |
rect = rect.transposedRect(); |