RESOLVED FIXED 99656
ASSERT in RenderLayer::hitTestContents can fire
https://bugs.webkit.org/show_bug.cgi?id=99656
Summary ASSERT in RenderLayer::hitTestContents can fire
Adam Barth
Reported 2012-10-17 16:46:27 PDT
ASSERT in RenderLayer::hitTestContents can fire
Attachments
Patch (4.94 KB, patch)
2012-10-17 16:48 PDT, Adam Barth
no flags
Some attempts at a test (624 bytes, text/html)
2012-10-17 17:36 PDT, Adam Barth
no flags
test case (312 bytes, text/html)
2012-10-28 21:03 PDT, Arun Patole
no flags
LayoutTest that hits the ASSERT (639 bytes, text/html)
2012-11-02 10:46 PDT, Adam Barth
no flags
Patch (7.10 KB, patch)
2012-11-02 10:59 PDT, Adam Barth
no flags
Adam Barth
Comment 1 2012-10-17 16:48:40 PDT
Adam Barth
Comment 2 2012-10-17 16:50:34 PDT
This patch comes from 6034d2de096bbdaf1be3474b0141c4d57094a956 in the chromium-android branch (for those with access to that source tree).
Adam Barth
Comment 3 2012-10-17 17:01:01 PDT
if (!renderer()->hitTest(request, result, hitTestLocation, toLayoutPoint(layerBounds.location() - renderBoxLocation()), hitTestFilter)) { // It's wrong to set innerNode, but then claim that you didn't hit anything, unless it is // a rect-based test. ASSERT(!result.innerNode() || (result.isRectBasedTest() && result.rectBasedTestResult().size())); return false; } Apparently that is the ASSERT that fires.
Adam Barth
Comment 4 2012-10-17 17:36:50 PDT
Created attachment 169313 [details] Some attempts at a test
Allan Sandfeld Jensen
Comment 5 2012-10-18 02:00:56 PDT
Comment on attachment 169298 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=169298&action=review The patch makes sense. This is is one of those cases that makes me think addNodeToRectBasedResult really should be called from inside updateHitTestResult(). > Source/WebCore/rendering/RenderBlock.h:570 > + Node* nodeForHitTest(); Could be const.
Arun Patole
Comment 6 2012-10-28 21:03:02 PDT
Created attachment 171151 [details] test case I could repro this issue on android JB stock browser and chromium content shell(I had some weeks old content shell code but not the latest one) with attached small test case. You need to touch exactly at the border of image element. Looks to be a problem when hit test point falls in anonymous block. As Adam rightly pointed out, Assert is because we are setting inner node of HitTestResult and also saying that HitTest doesn't found anything by returning false in HitTest function which is incorrect. This is happening because we are using different nodes in RenderBlock::nodeAtPoint and when setting innerNode in RenderBlock::updateHitTestResult. In RenderBlock::updateHitTestResult, in case of anonymous block continuation, we are using continuation()->node() which returns enclosing node i.e. <a> in our case. But in RenderBlock::nodeAtPoint, while calling addNodeToRectBasedTestResult we use "node()" which returns NULL for anonymous blocks. Using same node at both the places fixes the problem. Patch on this bug looks good to me, Antonio can confirm this as from file revisions, looks like mainly he had implememented rect based hittest.
Arun Patole
Comment 7 2012-10-28 21:05:00 PDT
cc Antonio
Antonio Gomes
Comment 8 2012-10-29 21:49:21 PDT
Comment on attachment 169298 [details] Patch could not Internals::nodesFromRect be used to trigger this assert?
Adam Barth
Comment 9 2012-10-30 15:07:06 PDT
Comment on attachment 169298 [details] Patch I'm going to try to construct a test based on the comments above.
Adam Barth
Comment 10 2012-11-02 10:46:54 PDT
Created attachment 172085 [details] LayoutTest that hits the ASSERT
Adam Barth
Comment 11 2012-11-02 10:48:20 PDT
Comment on attachment 169298 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=169298&action=review >> Source/WebCore/rendering/RenderBlock.h:570 >> + Node* nodeForHitTest(); > > Could be const. Done.
Antonio Gomes
Comment 12 2012-11-02 10:54:54 PDT
CC'ing some BlackBerry people, since it gets hitten for them as well.
Adam Barth
Comment 13 2012-11-02 10:59:15 PDT
Eric Seidel (no email)
Comment 14 2012-11-02 11:45:19 PDT
Comment on attachment 172087 [details] Patch Yay!
WebKit Review Bot
Comment 15 2012-11-02 12:15:52 PDT
Comment on attachment 172087 [details] Patch Clearing flags on attachment: 172087 Committed r133330: <http://trac.webkit.org/changeset/133330>
WebKit Review Bot
Comment 16 2012-11-02 12:15:57 PDT
All reviewed patches have been landed. Closing bug.
Antonio Gomes
Comment 17 2012-11-04 15:12:34 PST
Comment on attachment 172087 [details] Patch Nice fix!
Adam Barth
Comment 18 2012-11-04 15:51:39 PST
Thanks. :)
Note You need to log in before you can comment on or make changes to this bug.