WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
201775
FindController::findString always updates foundStringMatchIndex even if match is the same as before
https://bugs.webkit.org/show_bug.cgi?id=201775
Summary
FindController::findString always updates foundStringMatchIndex even if match...
mmokary
Reported
2019-09-13 14:27:44 PDT
FindController::findString will always either increment or decrement the match index. This is incorrect when the highlighted match is the same as before. For example, say the search string "Hello" highlights some text in the sentence "Hello, world.". Match count is (for example) 10 and match index is 0. All is well. The search is refined to "Hello, world" and the highlighted area is expanded according to the larger match range, but does not move to a different match on the page. The match index increments to 1 despite highlighting the same match as before.
Attachments
Patch
(7.16 KB, patch)
2019-10-04 16:41 PDT
,
mmokary
no flags
Details
Formatted Diff
Diff
Patch
(8.22 KB, patch)
2019-10-07 11:36 PDT
,
mmokary
no flags
Details
Formatted Diff
Diff
Patch
(7.71 KB, patch)
2019-10-07 12:51 PDT
,
mmokary
no flags
Details
Formatted Diff
Diff
Patch
(7.84 KB, patch)
2019-10-07 13:16 PDT
,
mmokary
no flags
Details
Formatted Diff
Diff
Patch
(6.19 KB, patch)
2019-10-14 13:20 PDT
,
mmokary
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2019-09-13 14:27:58 PDT
<
rdar://problem/55352425
>
mmokary
Comment 2
2019-10-04 16:41:22 PDT
Created
attachment 380265
[details]
Patch
Tim Horton
Comment 3
2019-10-04 16:59:32 PDT
Comment on
attachment 380265
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=380265&action=review
> Source/WebCore/ChangeLog:10 > + Add NoIndexChange find option flag
No indentation
> Source/WebKit/ChangeLog:22 > + Do not change match index if NoIndexChange bit is set. Otherwise, no change in behavior.
This is indented wrong
> Source/WebKit/Shared/WebFindOptions.h:39 > + FindOptionsNoIndexChange = 1 << 8,
It's not a problem in this case, but a bit odd to add to the middle of an enum.
> Source/WebKit/WebProcess/WebPage/FindController.cpp:70 > + if (options & FindOptionsNoIndexChange) > + result.add(WebCore::NoIndexChange);
You can avoid the WebCore change and the core() change; nothing ever uses this option in WebCore, right?
Tim Horton
Comment 4
2019-10-04 17:00:26 PDT
I bet you can write an API test for this; peek at TestWebKitAPI's WKWebViewFindString.mm (or maybe one of the others).
mmokary
Comment 5
2019-10-07 11:36:23 PDT
Created
attachment 380341
[details]
Patch
Tim Horton
Comment 6
2019-10-07 12:16:41 PDT
Looks like the API test fails
mmokary
Comment 7
2019-10-07 12:51:52 PDT
Created
attachment 380345
[details]
Patch
mmokary
Comment 8
2019-10-07 12:52:57 PDT
(In reply to Tim Horton from
comment #6
)
> Looks like the API test fails
Added test to old API -- oops. This run should be good.
mmokary
Comment 9
2019-10-07 13:16:11 PDT
Created
attachment 380349
[details]
Patch
Tim Horton
Comment 10
2019-10-11 10:15:16 PDT
Comment on
attachment 380349
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=380349&action=review
> Source/WebKit/Shared/API/c/WKFindOptions.h:44 > + kWKFindOptionsShowHighlight = 1 << 7, > + kWKFindOptionsNoIndexChange = 1 << 8
You shouldn't have to add this
> Source/WebKit/Shared/API/c/WKSharedAPICast.h:772 > + if (wkFindOptions & kWKFindOptionsNoIndexChange) > + findOptions |= FindOptionsNoIndexChange;
Or this.
> Source/WebKit/Shared/WebFindOptions.h:40 > + FindOptionsNoIndexChange = 1 << 8, > + FindOptionsDetermineMatchIndex = 1 << 9,
Technically fine in this case because it's internal only but still weird to add things in the middle of the enum.
> Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewFindString.mm:192 > + [firstWebView _findString:@"hello" options:findOptions maxCount:maxCount];
This is ObjC API so it should always take ObjC API enums (_WKFindOptions and _WKFindOptionsNoIndexChange). What went wrong that you have to use the C API constant?! Looking at the implementation of _findString:options:maxCount: in WKWebView, it uses the toFindOptions() function that's right above it, which goes from _WKFindOptions->WebKit::FindOptions, so I think this is just wrong.
mmokary
Comment 11
2019-10-14 13:20:10 PDT
Created
attachment 380909
[details]
Patch
WebKit Commit Bot
Comment 12
2019-10-14 16:42:46 PDT
Comment on
attachment 380909
[details]
Patch Clearing flags on attachment: 380909 Committed
r251111
: <
https://trac.webkit.org/changeset/251111
>
WebKit Commit Bot
Comment 13
2019-10-14 16:42:47 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug