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

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: Fixed HTMLInputElement adding handler at document destruction and removed dead oilpan code. 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 fd848058bf230c34d2933c1a20f4a42249e872dc..69fd527454e442eecbf830cbee3d6878f19ee45d 100644
--- a/Source/core/page/scrolling/ScrollingCoordinator.cpp
+++ b/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -779,12 +779,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.
@@ -793,9 +792,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);
}
@@ -804,18 +804,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;
}

Powered by Google App Engine
This is Rietveld 408576698