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

Issue 1605863002: Restart search in page when new text is found. (Closed)

Created:
4 years, 11 months ago by dvadym
Modified:
4 years, 10 months ago
CC:
blink-reviews, blink-reviews-api_chromium.org, chromium-reviews, creis+watch_chromium.org, darin-cc_chromium.org, dcheng, dglazkov+blink, jam, mkwst+moarreviews-renderer_chromium.org, mlamouri+watch-blink_chromium.org, mlamouri+watch-content_chromium.org, nasko+codewatch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Restart search in page when new text is found. This patch is a partial solution to the problem, when DOM was changed and Find Next In Page fails to show correct results that corresponding to the current DOM. For context, some details how Find in Page works: 1. When the user initializes new search RenderFrameImpl::OnFind is called, in order not to block UI it quickly returns the first result and schedules new full search task (it's called scoping request in code). 2. The full search task runs and adds all occurrences of the searched text as markers in DocumentMarkerController. These markers are presented to the user as search results. 3. When the user starts FindNext in browser, again RenderFrameImpl::OnFind is called, it runs search from the place of previous search result and in TextFinder it's called DocumentMarkerController::setMarkersActive to set the current result. No new markers to DocumentMarkerController are added. Current FindNext implementation (TextFinder) uses current DOM and gives correct results, the problem is that DocumentMarkerController::setMarkersActive silently fails to add marker when it receives a search result in content that was added after full search in 2. The proposed solution in this patch: 1. When DocumentMarkerController::setMarkersActive fails to find marker that corresponds to a current FindNext result (that means that it's new part of DOM, that was loaded after the initial full search), it adds this result range as active marker and returns false to TextFinder. 2. TextFinder receives information that the new text found, it stores restore point to the following full search (so search will continue from the same place). And returns to RenderFrameImpl activeNow=false. 3. RenderFrameImpl receives that activeNow=false restarts full search (in a separate task, the same as with original search). This patch doesn't solve all problems, namely 1. In order to see new results the user should use FindNext till new results are found. 2. If something is removed from DOM, new search is not restarted (it's hard to find out about this from DocumentMarkerController), so the user will see incorrect number of results, but the user will still see correct highlighted search results in a page (the same behaviour as now). but it makes problems much less severe. BUG=2220 Committed: https://crrev.com/22cbbba006181412d51841e6bf3a7b53d9b653df Cr-Commit-Position: refs/heads/master@{#376994}

Patch Set 1 #

Patch Set 2 : Rebase, clean-up #

Total comments: 10

Patch Set 3 : Uncommenting tests, cleaning logic #

Patch Set 4 : Rebase #

Patch Set 5 : Rebase #

Patch Set 6 : Rebase fix #

Patch Set 7 : Compilation fix #

Patch Set 8 : Tests added #

Patch Set 9 : Renaming, clean-up #

Patch Set 10 : Clean up #

Patch Set 11 : small clean up #

Total comments: 12

Patch Set 12 : Reviewer's comments addressed #

Patch Set 13 : Tiny style fix #

Patch Set 14 : Rebase #

Patch Set 15 : Rebase #

Total comments: 6

Patch Set 16 : Comments addressed #

Patch Set 17 : Rebase #

Total comments: 4

Patch Set 18 : Comments addressed #

Patch Set 19 : Rebase and added "==nullptr" in WebLocalFrameImpl #

Patch Set 20 : Rebase #

Total comments: 2

Patch Set 21 : Added default value for local var #

Unified diffs Side-by-side diffs Delta from patch set Stats (+159 lines, -28 lines) Patch
M content/renderer/render_frame_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +6 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +4 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +10 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +17 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/web/TextFinder.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +4 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/web/TextFinder.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +14 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/web/WebLocalFrameImpl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/web/WebLocalFrameImpl.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/web/tests/TextFinderTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +52 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/web/tests/WebFrameTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +47 lines, -0 lines 0 comments Download
M third_party/WebKit/public/web/WebLocalFrame.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 57 (24 generated)
dvadym
Hi Finnur, Could you please have a look at this CL? This CL is revive ...
4 years, 11 months ago (2016-01-20 12:04:09 UTC) #8
Finnur
Do you have a good sense of why the current tests are failing?
4 years, 11 months ago (2016-01-20 13:24:56 UTC) #9
dvadym
On 2016/01/20 13:24:56, Finnur wrote: > Do you have a good sense of why the ...
4 years, 11 months ago (2016-01-20 13:33:58 UTC) #10
Finnur
Haven't looked at the code yet, so maybe this doesn't apply -- but I'm just ...
4 years, 11 months ago (2016-01-20 13:40:18 UTC) #11
dvadym
> 2.If something is removed from DOM, new search is not restarted (it's hard to ...
4 years, 11 months ago (2016-01-20 13:54:21 UTC) #12
Finnur
I would be OK with making an interface change along those lines (see the nits, ...
4 years, 11 months ago (2016-01-20 14:14:03 UTC) #13
Finnur
> In Principle yes, but as far I can see it will require much more ...
4 years, 11 months ago (2016-01-20 14:15:34 UTC) #14
Finnur
Meant to say: The initial version of Find didn't have the DocumentMarker support *from* Webkit...
4 years, 11 months ago (2016-01-20 14:27:13 UTC) #15
dvadym
Hi Finnur, Thanks a lot for comments! I've addressed all of them and made some ...
4 years, 10 months ago (2016-01-29 09:44:17 UTC) #17
Finnur
LGTM, modulo nits. Thanks for doing this! > 3.RenderViewImpl receives that activeNow=true You mean: activeNow ...
4 years, 10 months ago (2016-01-29 17:47:50 UTC) #21
dvadym
Thanks Finnur for comments! I've addressed them. > You mean: activeNow = false, right? Sure, ...
4 years, 10 months ago (2016-02-01 12:41:10 UTC) #23
Finnur
Thanks. Still LGTM.
4 years, 10 months ago (2016-02-01 13:13:14 UTC) #24
dvadym
Hi Jochen, Could you please review this CL? Regards, Vadym
4 years, 10 months ago (2016-02-01 13:40:47 UTC) #26
jochen (gone - plz use gerrit)
esprehn@ is a better reviewer for this
4 years, 10 months ago (2016-02-01 14:29:48 UTC) #28
dvadym
esprehn@ Could you please review this CL?
4 years, 10 months ago (2016-02-01 15:43:49 UTC) #29
dvadym
Hi esprehn, friendly ping. Could you please have a look at this CL?
4 years, 10 months ago (2016-02-09 17:35:31 UTC) #31
esprehn
I don't think this is a good solution, you should use the dom tree version ...
4 years, 10 months ago (2016-02-10 01:17:08 UTC) #34
dvadym
Thanks for comments esprehn! PTAL Yeah I agree that listening DOM changes are ultimate solution ...
4 years, 10 months ago (2016-02-10 16:06:21 UTC) #35
Finnur
Perfect is the enemy of good. I'm supportive of this patch because it solves an ...
4 years, 10 months ago (2016-02-11 10:08:01 UTC) #36
Charlie Reis
On 2016/02/11 10:08:01, Finnur wrote: > Perfect is the enemy of good. > > I'm ...
4 years, 10 months ago (2016-02-11 19:44:31 UTC) #38
paulmeyer
On 2016/02/11 19:44:31, Charlie Reis wrote: > On 2016/02/11 10:08:01, Finnur wrote: > > Perfect ...
4 years, 10 months ago (2016-02-11 22:29:58 UTC) #39
paulmeyer
https://codereview.chromium.org/1605863002/diff/320001/third_party/WebKit/Source/web/TextFinder.cpp File third_party/WebKit/Source/web/TextFinder.cpp (right): https://codereview.chromium.org/1605863002/diff/320001/third_party/WebKit/Source/web/TextFinder.cpp#newcode166 third_party/WebKit/Source/web/TextFinder.cpp:166: bool isActive = setMarkerActive(m_activeMatch.get(), true); nit: Please move this ...
4 years, 10 months ago (2016-02-12 13:58:49 UTC) #40
dvadym
Thanks Paul for comments! I've addressed them. https://codereview.chromium.org/1605863002/diff/320001/third_party/WebKit/Source/web/TextFinder.cpp File third_party/WebKit/Source/web/TextFinder.cpp (right): https://codereview.chromium.org/1605863002/diff/320001/third_party/WebKit/Source/web/TextFinder.cpp#newcode166 third_party/WebKit/Source/web/TextFinder.cpp:166: bool isActive ...
4 years, 10 months ago (2016-02-12 16:46:06 UTC) #41
dvadym
Hi esprehn, friendly ping. Could you please have another look at this CL?
4 years, 10 months ago (2016-02-17 13:06:29 UTC) #42
esprehn
Should active_now be called markers_found? I think this feels like technical debt, and we should ...
4 years, 10 months ago (2016-02-18 19:16:03 UTC) #43
dglazkov
FWIW, I agree on technical debt and this needing proper ownership. I won't stand in ...
4 years, 10 months ago (2016-02-18 19:19:22 UTC) #44
dvadym
On 2016/02/18 19:16:03, esprehn wrote: > Should active_now be called markers_found? > > I think ...
4 years, 10 months ago (2016-02-19 17:07:40 UTC) #45
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1605863002/380001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1605863002/380001
4 years, 10 months ago (2016-02-23 14:34:21 UTC) #48
jochen (gone - plz use gerrit)
content lgtm with comment https://codereview.chromium.org/1605863002/diff/380001/content/renderer/render_frame_impl.cc File content/renderer/render_frame_impl.cc (right): https://codereview.chromium.org/1605863002/diff/380001/content/renderer/render_frame_impl.cc#newcode5062 content/renderer/render_frame_impl.cc:5062: bool active_now; please add a ...
4 years, 10 months ago (2016-02-23 14:34:26 UTC) #49
dvadym
Thanks Jochen for comments! https://codereview.chromium.org/1605863002/diff/380001/content/renderer/render_frame_impl.cc File content/renderer/render_frame_impl.cc (right): https://codereview.chromium.org/1605863002/diff/380001/content/renderer/render_frame_impl.cc#newcode5062 content/renderer/render_frame_impl.cc:5062: bool active_now; On 2016/02/23 14:34:26, ...
4 years, 10 months ago (2016-02-23 14:39:36 UTC) #51
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1605863002/400001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1605863002/400001
4 years, 10 months ago (2016-02-23 15:23:29 UTC) #54
commit-bot: I haz the power
Committed patchset #21 (id:400001)
4 years, 10 months ago (2016-02-23 15:49:22 UTC) #55
commit-bot: I haz the power
4 years, 10 months ago (2016-02-23 15:51:41 UTC) #57
Message was sent while issue was closed.
Patchset 21 (id:??) landed as
https://crrev.com/22cbbba006181412d51841e6bf3a7b53d9b653df
Cr-Commit-Position: refs/heads/master@{#376994}

Powered by Google App Engine
This is Rietveld 408576698