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

Issue 431983005: FrameSelection::updateApperance for caret should not cause layout. (Closed)

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

Description

FrameSelection::updateApperance for caret should not cause layout. We do not need update caret rectangle synchronously because we just need updated caret in painting. Thus this CL delays computing new caret rectangle. Source/core/editing/FrameSelection.cpp: - Add ResetCaretBlinkOption to updateAppearance(). The option is set to ResetCaretBlink when it is called from setSelection. If ResetCaretBlink, we reset caret blinking. If we need to repaint caret, set |m_caretRectDirty| flag. If |m_caretRectDirty| is set, we call PageAnimator::scheduleVisualUpdate to trigger repaint. For range, create VisibleSelection without validation like HTMLTextFormControlElement::setSelectionRange. - Add the setCaretRectNeedsUpdate function to just set |m_caretRectDirty| flag and call new scheduleVisualUpdate function, which calls PageAnimator::scheduleVisualUpdate. - FrameSelection::invalidateCaretRect does 1. Checks the dirty flag. 2. Gets new caret rectangle and node which has the caret renderer. 3. if caret is changed, invalidate the new caret rect and the old caret rect. 4. Caches the new caret rect and node. Sets dirty flag off. This function is similar to old recomputeCaretRect(deleted). - Delete unused updateRenderTreeIfneeded() from notifyRenderOfSelectionChange(). In old days, notifyRenderOfSelectionChange() used renderer. - Refactor FrameSelection::absoluteCaretBounds() to call updateCaretRect directly. Since we update layout, ASSERT that document's lifecycle is not in InPaintInvalidation. Source/core/editing/Caret.cpp: - Remove document->updateRenderTreeIfNeeded() from CaretBase::updateCaretRect and call it from caller. - In FrameSelection::paintCaret, call without updateRenderTreeIfNeeded because the tree must be updated on the painting phase. Source/core/frame/FrameView.cpp: - FrameView::invalidateTreeIfNeeded calls FrameSelection::InvalidateCaretRect to invalidate caret rect for each frame. Source/core/html/HTMLTextFormControlElementTest.cpp: - Add new test to confirm setSelectionRange with another start/end not cause layout. - Delete FrameSelectionLocalCaretRectDoesNotCauseLayout because localCaretRect is removed. Layouttests: - This cl reduces redundant RenderObject::invalidatePaintRectangle calls so we need to delete lines from expected.txt but result images are still same. BUG=382809, 397303, 403317 TEST=Layouttests/fast/forms/textarea-scrollbar.html, textarea-scrolled-type.html Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=180269

Patch Set 1 : wip #

Total comments: 2

Patch Set 2 : Add updateLocalCaretRect function #

Total comments: 6

Patch Set 3 : Generalized to contenteditable #

Patch Set 4 : Fix a repaint expectation #

Total comments: 2

Patch Set 5 : Fix linux repaint expectations #

Patch Set 6 : Fix mac test #

Patch Set 7 : Rebase #

Total comments: 1

Patch Set 8 : Move caret recomputing to PageWedgetDelegate::layout #

Patch Set 9 : Delay invalidation #

Total comments: 2

Patch Set 10 : Let FrameSelection rember the previous rect. #

Total comments: 14

Patch Set 11 : Update #

Total comments: 6

Patch Set 12 : Fix test failures #

Unified diffs Side-by-side diffs Delta from patch set Stats (+119 lines, -107 lines) Patch
M LayoutTests/TestExpectations View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +4 lines, -0 lines 0 comments Download
M LayoutTests/fast/repaint/paint-caret-in-div-with-negative-indent-expected.txt View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -1 line 0 comments Download
M Source/core/editing/Caret.cpp View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +4 lines, -3 lines 0 comments Download
M Source/core/editing/FrameSelection.h View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +11 lines, -12 lines 0 comments Download
M Source/core/editing/FrameSelection.cpp View 1 2 3 4 5 6 7 8 9 10 11 9 chunks +82 lines, -71 lines 0 comments Download
M Source/core/frame/FrameView.cpp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -0 lines 0 comments Download
M Source/core/html/HTMLTextFormControlElementTest.cpp View 1 2 3 4 5 6 7 8 9 3 chunks +15 lines, -20 lines 0 comments Download

Messages

Total messages: 55 (0 generated)
yoichio
6 years, 4 months ago (2014-08-02 04:40:10 UTC) #1
yosin_UTC9
Awesome! The change is very small. (^_^)b https://codereview.chromium.org/431983005/diff/40001/Source/core/editing/FrameSelection.cpp File Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/431983005/diff/40001/Source/core/editing/FrameSelection.cpp#newcode1296 Source/core/editing/FrameSelection.cpp:1296: localCaretRect(); The ...
6 years, 4 months ago (2014-08-04 01:44:23 UTC) #2
yoichio
https://codereview.chromium.org/431983005/diff/40001/Source/core/editing/FrameSelection.cpp File Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/431983005/diff/40001/Source/core/editing/FrameSelection.cpp#newcode1296 Source/core/editing/FrameSelection.cpp:1296: localCaretRect(); On 2014/08/04 01:44:23, Yosi_UTC9 wrote: > The name ...
6 years, 4 months ago (2014-08-04 02:12:18 UTC) #3
ojan
Removing code from a generic location and only adding it back in for text controls ...
6 years, 4 months ago (2014-08-04 06:29:28 UTC) #4
esprehn
I'll take a look tomorrow, indeed that's a scary change (by description, didn't look at ...
6 years, 4 months ago (2014-08-04 07:26:27 UTC) #5
yoichio
PTAL?
6 years, 4 months ago (2014-08-05 00:11:43 UTC) #6
esprehn
I don't think this patch actually does anything, but adding a call to updateLayoutIgnorePendingStylesheets from ...
6 years, 4 months ago (2014-08-05 01:00:02 UTC) #7
yoichio
https://codereview.chromium.org/431983005/diff/80001/Source/core/editing/FrameSelection.cpp File Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/431983005/diff/80001/Source/core/editing/FrameSelection.cpp#newcode277 Source/core/editing/FrameSelection.cpp:277: updateAppearance(); On 2014/08/05 01:00:02, esprehn wrote: > updateAppearance creates ...
6 years, 4 months ago (2014-08-05 05:56:38 UTC) #8
yoichio
PTAL. I would like 2 or more round trip a day if possible. When is ...
6 years, 4 months ago (2014-08-05 22:26:56 UTC) #9
leviw_travelin_and_unemployed
On 2014/08/05 at 22:26:56, yoichio wrote: > PTAL. It doesn't look like you updated the ...
6 years, 4 months ago (2014-08-05 22:42:27 UTC) #10
yoichio
On 2014/08/05 22:42:27, leviw wrote: > On 2014/08/05 at 22:26:56, yoichio wrote: > > PTAL. ...
6 years, 4 months ago (2014-08-05 22:46:52 UTC) #11
esprehn
I don't think we want to land special cases for textarea like this. Why can't ...
6 years, 4 months ago (2014-08-05 23:35:15 UTC) #12
yoichio
On 2014/08/05 23:35:15, esprehn wrote: > I don't think we want to land special cases ...
6 years, 4 months ago (2014-08-06 02:28:47 UTC) #13
yosin_UTC9
https://codereview.chromium.org/431983005/diff/140001/Source/web/WebViewImpl.cpp File Source/web/WebViewImpl.cpp (right): https://codereview.chromium.org/431983005/diff/140001/Source/web/WebViewImpl.cpp#newcode1747 Source/web/WebViewImpl.cpp:1747: if (frame && frame->isLocalFrame()) { nit: We don't need ...
6 years, 4 months ago (2014-08-07 01:09:56 UTC) #14
yoichio
Looks all green. PTAL. https://codereview.chromium.org/431983005/diff/140001/Source/web/WebViewImpl.cpp File Source/web/WebViewImpl.cpp (right): https://codereview.chromium.org/431983005/diff/140001/Source/web/WebViewImpl.cpp#newcode1747 Source/web/WebViewImpl.cpp:1747: if (frame && frame->isLocalFrame()) { ...
6 years, 4 months ago (2014-08-07 03:03:07 UTC) #15
yoichio
Ping.
6 years, 4 months ago (2014-08-08 00:31:40 UTC) #16
esprehn
Please don't depend on calling into VisiblePosition for layout, add an explicit one instead. I ...
6 years, 4 months ago (2014-08-08 23:31:29 UTC) #17
esprehn
ou shouldn't need to explain how commit works in the description. What does "Unfortunately, webkit_tests ...
6 years, 4 months ago (2014-08-08 23:34:49 UTC) #18
yoichio
> What does "Unfortunately, webkit_tests is under single thread so we can't > confirm the ...
6 years, 4 months ago (2014-08-09 01:47:41 UTC) #19
abarth-chromium
> abarth@ What's the right spot to do the invalidation for carets? Presumably during InPaintInvalidation ...
6 years, 4 months ago (2014-08-09 19:03:30 UTC) #20
abarth-chromium
https://codereview.chromium.org/431983005/diff/200001/Source/web/WebViewImpl.cpp File Source/web/WebViewImpl.cpp (right): https://codereview.chromium.org/431983005/diff/200001/Source/web/WebViewImpl.cpp#newcode1748 Source/web/WebViewImpl.cpp:1748: toLocalFrame(frame)->selection().recomputeCaretRect(); This is much too early. What if the ...
6 years, 4 months ago (2014-08-09 19:05:09 UTC) #21
yoichio
We invalidate for caret in FrameSelection::updateAppearance for now. This CL targets reducing the invalidation calling ...
6 years, 4 months ago (2014-08-10 00:44:27 UTC) #22
yoichio
> Sorry, I should use updateLocalRect instead of recomputeCaretRect. I should use recomputeCaretRect(NotInvalidation) instead of ...
6 years, 4 months ago (2014-08-10 02:15:44 UTC) #23
yoichio
Ping.
6 years, 4 months ago (2014-08-11 12:44:31 UTC) #24
yoichio
On 2014/08/11 12:44:31, yoichio wrote: > Ping. PTAL. Elliott?
6 years, 4 months ago (2014-08-11 23:25:09 UTC) #25
abarth-chromium
Can we structure this code in the same way as repaint after layout? The FrameSelection ...
6 years, 4 months ago (2014-08-11 23:37:59 UTC) #26
yoichio
On 2014/08/11 23:37:59, abarth wrote: > Can we structure this code in the same way ...
6 years, 4 months ago (2014-08-12 01:15:56 UTC) #27
abarth-chromium
On 2014/08/12 at 01:15:56, yoichio wrote: > On 2014/08/11 23:37:59, abarth wrote: > > Can ...
6 years, 4 months ago (2014-08-12 02:02:22 UTC) #28
yoichio
> > No, we can't. > > That's because layout is triggered by FrameSelection::invalidateCaretRect for ...
6 years, 4 months ago (2014-08-12 02:36:34 UTC) #29
abarth-chromium
On 2014/08/12 at 02:36:34, yoichio wrote: > You mean the InPaintInvalidation phase is in FrameView::invalidateTreeIfNeededRecursive, ...
6 years, 4 months ago (2014-08-12 03:49:50 UTC) #30
yoichio
> Presumably we're able to draw content on the screen without invalidateCaretRect. I got. Thank ...
6 years, 4 months ago (2014-08-12 18:58:56 UTC) #31
abarth-chromium
> The FrameSelection remembers the previous rect for the caret. ^^^ Where is this done?
6 years, 4 months ago (2014-08-12 19:35:14 UTC) #32
abarth-chromium
https://codereview.chromium.org/431983005/diff/300001/Source/core/frame/FrameView.cpp File Source/core/frame/FrameView.cpp (right): https://codereview.chromium.org/431983005/diff/300001/Source/core/frame/FrameView.cpp#newcode1003 Source/core/frame/FrameView.cpp:1003: frame->selection().invalidateCaretRect(); Suppose the caret moved from one LocalFrame to ...
6 years, 4 months ago (2014-08-12 19:36:25 UTC) #33
abarth-chromium
Here's a complete design: 1. The FrameSelection remembers the previous rect for the caret. 2. ...
6 years, 4 months ago (2014-08-12 19:45:59 UTC) #34
yoichio
PTAL. > 1. The FrameSelection remembers the previous rect for the caret. FrameSelection::m_previouseCaretRect(and m_previouseCaretNode) does. ...
6 years, 4 months ago (2014-08-13 19:58:33 UTC) #35
yoichio
https://codereview.chromium.org/431983005/diff/300001/Source/core/frame/FrameView.cpp File Source/core/frame/FrameView.cpp (right): https://codereview.chromium.org/431983005/diff/300001/Source/core/frame/FrameView.cpp#newcode1003 Source/core/frame/FrameView.cpp:1003: frame->selection().invalidateCaretRect(); On 2014/08/12 19:36:25, abarth wrote: > Suppose the ...
6 years, 4 months ago (2014-08-13 20:05:28 UTC) #36
abarth-chromium
https://codereview.chromium.org/431983005/diff/320002/Source/core/editing/FrameSelection.cpp File Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/431983005/diff/320002/Source/core/editing/FrameSelection.cpp#newcode1269 Source/core/editing/FrameSelection.cpp:1269: RenderObject* renderer; = 0 https://codereview.chromium.org/431983005/diff/320002/Source/core/editing/FrameSelection.cpp#newcode1277 Source/core/editing/FrameSelection.cpp:1277: ASSERT(m_frame->document()->renderView()); There no ...
6 years, 4 months ago (2014-08-13 20:42:45 UTC) #37
yoichio
https://codereview.chromium.org/431983005/diff/320002/Source/core/editing/FrameSelection.cpp File Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/431983005/diff/320002/Source/core/editing/FrameSelection.cpp#newcode1269 Source/core/editing/FrameSelection.cpp:1269: RenderObject* renderer; On 2014/08/13 20:42:44, abarth wrote: > = ...
6 years, 4 months ago (2014-08-13 21:43:33 UTC) #38
abarth-chromium
LGTM Thanks for iterating on this CL. I suspect there are still things we could ...
6 years, 4 months ago (2014-08-13 22:01:24 UTC) #39
yoichio
The CQ bit was checked by yoichio@chromium.org
6 years, 4 months ago (2014-08-13 22:35:56 UTC) #40
yoichio
Thank you your kindness reviews! https://codereview.chromium.org/431983005/diff/350001/Source/core/editing/FrameSelection.cpp File Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/431983005/diff/350001/Source/core/editing/FrameSelection.cpp#newcode1236 Source/core/editing/FrameSelection.cpp:1236: m_frame->document()->updateLayoutIgnorePendingStylesheets(); On 2014/08/13 22:01:24, ...
6 years, 4 months ago (2014-08-13 22:36:33 UTC) #41
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yoichio@chromium.org/431983005/370001
6 years, 4 months ago (2014-08-13 22:37:13 UTC) #42
abarth-chromium
On 2014/08/13 at 22:36:33, yoichio wrote: > No. Removed. You might want to add an ...
6 years, 4 months ago (2014-08-13 22:55:18 UTC) #43
yoichio
The CQ bit was unchecked by yoichio@chromium.org
6 years, 4 months ago (2014-08-13 22:56:22 UTC) #44
yoichio
On 2014/08/13 22:55:18, abarth wrote: > On 2014/08/13 at 22:36:33, yoichio wrote: > > No. ...
6 years, 4 months ago (2014-08-13 23:38:31 UTC) #45
yoichio
Use m_previousCaretRect to paintCaret instead of localCaretRectWithoutUpdate(), which is not updated until we call absoluteCaretBounds(). ...
6 years, 4 months ago (2014-08-14 09:29:23 UTC) #46
yoichio
In my short investigation, FrameSelection::absoluteCaretBounds is called when the lifecycle is StyleClean or LayoutClean or ...
6 years, 4 months ago (2014-08-14 09:31:36 UTC) #47
yoichio
The CQ bit was checked by yoichio@chromium.org
6 years, 4 months ago (2014-08-14 09:31:53 UTC) #48
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yoichio@chromium.org/431983005/410001
6 years, 4 months ago (2014-08-14 09:32:45 UTC) #49
yoichio
The CQ bit was unchecked by yoichio@chromium.org
6 years, 4 months ago (2014-08-14 10:09:59 UTC) #50
yoichio
The CQ bit was checked by yoichio@chromium.org
6 years, 4 months ago (2014-08-14 12:25:24 UTC) #51
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yoichio@chromium.org/431983005/450001
6 years, 4 months ago (2014-08-14 12:26:30 UTC) #52
yoichio
Sorry for my confusing comments. Updates from the abarth@'s LGTM are: - Add Rebaselines instead ...
6 years, 4 months ago (2014-08-14 12:34:05 UTC) #53
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: android_blink_compile_dbg on tryserver.blink ...
6 years, 4 months ago (2014-08-14 14:12:24 UTC) #54
commit-bot: I haz the power
6 years, 4 months ago (2014-08-14 15:23:38 UTC) #55
Message was sent while issue was closed.
Committed patchset #12 (450001) as 180269

Powered by Google App Engine
This is Rietveld 408576698