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

Unified Diff: third_party/WebKit/Source/core/editing/FrameCaret.cpp

Issue 2623053006: Get rid of CaretBase::m_caretLocalRect (Closed)
Patch Set: 2017-01-12T19:03:43 Created 3 years, 11 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/Source/core/editing/DragCaretController.cpp ('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/editing/FrameCaret.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameCaret.cpp b/third_party/WebKit/Source/core/editing/FrameCaret.cpp
index 85fc98a621c6e3dc470834d6dc509655305b7973..d2073529efe2d7d9646f90be25e7dc9b17de5883 100644
--- a/third_party/WebKit/Source/core/editing/FrameCaret.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameCaret.cpp
@@ -209,6 +209,7 @@ void FrameCaret::invalidateCaretRect(bool forceInvalidation) {
m_previousCaretVisibility = m_caretVisibility;
}
+// TDOO(yosin): We should mark |FrameCaret::absoluteCaretBounds()| to |const|.
IntRect FrameCaret::absoluteCaretBounds() {
DCHECK_NE(m_frame->document()->lifecycle().state(),
DocumentLifecycle::InPaintInvalidation);
@@ -216,20 +217,18 @@ IntRect FrameCaret::absoluteCaretBounds() {
DocumentLifecycle::DisallowTransitionScope disallowTransition(
m_frame->document()->lifecycle());
- if (!isActive()) {
- clearCaretRect();
- } else {
- if (enclosingTextControl(caretPosition().position())) {
- if (isVisuallyEquivalentCandidate(caretPosition().position()))
- updateCaretRect(caretPosition());
- else
- updateCaretRect(createVisiblePosition(caretPosition()));
- } else {
- updateCaretRect(createVisiblePosition(caretPosition()));
- }
+ Node* const caretNode = caretPosition().anchorNode();
+ if (!isActive())
+ return absoluteBoundsForLocalRect(caretNode, LayoutRect());
+ // TODO(yosin): We should get rid of text control short path since layout
+ // tree is clean.
+ if (enclosingTextControl(caretPosition().position()) &&
+ isVisuallyEquivalentCandidate(caretPosition().position())) {
+ return absoluteBoundsForLocalRect(caretNode,
+ computeCaretRect(caretPosition()));
}
- return absoluteBoundsForLocalRect(caretPosition().anchorNode(),
- localCaretRectWithoutUpdate());
+ return absoluteBoundsForLocalRect(
+ caretNode, computeCaretRect(createVisiblePosition(caretPosition())));
}
void FrameCaret::setShouldShowBlockCursor(bool shouldShowBlockCursor) {
@@ -248,9 +247,9 @@ void FrameCaret::paintCaret(GraphicsContext& context,
if (!(isActive() && m_shouldPaintCaret))
return;
- updateCaretRect(caretPosition());
- CaretBase::paintCaret(caretPosition().anchorNode(), context, paintOffset,
- DisplayItem::kCaret);
+ const LayoutRect caretLocalRect = computeCaretRect(caretPosition());
+ CaretBase::paintCaret(caretPosition().anchorNode(), context, *this,
+ caretLocalRect, paintOffset, DisplayItem::kCaret);
}
void FrameCaret::dataWillChange(const CharacterData& node) {
« no previous file with comments | « third_party/WebKit/Source/core/editing/DragCaretController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698