| Index: Source/core/page/scrolling/ScrollingCoordinator.cpp
|
| diff --git a/Source/core/page/scrolling/ScrollingCoordinator.cpp b/Source/core/page/scrolling/ScrollingCoordinator.cpp
|
| index 1bce13785af406192a9963056b5a9de6bc7eb4d3..6f43339a2d51e1a8375cdc72e242075f8ac32c49 100644
|
| --- a/Source/core/page/scrolling/ScrollingCoordinator.cpp
|
| +++ b/Source/core/page/scrolling/ScrollingCoordinator.cpp
|
| @@ -747,12 +747,11 @@ Region ScrollingCoordinator::computeShouldHandleScrollGestureOnMainThreadRegion(
|
| static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, const Document* document)
|
| {
|
| ASSERT(document);
|
| - if (!document->touchEventTargets())
|
| + const EventTargetSet* targets = document->frameHost()->eventHandlerRegistry().eventHandlerTargets(EventHandlerRegistry::TouchEvent);
|
| + if (!targets)
|
| return;
|
|
|
| - const TouchEventTargetSet* targets = document->touchEventTargets();
|
| -
|
| - // If there's a handler on the document, html or body element (fairly common in practice),
|
| + // If there's a handler on the window, document, html or body element (fairly common in practice),
|
| // then we can quickly mark the entire document and skip looking at any other handlers.
|
| // Note that technically a handler on the body doesn't cover the whole document, but it's
|
| // reasonable to be conservative and report the whole document anyway.
|
| @@ -761,9 +760,10 @@ static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, co
|
| // root cc::layer with the video layer so doing this optimization causes the compositor to think
|
| // that there are no handlers, therefore skip it.
|
| if (!document->renderView()->compositor()->inOverlayFullscreenVideo()) {
|
| - for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter != targets->end(); ++iter) {
|
| - Node* target = iter->key;
|
| - if (target == document || target == document->documentElement() || target == document->body()) {
|
| + for (EventTargetSet::const_iterator iter = targets->begin(); iter != targets->end(); ++iter) {
|
| + EventTarget* target = iter->key;
|
| + Node* node = target->toNode();
|
| + if (target->toDOMWindow() || node == document || node == document->documentElement() || node == document->body()) {
|
| if (RenderView* rendererView = document->renderView()) {
|
| rendererView->computeLayerHitTestRects(rects);
|
| }
|
| @@ -772,18 +772,19 @@ static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, co
|
| }
|
| }
|
|
|
| - for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter != targets->end(); ++iter) {
|
| - const Node* target = iter->key;
|
| - if (!target->inDocument())
|
| + for (EventTargetSet::const_iterator iter = targets->begin(); iter != targets->end(); ++iter) {
|
| + EventTarget* target = iter->key;
|
| + Node* node = target->toNode();
|
| + if (!node || !node->inDocument())
|
| continue;
|
|
|
| - if (target->isDocumentNode() && target != document) {
|
| - accumulateDocumentTouchEventTargetRects(rects, toDocument(target));
|
| - } else if (RenderObject* renderer = target->renderer()) {
|
| + if (node->isDocumentNode() && node != document) {
|
| + accumulateDocumentTouchEventTargetRects(rects, toDocument(node));
|
| + } else if (RenderObject* renderer = node->renderer()) {
|
| // If the set also contains one of our ancestor nodes then processing
|
| // this node would be redundant.
|
| bool hasTouchEventTargetAncestor = false;
|
| - for (Node* ancestor = target->parentNode(); ancestor && !hasTouchEventTargetAncestor; ancestor = ancestor->parentNode()) {
|
| + for (Node* ancestor = node->parentNode(); ancestor && !hasTouchEventTargetAncestor; ancestor = ancestor->parentNode()) {
|
| if (targets->contains(ancestor))
|
| hasTouchEventTargetAncestor = true;
|
| }
|
|
|