Skip to content

Commit

Permalink
Simplify hitTestResultAtPoint and nodesFromRect APIs
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=95720

Reviewed by Antonio Gomes.

.:

Update exported symbols.

* Source/autotools/symbols.filter:

Source/WebCore:

The existing API was overloaded and could be simplified by passing all the bool arguments in
a HitTestRequest argument. This should also help clarify the call as the enum values explicitely
state what they do.

* WebCore.exp.in:
* WebCore.order:
* dom/Document.cpp:
(WebCore::Document::nodesFromRect):
* dom/Document.h:
(Document):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::createContextMenu):
* page/DragController.cpp:
(WebCore::DragController::canProcessDrag):
(WebCore::DragController::startDrag):
* page/EventHandler.cpp:
(WebCore::EventHandler::updateAutoscrollRenderer):
(WebCore::EventHandler::hitTestResultAtPoint):
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::handleGestureEvent):
(WebCore::EventHandler::bestClickableNodeForTouchPoint):
(WebCore::EventHandler::bestContextMenuNodeForTouchPoint):
(WebCore::EventHandler::bestZoomableAreaForTouchPoint):
(WebCore::EventHandler::handleTouchEvent):
* page/EventHandler.h:
(EventHandler):
* page/FocusController.cpp:
(WebCore::updateFocusCandidateIfNeeded):
* page/Frame.cpp:
(WebCore::Frame::visiblePositionForPoint):
(WebCore::Frame::documentAtPoint):
* page/TouchDisambiguation.cpp:
(WebCore::findGoodTouchTargets):
* rendering/HitTestRequest.h:
(HitTestRequest):
* testing/Internals.cpp:
(WebCore::Internals::nodesFromRect):

Source/WebKit/blackberry:

Update calls to new API.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::contextNode):
(BlackBerry::WebKit::WebPagePrivate::nodeForZoomUnderPoint):
(BlackBerry::WebKit::WebPagePrivate::handleMouseEvent):
(BlackBerry::WebKit::WebPage::nodeAtPoint):
* WebKitSupport/FatFingers.cpp:
(BlackBerry::WebKit::FatFingers::getNodesFromRect):
(BlackBerry::WebKit::FatFingers::getRelevantInfoFromPoint):
* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::visiblePositionForPointIgnoringClipping):

Source/WebKit/chromium:

Update calls to new API.

* src/ContextMenuClientImpl.cpp:
(WebKit::selectMisspelledWord):
* src/FrameLoaderClientImpl.cpp:
(WebKit::FrameLoaderClientImpl::dispatchDecidePolicyForNavigationAction):
* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::characterIndexForPoint):
* src/WebPluginContainerImpl.cpp:
(WebKit::WebPluginContainerImpl::isRectTopmost):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::handleMouseUp):
(WebKit::WebViewImpl::computeBlockBounds):

Source/WebKit/efl:

Update calls to new API.

* ewk/ewk_frame.cpp:
(ewk_frame_hit_test_new):

Source/WebKit/mac:

Update calls to new API.

* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::actionDictionary):
* WebView/WebHTMLView.mm:
(-[WebHTMLView elementAtPoint:allowShadowContent:]):

Source/WebKit/qt:

Update calls to new API.

* Api/qwebframe.cpp:
(QWebFrame::hitTestContent):
* Api/qwebpage.cpp:
(QWebPagePrivate::handleSoftwareInputPanel):
(QWebPagePrivate::TouchAdjuster::findCandidatePointForTouch):
(QWebPage::updatePositionDependentActions):
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction):

Source/WebKit/win:

Update calls to new API.

* WebActionPropertyBag.cpp:
(WebActionPropertyBag::Read):
* WebView.cpp:
(WebView::handleContextMenuEvent):
(WebView::elementAtPoint):

Source/WebKit/wx:

Update calls to new API.

* WebFrame.cpp:
(WebKit::WebFrame::HitTest):

Source/WebKit2:

Update calls to new API and update exported symbols.

* WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
(WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::handleContextMenuEvent):
(WebKit::WebPage::highlightPotentialActivation): Corrects the misplaced arguments while converting them.
(WebKit::WebPage::findZoomableAreaForPoint):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::characterIndexForPoint):
(WebKit::WebPage::performDictionaryLookupAtLocation):
(WebKit::WebPage::shouldDelayWindowOrderingEvent):
(WebKit::WebPage::acceptsFirstMouse):
* win/WebKit2.def:
* win/WebKit2CFLite.def:


Canonical link: https://commits.webkit.org/113977@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@127876 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Allan Sandfeld Jensen committed Sep 7, 2012
1 parent 4a919ca commit 1c66c66
Show file tree
Hide file tree
Showing 46 changed files with 273 additions and 94 deletions.
11 changes: 11 additions & 0 deletions ChangeLog
@@ -1,3 +1,14 @@
2012-09-07 Allan Sandfeld Jensen <allan.jensen@nokia.com>

Simplify hitTestResultAtPoint and nodesFromRect APIs
https://bugs.webkit.org/show_bug.cgi?id=95720

Reviewed by Antonio Gomes.

Update exported symbols.

* Source/autotools/symbols.filter:

2012-09-07 Zan Dobersek <zandobersek@gmail.com>

[GTK] Multiple feature defines in webcore_cppflags can occur
Expand Down
45 changes: 45 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,48 @@
2012-09-07 Allan Sandfeld Jensen <allan.jensen@nokia.com>

Simplify hitTestResultAtPoint and nodesFromRect APIs
https://bugs.webkit.org/show_bug.cgi?id=95720

Reviewed by Antonio Gomes.

The existing API was overloaded and could be simplified by passing all the bool arguments in
a HitTestRequest argument. This should also help clarify the call as the enum values explicitely
state what they do.

* WebCore.exp.in:
* WebCore.order:
* dom/Document.cpp:
(WebCore::Document::nodesFromRect):
* dom/Document.h:
(Document):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::createContextMenu):
* page/DragController.cpp:
(WebCore::DragController::canProcessDrag):
(WebCore::DragController::startDrag):
* page/EventHandler.cpp:
(WebCore::EventHandler::updateAutoscrollRenderer):
(WebCore::EventHandler::hitTestResultAtPoint):
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::handleGestureEvent):
(WebCore::EventHandler::bestClickableNodeForTouchPoint):
(WebCore::EventHandler::bestContextMenuNodeForTouchPoint):
(WebCore::EventHandler::bestZoomableAreaForTouchPoint):
(WebCore::EventHandler::handleTouchEvent):
* page/EventHandler.h:
(EventHandler):
* page/FocusController.cpp:
(WebCore::updateFocusCandidateIfNeeded):
* page/Frame.cpp:
(WebCore::Frame::visiblePositionForPoint):
(WebCore::Frame::documentAtPoint):
* page/TouchDisambiguation.cpp:
(WebCore::findGoodTouchTargets):
* rendering/HitTestRequest.h:
(HitTestRequest):
* testing/Internals.cpp:
(WebCore::Internals::nodesFromRect):

2012-09-07 Simon Hausmann <simon.hausmann@nokia.com>

Build of OpenGLShims.cpp against EGL/GLES2 platforms is broken
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/WebCore.exp.in
Expand Up @@ -158,7 +158,7 @@ __ZN7WebCore12EventHandler14scrollOverflowENS_15ScrollDirectionENS_17ScrollGranu
__ZN7WebCore12EventHandler15handleAccessKeyERKNS_21PlatformKeyboardEventE
__ZN7WebCore12EventHandler16handleWheelEventERKNS_18PlatformWheelEventE
__ZN7WebCore12EventHandler17scrollRecursivelyENS_15ScrollDirectionENS_17ScrollGranularityEPNS_4NodeE
__ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_21FractionalLayoutPointEbbNS_17HitTestScrollbarsEjRKNS_20FractionalLayoutSizeE
__ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_21FractionalLayoutPointEjRKNS_20FractionalLayoutSizeE
__ZN7WebCore12EventHandler21handleMousePressEventERKNS_18PlatformMouseEventE
__ZN7WebCore12EventHandler23handleMouseReleaseEventERKNS_18PlatformMouseEventE
__ZN7WebCore12EventHandler24logicalScrollRecursivelyENS_22ScrollLogicalDirectionENS_17ScrollGranularityEPNS_4NodeE
Expand Down Expand Up @@ -1354,7 +1354,7 @@ __ZNK7WebCore7RunLoop9TimerBase8isActiveEv
__ZNK7WebCore8Document10renderViewEv
__ZNK7WebCore8Document11completeURLERKN3WTF6StringE
__ZNK7WebCore8Document13axObjectCacheEv
__ZNK7WebCore8Document13nodesFromRectEiijjjjbbb
__ZNK7WebCore8Document13nodesFromRectEiijjjjj
__ZNK7WebCore8Document14getElementByIdERKN3WTF12AtomicStringE
__ZNK7WebCore8Document31displayStringModifiedByEncodingERKN3WTF6StringE
__ZNK7WebCore8Document4bodyEv
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/WebCore.order
Expand Up @@ -22785,7 +22785,7 @@ __ZNK7WebCore12NodeIterator20updateForNodeRemovalEPNS_4NodeERNS0_11NodePointerE
__ZN7WebCore27jsNodeIteratorReferenceNodeEPN3JSC9ExecStateENS0_7JSValueERKNS0_10IdentifierE
__ZNK7WebCore4Node20traversePreviousNodeEPKS0_
__ZN7WebCore37jsNodeIteratorPrototypeFunctionDetachEPN3JSC9ExecStateE
__ZNK7WebCore8Document13nodesFromRectEiijjjjbbb
__ZNK7WebCore8Document13nodesFromRectEiijjjjj
__ZNK7WebCore8Document17handleZeroPaddingERKNS_14HitTestRequestERNS_13HitTestResultE
__ZN3WTF21ListHashSetTranslatorINS_6RefPtrIN7WebCore4NodeEEELm256ENS_7PtrHashIS4_EEE9translateERPNS_15ListHashSetNodeIS4_Lm256EEERKS4_PNS_24ListHashSetNodeAllocatorIS4_Lm256EEE
__ZN7WebCore21StaticHashSetNodeListC1ERN3WTF11ListHashSetINS1_6RefPtrINS_4NodeEEELm256ENS1_7PtrHashIS5_EEEE
Expand Down
14 changes: 3 additions & 11 deletions Source/WebCore/dom/Document.cpp
Expand Up @@ -1384,7 +1384,7 @@ String Document::suggestedMIMEType() const
// * making it receive a rect as parameter, i.e. nodesFromRect(x, y, w, h);
// * making it receive the expading size of each direction separately,
// i.e. nodesFromRect(x, y, topSize, rightSize, bottomSize, leftSize);
PassRefPtr<NodeList> Document::nodesFromRect(int centerX, int centerY, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent) const
PassRefPtr<NodeList> Document::nodesFromRect(int centerX, int centerY, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, HitTestRequest::HitTestRequestType hitType) const
{
// FIXME: Share code between this, elementFromPoint and caretRangeFromPoint.
if (!renderer())
Expand All @@ -1399,19 +1399,11 @@ PassRefPtr<NodeList> Document::nodesFromRect(int centerX, int centerY, unsigned
float zoomFactor = frame->pageZoomFactor();
LayoutPoint point = roundedLayoutPoint(FloatPoint(centerX * zoomFactor + view()->scrollX(), centerY * zoomFactor + view()->scrollY()));

int type = HitTestRequest::ReadOnly | HitTestRequest::Active;
HitTestRequest request(hitType);

// When ignoreClipping is false, this method returns null for coordinates outside of the viewport.
if (ignoreClipping)
type |= HitTestRequest::IgnoreClipping;
else if (!frameView->visibleContentRect().intersects(HitTestResult::rectForPoint(point, topPadding, rightPadding, bottomPadding, leftPadding)))
if (!request.ignoreClipping() && !frameView->visibleContentRect().intersects(HitTestResult::rectForPoint(point, topPadding, rightPadding, bottomPadding, leftPadding)))
return 0;
if (allowShadowContent)
type |= HitTestRequest::AllowShadowContent;
if (allowChildFrameContent)
type |= HitTestRequest::AllowChildFrameContent;

HitTestRequest request(type);

// Passing a zero padding will trigger a rect hit test, however for the purposes of nodesFromRect,
// we special handle this case in order to return a valid NodeList.
Expand Down
5 changes: 2 additions & 3 deletions Source/WebCore/dom/Document.h
Expand Up @@ -34,6 +34,7 @@
#include "DOMTimeStamp.h"
#include "DocumentEventQueue.h"
#include "DocumentTiming.h"
#include "HitTestRequest.h"
#include "IconURL.h"
#include "InspectorCounters.h"
#include "IntRect.h"
Expand Down Expand Up @@ -376,12 +377,10 @@ class Document : public ContainerNode, public TreeScope, public ScriptExecutionC
* @param rightPadding How much to expand the right of the rectangle
* @param bottomPadding How much to expand the bottom of the rectangle
* @param leftPadding How much to expand the left of the rectangle
* @param ignoreClipping whether or not to ignore the root scroll frame when retrieving the element.
* If false, this method returns null for coordinates outside of the viewport.
*/
PassRefPtr<NodeList> nodesFromRect(int centerX, int centerY,
unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding,
bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent = false) const;
HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active) const;
Element* elementFromPoint(int x, int y) const;
PassRefPtr<Range> caretRangeFromPoint(int x, int y);

Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/page/ContextMenuController.cpp
Expand Up @@ -149,7 +149,7 @@ PassOwnPtr<ContextMenu> ContextMenuController::createContextMenu(Event* event)
HitTestResult result(mouseEvent->absoluteLocation());

if (Frame* frame = event->target()->toNode()->document()->frame())
result = frame->eventHandler()->hitTestResultAtPoint(mouseEvent->absoluteLocation(), false);
result = frame->eventHandler()->hitTestResultAtPoint(mouseEvent->absoluteLocation());

if (!result.innerNonSharedNode())
return nullptr;
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/page/DragController.cpp
Expand Up @@ -544,7 +544,7 @@ bool DragController::canProcessDrag(DragData* dragData)
if (!m_page->mainFrame()->contentRenderer())
return false;

result = m_page->mainFrame()->eventHandler()->hitTestResultAtPoint(point, true);
result = m_page->mainFrame()->eventHandler()->hitTestResultAtPoint(point, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AllowShadowContent);

if (!result.innerNonSharedNode())
return false;
Expand Down Expand Up @@ -726,7 +726,7 @@ bool DragController::startDrag(Frame* src, const DragState& state, DragOperation
if (!src->view() || !src->contentRenderer())
return false;

HitTestResult hitTestResult = src->eventHandler()->hitTestResultAtPoint(dragOrigin, true);
HitTestResult hitTestResult = src->eventHandler()->hitTestResultAtPoint(dragOrigin, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AllowShadowContent);
if (!state.m_dragSrc->contains(hitTestResult.innerNode()))
// The original node being dragged isn't under the drag origin anymore... maybe it was
// hidden or moved out from under the cursor. Regardless, we don't want to start a drag on
Expand Down
34 changes: 13 additions & 21 deletions Source/WebCore/page/EventHandler.cpp
Expand Up @@ -1007,7 +1007,7 @@ void EventHandler::updateAutoscrollRenderer()
if (!m_autoscrollRenderer)
return;

HitTestResult hitTest = hitTestResultAtPoint(m_panScrollStartPos, true);
HitTestResult hitTest = hitTestResultAtPoint(m_panScrollStartPos, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AllowShadowContent);

if (Node* nodeAtPoint = hitTest.innerNode())
m_autoscrollRenderer = nodeAtPoint->renderer();
Expand Down Expand Up @@ -1039,22 +1039,17 @@ DragSourceAction EventHandler::updateDragSourceActionsAllowed() const
}
#endif // ENABLE(DRAG_SUPPORT)

HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, HitTestRequest::HitTestRequestType hitType, const LayoutSize& padding)
HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTestRequest::HitTestRequestType hitType, const LayoutSize& padding)
{
HitTestResult result(point, padding.height(), padding.width(), padding.height(), padding.width());

if (!m_frame->contentRenderer())
return result;
if (ignoreClipping)
hitType |= HitTestRequest::IgnoreClipping;
if (allowShadowContent)
hitType |= HitTestRequest::AllowShadowContent;
if (testScrollbars == ShouldHitTestScrollbars)
hitType |= HitTestRequest::TestChildFrameScrollBars;
// We always need to handle child frame content.
hitType |= HitTestRequest::AllowChildFrameContent;

m_frame->contentRenderer()->hitTest(HitTestRequest(hitType), result);
HitTestRequest request(hitType);
m_frame->contentRenderer()->hitTest(request, result);

// If our HitTestResult is not visible, then we started hit testing too far down the frame chain.
// Another hit test at the main frame level should get us the correct visible result.
Expand All @@ -1066,12 +1061,12 @@ HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, bool
FrameView* mainView = mainFrame->view();
if (resultView && mainView) {
IntPoint mainFramePoint = mainView->rootViewToContents(resultView->contentsToRootView(roundedIntPoint(result.point())));
result = mainFrame->eventHandler()->hitTestResultAtPoint(mainFramePoint, allowShadowContent, ignoreClipping, testScrollbars, hitType, padding);
result = mainFrame->eventHandler()->hitTestResultAtPoint(mainFramePoint, hitType, padding);
}
}
}

if (!allowShadowContent)
if (!request.allowsShadowContent())
result.setToNonShadowAncestor();

return result;
Expand Down Expand Up @@ -1481,7 +1476,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
m_mouseDownWasInSubframe = false;

HitTestRequest request(HitTestRequest::Active);
// Save the document point we generate in case the window coordinate is invalidated by what happens
// Save the document point we generate in case the window coordinate is invalidated by what happens
// when we dispatch the event.
LayoutPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent.position());
MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent);
Expand Down Expand Up @@ -2381,7 +2376,7 @@ bool EventHandler::handleGestureEvent(const PlatformGestureEvent& gestureEvent)
eventTarget = m_scrollGestureHandlingNode.get();

if (!eventTarget) {
HitTestResult result = hitTestResultAtPoint(gestureEvent.position(), false, false, DontHitTestScrollbars, HitTestRequest::ReadOnly | HitTestRequest::Active);
HitTestResult result = hitTestResultAtPoint(gestureEvent.position());
eventTarget = result.targetNode();
}

Expand Down Expand Up @@ -2483,9 +2478,8 @@ bool EventHandler::handleGestureScrollCore(const PlatformGestureEvent& gestureEv
#if ENABLE(TOUCH_ADJUSTMENT)
bool EventHandler::bestClickableNodeForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntPoint& targetPoint, Node*& targetNode)
{
HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active;
IntPoint hitTestPoint = m_frame->view()->windowToContents(touchCenter);
HitTestResult result = hitTestResultAtPoint(hitTestPoint, /*allowShadowContent*/ true, /*ignoreClipping*/ false, DontHitTestScrollbars, hitType, touchRadius);
HitTestResult result = hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AllowShadowContent, touchRadius);

IntRect touchRect(touchCenter - touchRadius, touchRadius + touchRadius);
RefPtr<StaticHashSetNodeList> nodeList = StaticHashSetNodeList::adopt(result.rectBasedTestResult());
Expand All @@ -2502,9 +2496,8 @@ bool EventHandler::bestClickableNodeForTouchPoint(const IntPoint& touchCenter, c

bool EventHandler::bestContextMenuNodeForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntPoint& targetPoint, Node*& targetNode)
{
HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active;
IntPoint hitTestPoint = m_frame->view()->windowToContents(touchCenter);
HitTestResult result = hitTestResultAtPoint(hitTestPoint, /*allowShadowContent*/ true, /*ignoreClipping*/ false, DontHitTestScrollbars, hitType, touchRadius);
HitTestResult result = hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AllowShadowContent, touchRadius);

IntRect touchRect(touchCenter - touchRadius, touchRadius + touchRadius);
RefPtr<StaticHashSetNodeList> nodeList = StaticHashSetNodeList::adopt(result.rectBasedTestResult());
Expand All @@ -2513,9 +2506,8 @@ bool EventHandler::bestContextMenuNodeForTouchPoint(const IntPoint& touchCenter,

bool EventHandler::bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntRect& targetArea, Node*& targetNode)
{
HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active;
IntPoint hitTestPoint = m_frame->view()->windowToContents(touchCenter);
HitTestResult result = hitTestResultAtPoint(hitTestPoint, /*allowShadowContent*/ false, /*ignoreClipping*/ false, DontHitTestScrollbars, hitType, touchRadius);
HitTestResult result = hitTestResultAtPoint(hitTestPoint, HitTestRequest::ReadOnly | HitTestRequest::Active, touchRadius);

IntRect touchRect(touchCenter - touchRadius, touchRadius + touchRadius);
RefPtr<StaticHashSetNodeList> nodeList = StaticHashSetNodeList::adopt(result.rectBasedTestResult());
Expand Down Expand Up @@ -3557,7 +3549,7 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
unsigned touchPointTargetKey = point.id() + 1;
RefPtr<EventTarget> touchTarget;
if (pointState == PlatformTouchPoint::TouchPressed) {
HitTestResult result = hitTestResultAtPoint(pagePoint, /*allowShadowContent*/ false, false, DontHitTestScrollbars, hitType);
HitTestResult result = hitTestResultAtPoint(pagePoint, hitType);
Node* node = result.innerNode();
ASSERT(node);

Expand All @@ -3575,7 +3567,7 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
touchTarget = node;
} else if (pointState == PlatformTouchPoint::TouchReleased || pointState == PlatformTouchPoint::TouchCancelled) {
// We only perform a hittest on release or cancel to unset :active or :hover state.
hitTestResultAtPoint(pagePoint, /*allowShadowContent*/ false, false, DontHitTestScrollbars, hitType);
hitTestResultAtPoint(pagePoint, hitType);
// The target should be the original target for this touch, so get it from the hashmap. As it's a release or cancel
// we also remove it from the map.
touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKey);
Expand Down
6 changes: 1 addition & 5 deletions Source/WebCore/page/EventHandler.h
Expand Up @@ -88,8 +88,6 @@ extern const int TextDragHysteresis;
extern const int GeneralDragHysteresis;
#endif // ENABLE(DRAG_SUPPORT)

enum HitTestScrollbars { ShouldHitTestScrollbars, DontHitTestScrollbars };

class EventHandler {
WTF_MAKE_NONCOPYABLE(EventHandler);
public:
Expand All @@ -115,9 +113,7 @@ class EventHandler {
void dispatchFakeMouseMoveEventSoon();
void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&);

HitTestResult hitTestResultAtPoint(const LayoutPoint&, bool allowShadowContent, bool ignoreClipping = false,
HitTestScrollbars scrollbars = DontHitTestScrollbars,
HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active,
HitTestResult hitTestResultAtPoint(const LayoutPoint&, HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active,
const LayoutSize& padding = LayoutSize());

bool mousePressed() const { return m_mousePressed; }
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/page/FocusController.cpp
Expand Up @@ -745,7 +745,7 @@ static void updateFocusCandidateIfNeeded(FocusDirection direction, const FocusCa
// If 2 nodes are intersecting, do hit test to find which node in on top.
LayoutUnit x = intersectionRect.x() + intersectionRect.width() / 2;
LayoutUnit y = intersectionRect.y() + intersectionRect.height() / 2;
HitTestResult result = candidate.visibleNode->document()->page()->mainFrame()->eventHandler()->hitTestResultAtPoint(IntPoint(x, y), false, true);
HitTestResult result = candidate.visibleNode->document()->page()->mainFrame()->eventHandler()->hitTestResultAtPoint(IntPoint(x, y), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping);
if (candidate.visibleNode->contains(result.innerNode())) {
closest = candidate;
return;
Expand Down

0 comments on commit 1c66c66

Please sign in to comment.