Bug 178789 - Make iOS Find UI reveal matches in scrollable elements
Summary: Make iOS Find UI reveal matches in scrollable elements
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Frédéric Wang (:fredw)
URL:
Keywords: InRadar
Depends on:
Blocks: 183658
  Show dependency treegraph
 
Reported: 2017-10-25 06:54 PDT by Frédéric Wang (:fredw)
Modified: 2018-10-25 05:40 PDT (History)
5 users (show)

See Also:


Attachments
Patch (1.91 KB, patch)
2017-10-25 06:57 PDT, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
Patch (tentative test) (2.94 KB, patch)
2017-10-26 04:12 PDT, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
Patch (12.61 KB, patch)
2017-10-27 07:31 PDT, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
Patch (12.32 KB, patch)
2017-11-01 11:41 PDT, Frédéric Wang (:fredw)
thorton: review+
Details | Formatted Diff | Diff
Patch (try to implement findString in DumpRenderTree) (2.05 KB, patch)
2018-10-25 05:40 PDT, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Wang (:fredw) 2017-10-25 06:54:53 PDT
Make iOS Find UI reveal matches in scrollable elements
Comment 1 Frédéric Wang (:fredw) 2017-10-25 06:57:16 PDT
Created attachment 324816 [details]
Patch
Comment 2 Frédéric Wang (:fredw) 2017-10-25 07:00:35 PDT
For some test cases, see attachment 308089 [details] and attachment 312006 [details]
Comment 3 Alexey Proskuryakov 2017-10-25 10:28:16 PDT
Comment on attachment 324816 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=324816&action=review

> Source/WebKit/ChangeLog:3
> +        Make iOS Find UI reveal matches in scrollable elements

Can a test be made for this change?
Comment 4 Frédéric Wang (:fredw) 2017-10-25 10:40:37 PDT
(In reply to Alexey Proskuryakov from comment #3)
> Comment on attachment 324816 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=324816&action=review
> 
> > Source/WebKit/ChangeLog:3
> > +        Make iOS Find UI reveal matches in scrollable elements
> 
> Can a test be made for this change?

It seems that old changes in this part of the code do not have tests...  I can test manually, but I'm not sure how to do it in the test runner. Does anyone know how to simulate opening the Find UI and searching some text?

Also, note that window.find does not follow the same code path (bug 163911 comment 18) so it does not make sense to use that API to test this change.
Comment 5 Frédéric Wang (:fredw) 2017-10-26 04:12:39 PDT
Created attachment 324985 [details]
Patch (tentative test)
Comment 6 Frédéric Wang (:fredw) 2017-10-26 04:18:32 PDT
Comment on attachment 324816 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=324816&action=review

>>> Source/WebKit/ChangeLog:3
>>> +        Make iOS Find UI reveal matches in scrollable elements
>> 
>> Can a test be made for this change?
> 
> It seems that old changes in this part of the code do not have tests...  I can test manually, but I'm not sure how to do it in the test runner. Does anyone know how to simulate opening the Find UI and searching some text?
> 
> Also, note that window.find does not follow the same code path (bug 163911 comment 18) so it does not make sense to use that API to test this change.

I tried again today. It seems that the test runner webview does not have the same UI as Safari. Trying to send Cmd+F with eventSender fails (see attachment 324985 [details]). In Safari, we can also use the "Share" menu to execute "Find in Page" but again that UI is not visible in the test runner webview. Finally, I also tried the command document.execCommand("FindString", true, "match") but again, it follows a different code path and won't allow to test that change (see bug 163911 comment 19).
Comment 7 Tim Horton 2017-10-26 09:22:52 PDT
(In reply to Frédéric Wang (:fredw) from comment #6)
> Comment on attachment 324816 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=324816&action=review
> 
> >>> Source/WebKit/ChangeLog:3
> >>> +        Make iOS Find UI reveal matches in scrollable elements
> >> 
> >> Can a test be made for this change?
> > 
> > It seems that old changes in this part of the code do not have tests...  I can test manually, but I'm not sure how to do it in the test runner. Does anyone know how to simulate opening the Find UI and searching some text?
> > 
> > Also, note that window.find does not follow the same code path (bug 163911 comment 18) so it does not make sense to use that API to test this change.
> 
> I tried again today. It seems that the test runner webview does not have the
> same UI as Safari. Trying to send Cmd+F with eventSender fails (see
> attachment 324985 [details]). In Safari, we can also use the "Share" menu to
> execute "Find in Page" but again that UI is not visible in the test runner
> webview. Finally, I also tried the command
> document.execCommand("FindString", true, "match") but again, it follows a
> different code path and won't allow to test that change (see bug 163911
> comment 19).

Like smfr said in the other bug, you probably want a UIScriptController function that invokes WKWebView's _findString:options:maxCount:
Comment 8 Frédéric Wang (:fredw) 2017-10-27 07:31:12 PDT
Created attachment 325159 [details]
Patch
Comment 9 Frédéric Wang (:fredw) 2017-10-27 07:33:17 PDT
(In reply to Tim Horton from comment #7)
> Like smfr said in the other bug, you probably want a UIScriptController
> function that invokes WKWebView's _findString:options:maxCount:

Thanks Tim. I uploaded a new patch with a test to check the effect of the change.
Comment 10 Tim Horton 2017-11-01 10:37:03 PDT
Comment on attachment 325159 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=325159&action=review

> Source/WebKit/WebProcess/WebPage/FindController.cpp:254
> +#if PLATFORM(IOS)

Can we hide this in FindControllerIOS instead? Maybe in didFindString?
Comment 11 Frédéric Wang (:fredw) 2017-11-01 11:41:24 PDT
Created attachment 325603 [details]
Patch
Comment 12 Frédéric Wang (:fredw) 2017-11-01 11:44:13 PDT
Comment on attachment 325159 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=325159&action=review

>> Source/WebKit/WebProcess/WebPage/FindController.cpp:254
>> +#if PLATFORM(IOS)
> 
> Can we hide this in FindControllerIOS instead? Maybe in didFindString?

Right, thanks. Done in the latest patch.
Comment 13 Frédéric Wang (:fredw) 2017-11-01 11:50:45 PDT
Committed r224284: <https://trac.webkit.org/changeset/224284>
Comment 14 Radar WebKit Bug Importer 2017-11-15 12:47:49 PST
<rdar://problem/35568141>
Comment 15 Frédéric Wang (:fredw) 2018-10-25 05:40:11 PDT
Created attachment 353082 [details]
Patch (try to implement findString in DumpRenderTree)

Simon had suggested to test scrolling on WK1. Just for the record, I'm attaching an attempt to implement UIScriptController::findString for DumpRenderTree's UIScriptControllerIOS. Unfortunately, WebKitLegacy's WebFindOptions does not have the ShowFindIndicator option required by find-text-in-overflow-node.html and WebView does not even expose findString (only the more limited searchFor function). So I believe we can not run this test on WK1.