Testcase at <https://codepen.io/ShaneHudson/pen/bGpeVPG> shows an issue where the selection is not clipped to the bounds of the text input.
<rdar://problem/67404979>
Noted at https://twitter.com/ShaneHudson/status/1296078597652914177
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].