From f02d8dbde4ff5575b769359403b9ca0016f64acb Mon Sep 17 00:00:00 2001 From: "commit-queue@webkit.org" Date: Wed, 4 Apr 2012 15:52:11 +0000 Subject: [PATCH] [Qt] Entire page highlighted on panning. https://bugs.webkit.org/show_bug.cgi?id=83158 Patch by Allan Sandfeld Jensen on 2012-04-04 Reviewed by Kenneth Rohde Christiansen. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::highlightPotentialActivation): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113195 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit2/ChangeLog | 10 ++++++++++ Source/WebKit2/WebProcess/WebPage/WebPage.cpp | 24 +++++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 9e86315..d51a28b 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,13 @@ +2012-04-04 Allan Sandfeld Jensen + + [Qt] Entire page highlighted on panning. + https://bugs.webkit.org/show_bug.cgi?id=83158 + + Reviewed by Kenneth Rohde Christiansen. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::highlightPotentialActivation): + 2012-04-04 Jesus Sanchez-Palencia [Qt][WK2] QtWebKit2 should support Page Visibility API diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index 9c37347..ca37426 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -1455,19 +1455,25 @@ void WebPage::highlightPotentialActivation(const IntPoint& point, const IntSize& IntPoint adjustedPoint; if (point != IntPoint::zero()) { + Node* adjustedNode = 0; #if ENABLE(TOUCH_ADJUSTMENT) - mainframe->eventHandler()->bestClickableNodeForTouchPoint(point, IntSize(area.width() / 2, area.height() / 2), adjustedPoint, activationNode); + mainframe->eventHandler()->bestClickableNodeForTouchPoint(point, IntSize(area.width() / 2, area.height() / 2), adjustedPoint, adjustedNode); #else HitTestResult result = mainframe->eventHandler()->hitTestResultAtPoint(mainframe->view()->windowToContents(point), /*allowShadowContent*/ false, /*ignoreClipping*/ true); - activationNode = result.innerNode(); -#endif - if (activationNode && !activationNode->isFocusable()) { - for (Node* node = activationNode; node; node = node->parentOrHostNode()) { - if (node->isFocusable()) { - activationNode = node; - break; - } + adjustedNode = result.innerNode(); +#endif + // Find the node to highlight. This is not the same as the node responding the tap gesture, because many + // pages has a global click handler and we do not want to highlight the body. + // Instead find the enclosing link or focusable element, or the last enclosing inline element. + for (Node* node = adjustedNode; node; node = node->parentOrHostNode()) { + if (node->isMouseFocusable() || node->isLink()) { + activationNode = node; + break; } + if (node->renderer() && node->renderer()->isInline()) + activationNode = node; + else if (activationNode) + break; } } -- 2.7.4