2010-11-03 Antonio Gomes <tonikitoo@webkit.org>, Andre Pedralho <andre.pedralho...
authorAdemar de Souza Reis Jr <ademar.reis@openbossa.org>
Thu, 11 Nov 2010 19:06:22 +0000 (16:06 -0300)
committerAdemar de Souza Reis Jr <ademar.reis@openbossa.org>
Thu, 11 Nov 2010 20:41:27 +0000 (17:41 -0300)
commit3650536cc2f4de5f5649d6445480b6073f1c20c0
tree3d398f99bebb5ebf5dfbb01b2114a780fa4174fb
parent659ae6b7600316b5c2f6a4d027ce503071f28273
2010-11-03  Antonio Gomes  <tonikitoo@webkit.org>, Andre Pedralho  <andre.pedralho@gmail.com>

        Reviewed by Kenneth Rohde Christiansen and Antti Koivisto.

        [Qt] Making effective use of nodesFromRect.
        https://bugs.webkit.org/show_bug.cgi?id=44089

        Patch adds a helper class (named TouchAdjuster) to improve tap actions
        on mobile touch devices. TouchAdjuster makes use of the newly added rect
        based hit test extension through the Document::nodesFromRect method.
        Given a rectangle as input, nodesFromRect returns a z-index ordered list
        of nodes whose boundaries intersect the rectangle.

        Basically the TouchAdjuster class intercepts the QGraphicsSceneMouseEvent
        passed to both QWebPagePrivate::mouse{Press,Release}Event methods before
        they are passed down to WebCore. The goal is to infer the target click position.
        For that, a rectangle is built up using the event position as a center point and
        expanding it based on the values and directions set in the Platform Plugin
        QWebTouchModifier::hitTestPadding.

        TouchAdjuster iterates over the list of nodes returned by nodesFromRect and
        picks the clickable one that has the largest intersection area with the hit
        test rectangle. The target position is then the center point of this intersection
        area.

        In case of no clickable node intersects the hit test area, the click position
        is not altered.

        TouchAdjuster is *only* working for QGraphicsWebView based views.

        * Api/qwebpage.cpp:
        (QWebPagePrivate::mousePressEvent):
        (QWebPagePrivate::mouseReleaseEvent):
        (QWebPagePrivate::adjustPointForClicking):
        (QWebPagePrivate::TouchAdjuster::TouchAdjuster):
        (QWebPagePrivate::TouchAdjuster::findCandidatePointForTouch):
        (isClickableElement):
        (hasMouseListener):
        (isValidFrameOwner):
        (nodeToElement):
        * Api/qwebpage_p.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71393 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Conflicts:

WebKit/qt/Api/qwebpage.cpp
WebKit/qt/Api/qwebpage.cpp
WebKit/qt/Api/qwebpage_p.h
WebKit/qt/ChangeLog