RESOLVED FIXED 183648
[iOS WK2] Hit-testing fails when specifying a large top content inset
https://bugs.webkit.org/show_bug.cgi?id=183648
Summary [iOS WK2] Hit-testing fails when specifying a large top content inset
Wenson Hsieh
Reported 2018-03-14 16:54:15 PDT
To reproduce: - Make a WKWebView - Set the WKWebView's scrollView's contentInset to something like UIEdgeInsetsMake(500, 0, 0, 0) - Load a page with clickable elements, such as links or buttons - Scroll so that the links or buttons are in view - Try to tap on them Expected: elements should be clicked Observed: elements are not clicked Tested on latest iOS 11.3 beta.
Attachments
Patch (28.82 KB, patch)
2018-03-14 20:28 PDT, Wenson Hsieh
no flags
Wenson Hsieh
Comment 1 2018-03-14 18:09:48 PDT
WKWebView conflates obscured insets (which cover parts of the viewport) with content insets (which allow scrolling beyond content bounds in a scroll view). This manifests in incorrect behavior when computing the unobscured content rect if the web view's scrollview has a top content inset, since we'll think that there's a region as tall as the content inset that obscures the viewport, when in fact, the viewport isn't obscured. This causes all hit-testing in this region to fail because FrameView::visibleContentRect is wrong.
Wenson Hsieh
Comment 2 2018-03-14 18:18:49 PDT
It appears this bug has existed since the early days of WebKit2 (see: <http://trac.webkit.org/changeset/170361>). It also seems others have also run into this before: https://stackoverflow.com/questions/27755251/wkwebview-isnt-clickable-outside-its-contentinset
Wenson Hsieh
Comment 3 2018-03-14 18:25:19 PDT
Wenson Hsieh
Comment 4 2018-03-14 20:28:37 PDT
Wenson Hsieh
Comment 5 2018-03-15 13:24:54 PDT
Comment on attachment 335827 [details] Patch Thanks for the review!
WebKit Commit Bot
Comment 6 2018-03-15 13:50:08 PDT
Comment on attachment 335827 [details] Patch Clearing flags on attachment: 335827 Committed r229641: <https://trac.webkit.org/changeset/229641>
WebKit Commit Bot
Comment 7 2018-03-15 13:50:09 PDT
All reviewed patches have been landed. Closing bug.
Blaze Burg
Comment 8 2018-03-20 13:23:25 PDT
πŸ‘πŸΌπŸ‘πŸΌπŸ‘πŸΌ
Brady Eidson
Comment 9 2019-08-21 17:09:48 PDT
*** Bug 153439 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.