Bug 197746

Summary: [iOS] Lazily request keyboard on first hardware keydown when a non-editable element is focused
Product: WebKit Reporter: Daniel Bates <dbates>
Component: WebKit Misc.Assignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, ews-watchlist, megan_gardner, pvollan, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar, PlatformOnly
Version: WebKit Local Build   
Hardware: iPhone / iPad   
OS: iOS 12   
See Also: https://bugs.webkit.org/show_bug.cgi?id=197745
https://bugs.webkit.org/show_bug.cgi?id=199807
Bug Depends on:    
Bug Blocks: 190571    
Attachments:
Description Flags
Patch
none
Patch
none
To Land none

Description Daniel Bates 2019-05-09 11:27:24 PDT
In bug #197745 we made keyboard instantiation lazy: we always create one if a hardware keyboard is attached OR a content editable element is focused. We can be even lazier! Specifically the first disjunct can be even lazier. So, I think we only need to create a keyboard if any of the following are satisfied:

a. a non-editable element is focused AND we receive *one* hardware keydown event.
   ii. Take care to reset this on hardware keyboard availability changes. Side note, we could even reduce memory footprint here by tearing down the keyboard here when switching from attached to detached ONLY in the non-editable element case.
b. an editable element is focused (obvious, right?)
Comment 1 Radar WebKit Bug Importer 2019-05-09 11:42:50 PDT
<rdar://problem/50630406>
Comment 2 Daniel Bates 2019-05-09 12:26:39 PDT
Created attachment 369511 [details]
Patch
Comment 3 Daniel Bates 2019-05-09 12:27:30 PDT
Comment on attachment 369511 [details]
Patch

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

> Source/WebKit/ChangeLog:10
> +        Be even lazier. We only need to create a keyboard if an editable element is focused or on
> +        the first hardware keydown when a non-editable element is focused.

Note that we already do the former. This patch is about the latter.
Comment 4 Daniel Bates 2019-05-09 12:32:34 PDT
Created attachment 369512 [details]
Patch
Comment 5 EWS Watchlist 2019-05-09 12:33:42 PDT
Attachment 369512 [details] did not pass style-queue:


ERROR: Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:1673:  Line contains only semicolon. If this should be an empty statement, use { } instead.  [whitespace/semicolon] [5]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Brent Fulgham 2019-05-09 12:38:32 PDT
Comment on attachment 369512 [details]
Patch

r=me
Comment 7 Daniel Bates 2019-05-09 13:18:06 PDT
Created attachment 369519 [details]
To Land
Comment 8 Daniel Bates 2019-05-09 13:18:48 PDT
Comment on attachment 369519 [details]
To Land

Clearing flags on attachment: 369519

Committed r245154: <https://trac.webkit.org/changeset/245154>
Comment 9 Daniel Bates 2019-05-09 13:18:49 PDT
All reviewed patches have been landed.  Closing bug.