Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Unified Diff: Source/core/page/scrolling/ScrollingCoordinator.cpp

Issue 225903009: Migrate touch events to EventHandlerRegistry (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/page/scrolling/ScrollingCoordinator.cpp
diff --git a/Source/core/page/scrolling/ScrollingCoordinator.cpp b/Source/core/page/scrolling/ScrollingCoordinator.cpp
index 5dbf998255505b9ad26e49e55dc938ac0b2c6c62..b8708444ccf593b8124b9e269e798c11986f5b70 100644
--- a/Source/core/page/scrolling/ScrollingCoordinator.cpp
+++ b/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -796,12 +796,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.
@@ -810,9 +809,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);
}
@@ -821,18 +821,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->inDocument())
Rick Byers 2014/06/19 17:10:36 I'd also check for null node here. There are a LO
Sami 2014/06/27 17:58:51 Well spotted, I'll add a fail-safe.
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;
}

Powered by Google App Engine
This is Rietveld 408576698