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

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

Issue 1955423004: Include selection rect in paint invalidation for LayoutText. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebaseline tests. Created 4 years, 7 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 | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | 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 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())
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698