RESOLVED FIXED 15780
WebFrameLoaderClient: WebActionElementKey wrong if view is scrolled
https://bugs.webkit.org/show_bug.cgi?id=15780
Summary WebFrameLoaderClient: WebActionElementKey wrong if view is scrolled
Justin Bur
Reported 2007-10-31 16:12:22 PDT
The actionDictionary sent to various WebPolicyDelegate methods is supposed to provide the element that has been clicked, under the WebActionElementKey. If the web view is scrolled, this element is calculated incorrectly. Reproduction: load a long document into a smallish frame. Set up a delegate that implements webView:decidePolicyForNavigationAction:request:frame:decisionListener:. Scroll down to the bottom of the page and click a link. In the delegate, examine [[actionInformation objectForKey:WebActionElementKey] WebElementDOMNodeKey]. The node returned will be distant from the actual mouse click by the same vertical amount as the view is scrolled. In WebFrameLoaderClient.mm (line 1117 as of writing, rev. 26758), method WebFrameLoaderClient::actionDictionary(), an IntPoint is constructed using mouseEvent->clientX() and mouseEvent->clientY(). These values do not take scrolling into account. An apparently correct result can be obtained if the IntPoint is constructed using mouseEvent->layerX() and mouseEvent->layerY(). The error seems to have been present since rev. 17597.
Attachments
test app (20.86 KB, application/zip)
2007-11-01 12:08 PDT, Justin Bur
no flags
Patch (1.51 KB, patch)
2007-11-02 04:51 PDT, Mark Rowe (bdash)
darin: review+
Mark Rowe (bdash)
Comment 1 2007-10-31 18:18:12 PDT
Is there any chance you can attach a simple application that demonstrates what you have described? It would make it a lot quicker to confirm the issue you have reported, and easier to get started on fixing it.
Justin Bur
Comment 2 2007-11-01 12:08:08 PDT
Created attachment 16984 [details] test app This tiny WebKit client highlights clicked links (setSelectedDOMRange:) instead of following them. It does so by using the broken WebActionElementKey. Notice the change in behavior when the WebView is scrolled. Scroll just a little to see the problem more clearly. The node returned in WebActionElementKey is also logged to console.
Mark Rowe (bdash)
Comment 3 2007-11-02 04:51:30 PDT
Mark Rowe (bdash)
Comment 4 2007-11-02 04:54:07 PDT
Thanks for the test case Justin.
Darin Adler
Comment 5 2007-11-02 07:06:27 PDT
Comment on attachment 16990 [details] Patch r=me
Mark Rowe (bdash)
Comment 6 2007-11-02 07:18:36 PDT
Landed in r27376.
Mark Rowe (bdash)
Comment 7 2008-01-21 19:10:19 PST
*** Bug 16960 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.