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

Issue 429453004: Let FrameSelection::localCaretRect on a text input field avoid synchronous layout. (Closed)

Created:
6 years, 4 months ago by yoichio
Modified:
6 years, 4 months ago
Reviewers:
tkent, yosin_UTC9
CC:
blink-reviews, dglazkov+blink, blink-reviews-html_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Let FrameSelection::localCaretRect on a text input field avoid synchronous layout. We use VisiblePosition canonicalize to know where to draw a caret. However if selection is on a text input, we need concern just whether the text input is visible or not. It means we can change VisiblePosition to PositionWithAffinity. Source/core/editing/Caret.cpp/h: - Add a override method of updateCaretRect using PositionWithAffinity. Source/core/editing/FrameSelection.cpp: - if selection is on a TextFormControl, use the updateCaretRect function. Source/core/editing/PositionWithAffinity.h, VisiblePosition.h: - Move the localCaretRect function to PositionWithAffinity. It uses position and affinity so moving is straightforward. Source/core/html/HTMLTextFormControlElementTest.cpp: - Add a test to confirm FrameSelection::localCaretRect not to cause layout. BUG=382809 TEST=HTMLTextFormControlElementTest.cpp Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=179133

Patch Set 1 : fix #

Total comments: 12

Patch Set 2 : Move localCaretRect to VisibleUnits #

Total comments: 5

Patch Set 3 : Nits #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+85 lines, -28 lines) Patch
M Source/core/editing/Caret.h View 1 2 2 chunks +3 lines, -0 lines 1 comment Download
M Source/core/editing/Caret.cpp View 1 3 chunks +12 lines, -5 lines 0 comments Download
M Source/core/editing/FrameSelection.cpp View 1 1 chunk +9 lines, -2 lines 0 comments Download
M Source/core/editing/VisiblePosition.cpp View 1 1 chunk +2 lines, -18 lines 0 comments Download
M Source/core/editing/VisibleUnits.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M Source/core/editing/VisibleUnits.cpp View 1 1 chunk +22 lines, -0 lines 0 comments Download
M Source/core/html/HTMLTextFormControlElementTest.cpp View 1 2 5 chunks +31 lines, -3 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
yoichio
PTAL
6 years, 4 months ago (2014-07-29 06:14:14 UTC) #1
yosin_UTC9
https://codereview.chromium.org/429453004/diff/100001/Source/core/editing/FrameSelection.cpp File Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/429453004/diff/100001/Source/core/editing/FrameSelection.cpp#newcode1227 Source/core/editing/FrameSelection.cpp:1227: return !!enclosingTextFormControl(selection.start()); nit: I don't think we need to ...
6 years, 4 months ago (2014-07-29 07:00:20 UTC) #2
yoichio
https://codereview.chromium.org/429453004/diff/100001/Source/core/editing/FrameSelection.cpp File Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/429453004/diff/100001/Source/core/editing/FrameSelection.cpp#newcode1227 Source/core/editing/FrameSelection.cpp:1227: return !!enclosingTextFormControl(selection.start()); On 2014/07/29 07:00:20, Yosi_UTC9 wrote: > nit: ...
6 years, 4 months ago (2014-07-29 08:05:17 UTC) #3
yosin_UTC9
LGTM w/ nit Please add TEST=HTMLTextFormControlElementTest.cpp in description. You need to ask OWNERS review as ...
6 years, 4 months ago (2014-07-29 09:09:02 UTC) #4
yoichio
On 2014/07/29 09:09:02, Yosi_UTC9 wrote: > LGTM w/ nit > > Please add TEST=HTMLTextFormControlElementTest.cpp in ...
6 years, 4 months ago (2014-07-29 09:14:16 UTC) #5
yoichio
Add tkent@ as an OWNER. Thanks in advance.
6 years, 4 months ago (2014-07-29 09:17:21 UTC) #6
tkent
lgtm https://codereview.chromium.org/429453004/diff/120001/Source/core/editing/Caret.h File Source/core/editing/Caret.h (right): https://codereview.chromium.org/429453004/diff/120001/Source/core/editing/Caret.h#newcode51 Source/core/editing/Caret.h:51: bool updateCaretRect(Document*, const PositionWithAffinity& caretPosition); Please add a ...
6 years, 4 months ago (2014-07-29 09:30:20 UTC) #7
yoichio
The CQ bit was checked by yoichio@chromium.org
6 years, 4 months ago (2014-07-29 10:32:23 UTC) #8
yoichio
https://codereview.chromium.org/429453004/diff/120001/Source/core/editing/Caret.h File Source/core/editing/Caret.h (right): https://codereview.chromium.org/429453004/diff/120001/Source/core/editing/Caret.h#newcode51 Source/core/editing/Caret.h:51: bool updateCaretRect(Document*, const PositionWithAffinity& caretPosition); On 2014/07/29 09:30:20, tkent ...
6 years, 4 months ago (2014-07-29 10:32:46 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yoichio@chromium.org/429453004/140001
6 years, 4 months ago (2014-07-29 10:32:55 UTC) #10
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: mac_blink_rel on tryserver.blink ...
6 years, 4 months ago (2014-07-29 11:39:57 UTC) #11
commit-bot: I haz the power
Change committed as 179133
6 years, 4 months ago (2014-07-29 12:26:09 UTC) #12
tkent
6 years, 4 months ago (2014-07-30 00:29:33 UTC) #13
Message was sent while issue was closed.
https://codereview.chromium.org/429453004/diff/140001/Source/core/editing/Car...
File Source/core/editing/Caret.h (right):

https://codereview.chromium.org/429453004/diff/140001/Source/core/editing/Car...
Source/core/editing/Caret.h:52: // Simply calls above updateCaretRect using
deepEquivalent() and affinity().
This comment is not helpful.
Please write a comment to help a developer who wants to call updateCaretRect.
The important difference is synchronous layout, and we should use the former
version if possible, right?

Powered by Google App Engine
This is Rietveld 408576698