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

Unified Diff: Source/core/editing/FrameSelection.cpp

Issue 429453004: Let FrameSelection::localCaretRect on a text input field avoid synchronous layout. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Nits Created 6 years, 5 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
Index: Source/core/editing/FrameSelection.cpp
diff --git a/Source/core/editing/FrameSelection.cpp b/Source/core/editing/FrameSelection.cpp
index 55db7b776bc49c8f96fb84cccf87fef731630808..e4d1ca724506aab097a61d7a25aa7071ff65ffc5 100644
--- a/Source/core/editing/FrameSelection.cpp
+++ b/Source/core/editing/FrameSelection.cpp
@@ -1222,13 +1222,20 @@ static bool isNonOrphanedCaret(const VisibleSelection& selection)
return selection.isCaret() && !selection.start().isOrphan() && !selection.end().isOrphan();
}
+static bool isTextFormControl(const VisibleSelection& selection)
+{
+ return enclosingTextFormControl(selection.start());
+}
+
LayoutRect FrameSelection::localCaretRect()
{
if (shouldUpdateCaretRect()) {
if (!isNonOrphanedCaret(m_selection))
clearCaretRect();
- else if (updateCaretRect(m_frame->document(), VisiblePosition(m_selection.start(), m_selection.affinity())))
- m_absCaretBoundsDirty = true;
+ else if (isTextFormControl(m_selection))
+ m_absCaretBoundsDirty |= updateCaretRect(m_frame->document(), PositionWithAffinity(m_selection.start().isCandidate() ? m_selection.start() : Position(), m_selection.affinity()));
+ else
+ m_absCaretBoundsDirty |= updateCaretRect(m_frame->document(), VisiblePosition(m_selection.start(), m_selection.affinity()));
}
return localCaretRectWithoutUpdate();

Powered by Google App Engine
This is Rietveld 408576698