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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org) 3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 LayoutUnit logicalLeftSide = LayoutUnit::max(); 1558 LayoutUnit logicalLeftSide = LayoutUnit::max();
1559 LayoutUnit logicalRightSide = LayoutUnit::min(); 1559 LayoutUnit logicalRightSide = LayoutUnit::min();
1560 for (InlineTextBox* curr = firstTextBox(); curr; curr = curr->nextTextBox()) { 1560 for (InlineTextBox* curr = firstTextBox(); curr; curr = curr->nextTextBox()) {
1561 LayoutRect logicalVisualOverflow = curr->logicalOverflowRect(); 1561 LayoutRect logicalVisualOverflow = curr->logicalOverflowRect();
1562 logicalLeftSide = std::min(logicalLeftSide, logicalVisualOverflow.x()); 1562 logicalLeftSide = std::min(logicalLeftSide, logicalVisualOverflow.x());
1563 logicalRightSide = std::max(logicalRightSide, logicalVisualOverflow.maxX ()); 1563 logicalRightSide = std::max(logicalRightSide, logicalVisualOverflow.maxX ());
1564 } 1564 }
1565 1565
1566 LayoutUnit logicalTop = firstTextBox()->logicalTopVisualOverflow(); 1566 LayoutUnit logicalTop = firstTextBox()->logicalTopVisualOverflow();
1567 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; 1567 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide;
1568 LayoutUnit logicalHeight = lastTextBox()->logicalBottomVisualOverflow() - lo gicalTop; 1568 InlineTextBox* lastBox = lastTextBox();
1569 LayoutUnit logicalHeight = lastBox->logicalBottomVisualOverflow() - logicalT op;
1570
1571 // Include visual overflow for wrapped selection newline highlight if applic able.
1572 if (lastBox->hasWrappedSelectionNewline() || (isBR() && getSelectionState() != SelectionNone)) {
1573 // TODO(wkorman): The below is likely insufficient to handle RTL text.
1574 // We already paint RTL wrapped newline selection highlights in
1575 // contenteditable incorrectly. We should fix painting in tandem with
1576 // this visual overflow rect. http://crbug.com/610813
1577 logicalWidth += lastBox->newlineSpaceWidth();
1578 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
1579 }
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
1569 1580
1570 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); 1581 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight);
1571 if (!style()->isHorizontalWritingMode()) 1582 if (!style()->isHorizontalWritingMode())
1572 rect = rect.transposedRect(); 1583 rect = rect.transposedRect();
1573 return rect; 1584 return rect;
1574 } 1585 }
1575 1586
1576 LayoutRect LayoutText::localOverflowRectForPaintInvalidation() const 1587 LayoutRect LayoutText::localOverflowRectForPaintInvalidation() const
1577 { 1588 {
1578 if (style()->visibility() != VISIBLE) 1589 if (style()->visibility() != VISIBLE)
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1699 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 1710 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
1700 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason); 1711 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason);
1701 if (box->truncation() != cNoTruncation) { 1712 if (box->truncation() != cNoTruncation) {
1702 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox()) 1713 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox())
1703 paintInvalidationContainer.invalidateDisplayItemClientOnBacking( *ellipsisBox, invalidationReason); 1714 paintInvalidationContainer.invalidateDisplayItemClientOnBacking( *ellipsisBox, invalidationReason);
1704 } 1715 }
1705 } 1716 }
1706 } 1717 }
1707 1718
1708 } // namespace blink 1719 } // namespace blink
OLDNEW
« 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