Summary: | Programmatic selection of text in a text field causes the highlight overlay to spill out | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Simon Fraser (smfr) <simon.fraser> | ||||||
Component: | HTML Editing | Assignee: | Wenson Hsieh <wenson_hsieh> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | cdumez, changseok, darin, esprehn+autocc, ews-watchlist, gyuyoung.kim, megan_gardner, mifenton, simon.fraser, thorton, webkit-bug-importer, wenson_hsieh | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | Safari Technology Preview | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
URL: | https://codepen.io/ShaneHudson/pen/bGpeVPG | ||||||||
Attachments: |
|
Description
Simon Fraser (smfr)
2020-08-19 08:31:54 PDT
This is likely because -[WKContentView _selectionClipRect] returns the null rect, since we're not showing any input view for a focused element. (Note: one way to work around this is to programmatically focus() the readonly input before calling select() on it) Created attachment 407080 [details]
Patch
Comment on attachment 407080 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=407080&action=review > Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:796 > + auto selectionClipRect = [(UIView <UITextInputPrivate> *)contentView _selectionClipRect]; Casting to a type with a protocol without checking if the view implements the protocol seems peculiar. Normally we’d call respondsToProtocol in a case like this. Alternatively we could assert that and comment why we know it’s true. Or could leave it just like this if you prefer. Comment on attachment 407080 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=407080&action=review Thanks for the review! >> Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:796 >> + auto selectionClipRect = [(UIView <UITextInputPrivate> *)contentView _selectionClipRect]; > > Casting to a type with a protocol without checking if the view implements the protocol seems peculiar. Normally we’d call respondsToProtocol in a case like this. Alternatively we could assert that and comment why we know it’s true. Or could leave it just like this if you prefer. Sounds good — I'll add an assertion and comment here. Created attachment 407082 [details]
Patch
Committed r266051: <https://trac.webkit.org/changeset/266051> All reviewed patches have been landed. Closing bug and clearing flags on attachment 407082 [details]. |