2012-02-18 Antonio Gomes <agomes@rim.com>
authortonikitoo@webkit.org <tonikitoo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Feb 2012 19:49:21 +0000 (19:49 +0000)
committertonikitoo@webkit.org <tonikitoo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Feb 2012 19:49:21 +0000 (19:49 +0000)
commitedf711ba779ce43ad6e5fc9a3542ec6b6c97e06b
tree729a9047d9c26d043e4a23f94415db7736c4addf
parentc210afb45f3256c14df446c7a2b92b6569d2be73
2012-02-18  Antonio Gomes  <agomes@rim.com>

        Fat fingers - cache the first rect-based hit test so we do not need to do it again
        https://bugs.webkit.org/show_bug.cgi?id=79115

        Reviewed by Adam Treat.

        Our FatFingers implementation runs currently in two phases:
        the first checks for the elements intrinsically clickable;
        the second checks for elements made clickable by the page
        (for example, a div with a onclick event listener attached to it).
        For each phase, we perform a rect hittest, which is not needed since
        the result of each is the same.

        Patch introduces a caching mechanism so we avoid on rect hittest:
        when the first phase runs, it caches each nodeset per document in
        a hashmap. This second phase works with the cached results.

        No behavioral change, but performance is better since we
        avoid one (possibly expensive) rect hittest.

        I measured the performance gain on https://www.kvd.se/, and we
        save up to 0.04 seconds, by caching and re-using the results.

        * WebKitSupport/FatFingers.cpp:
        (BlackBerry::WebKit::dumpHitTestResult):
        (BlackBerry::WebKit::FatFingers::findBestPoint):
        (BlackBerry::WebKit::FatFingers::findIntersectingRegions):
        (BlackBerry::WebKit::FatFingers::cachingStrategy):
        (WebKit):
        (BlackBerry::WebKit::FatFingers::getNodesFromRect):
        * WebKitSupport/FatFingers.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108380 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebKitSupport/FatFingers.cpp
Source/WebKit/blackberry/WebKitSupport/FatFingers.h