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 a1edc563a28cd844b0ffe4740927ae1547551cc4..e381796f36bc41436b85acc7cf5ac04bbeb0d5a9 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutText.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp |
@@ -1565,7 +1565,18 @@ LayoutRect LayoutText::visualOverflowRect() const |
LayoutUnit logicalTop = firstTextBox()->logicalTopVisualOverflow(); |
LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; |
- LayoutUnit logicalHeight = lastTextBox()->logicalBottomVisualOverflow() - logicalTop; |
+ InlineTextBox* lastBox = lastTextBox(); |
+ LayoutUnit logicalHeight = lastBox->logicalBottomVisualOverflow() - logicalTop; |
+ |
+ // Include visual overflow for wrapped selection newline highlight if applicable. |
+ if (lastBox->hasWrappedSelectionNewline() || (isBR() && getSelectionState() != SelectionNone)) { |
+ // TODO(wkorman): The below is likely insufficient to handle RTL text. |
+ // We already paint RTL wrapped newline selection highlights in |
+ // contenteditable incorrectly. We should fix painting in tandem with |
+ // this visual overflow rect. http://crbug.com/610813 |
+ logicalWidth += lastBox->newlineSpaceWidth(); |
+ logicalHeight = std::max(logicalHeight, localSelectionRect().height()); |
eae
2016/05/10 20:39:19
Why is the height override needed? When is the loc
wkorman
2016/05/10 21:33:01
For isBR() case (note this block executes also in
|
+ } |
Xianzhu
2016/05/10 20:35:46
Should LayoutText::localSelectionRect() also have
wkorman
2016/05/10 20:41:08
Hmm. We already have essentially this logic in Inl
Xianzhu
2016/05/10 21:10:46
Sorry, actually I didn't carefully read the added
Xianzhu
2016/05/10 21:13:56
s/Selection change affects/With this CL, selection
wkorman
2016/05/10 21:33:01
Hmm, I think I see what you're saying. It seems it
Xianzhu
2016/05/10 21:55:13
I think "visual overflow doesn't affect layout" an
|
LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); |
if (!style()->isHorizontalWritingMode()) |