| 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());
|
| + int ascentAdjustment = visualOverflowAdjustmentForAscent(firstStyle);
|
| + int descentAdjustment = visualOverflowAdjustmentForDescent(firstStyle);
|
| + if (lastTextBox()->isFirstLineStyle() != firstTextBox()->isFirstLineStyle()) {
|
| + const auto& lastStyle = styleRef(lastTextBox()->isFirstLineStyle());
|
| + 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();
|
|
|