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

Side by Side Diff: Source/core/page/EventHandler.cpp

Issue 206603002: Add EventHandlerRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tests now seem to pass. Created 6 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 18 matching lines...) Expand all
29 #include "core/page/EventHandler.h" 29 #include "core/page/EventHandler.h"
30 30
31 #include "HTMLNames.h" 31 #include "HTMLNames.h"
32 #include "RuntimeEnabledFeatures.h" 32 #include "RuntimeEnabledFeatures.h"
33 #include "SVGNames.h" 33 #include "SVGNames.h"
34 #include "bindings/v8/ExceptionStatePlaceholder.h" 34 #include "bindings/v8/ExceptionStatePlaceholder.h"
35 #include "core/clipboard/Clipboard.h" 35 #include "core/clipboard/Clipboard.h"
36 #include "core/clipboard/DataObject.h" 36 #include "core/clipboard/DataObject.h"
37 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
38 #include "core/dom/DocumentMarkerController.h" 38 #include "core/dom/DocumentMarkerController.h"
39 #include "core/dom/EventHandlerRegistry.h"
39 #include "core/dom/FullscreenElementStack.h" 40 #include "core/dom/FullscreenElementStack.h"
40 #include "core/dom/NodeRenderingTraversal.h" 41 #include "core/dom/NodeRenderingTraversal.h"
41 #include "core/dom/TouchList.h" 42 #include "core/dom/TouchList.h"
42 #include "core/dom/shadow/ShadowRoot.h" 43 #include "core/dom/shadow/ShadowRoot.h"
43 #include "core/editing/Editor.h" 44 #include "core/editing/Editor.h"
44 #include "core/editing/FrameSelection.h" 45 #include "core/editing/FrameSelection.h"
45 #include "core/editing/TextIterator.h" 46 #include "core/editing/TextIterator.h"
46 #include "core/editing/htmlediting.h" 47 #include "core/editing/htmlediting.h"
47 #include "core/events/DOMWindowEventQueue.h" 48 #include "core/events/DOMWindowEventQueue.h"
48 #include "core/events/EventPath.h" 49 #include "core/events/EventPath.h"
(...skipping 3616 matching lines...) Expand 10 before | Expand all | Expand 10 after
3665 // Touch events should not go to text nodes 3666 // Touch events should not go to text nodes
3666 if (node->isTextNode()) 3667 if (node->isTextNode())
3667 node = EventPath::parent(node); 3668 node = EventPath::parent(node);
3668 3669
3669 Document& doc = node->document(); 3670 Document& doc = node->document();
3670 // Record the originating touch document even if it does not have a touch listener. 3671 // Record the originating touch document even if it does not have a touch listener.
3671 if (freshTouchEvents) { 3672 if (freshTouchEvents) {
3672 m_originatingTouchPointDocument = &doc; 3673 m_originatingTouchPointDocument = &doc;
3673 freshTouchEvents = false; 3674 freshTouchEvents = false;
3674 } 3675 }
3675 if (!doc.hasTouchEventHandlers()) 3676 if (!EventHandlerRegistry::from(doc)->eventHandlerCount(EventHandler Registry::TouchEvent))
3676 continue; 3677 continue;
3677 m_originatingTouchPointTargets.set(touchPointTargetKey, node); 3678 m_originatingTouchPointTargets.set(touchPointTargetKey, node);
3678 touchTarget = node; 3679 touchTarget = node;
3679 3680
3680 TouchAction effectiveTouchAction = computeEffectiveTouchAction(pageP oint); 3681 TouchAction effectiveTouchAction = computeEffectiveTouchAction(pageP oint);
3681 if (effectiveTouchAction != TouchActionAuto) 3682 if (effectiveTouchAction != TouchActionAuto)
3682 m_frame->page()->chrome().client().setTouchAction(effectiveTouch Action); 3683 m_frame->page()->chrome().client().setTouchAction(effectiveTouch Action);
3683 3684
3684 } else if (pointState == PlatformTouchPoint::TouchReleased || pointState == PlatformTouchPoint::TouchCancelled) { 3685 } else if (pointState == PlatformTouchPoint::TouchReleased || pointState == PlatformTouchPoint::TouchCancelled) {
3685 // The target should be the original target for this touch, so get i t from the hashmap. As it's a release or cancel 3686 // The target should be the original target for this touch, so get i t from the hashmap. As it's a release or cancel
3686 // we also remove it from the map. 3687 // we also remove it from the map.
3687 touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKe y); 3688 touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKe y);
3688 } else 3689 } else
3689 // No hittest is performed on move or stationary, since the target i s not allowed to change anyway. 3690 // No hittest is performed on move or stationary, since the target i s not allowed to change anyway.
3690 touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey ); 3691 touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey );
3691 3692
3692 if (!touchTarget.get()) 3693 if (!touchTarget.get())
3693 continue; 3694 continue;
3694 Document& doc = touchTarget->toNode()->document(); 3695 Document& doc = touchTarget->toNode()->document();
3695 if (!doc.hasTouchEventHandlers()) 3696 if (!EventHandlerRegistry::from(doc)->eventHandlerCount(EventHandlerRegi stry::TouchEvent))
3696 continue; 3697 continue;
3697 LocalFrame* targetFrame = doc.frame(); 3698 LocalFrame* targetFrame = doc.frame();
3698 if (!targetFrame) 3699 if (!targetFrame)
3699 continue; 3700 continue;
3700 3701
3701 if (m_frame != targetFrame) { 3702 if (m_frame != targetFrame) {
3702 // pagePoint should always be relative to the target elements contai ning frame. 3703 // pagePoint should always be relative to the target elements contai ning frame.
3703 pagePoint = documentPointForWindowPoint(targetFrame, point.pos()); 3704 pagePoint = documentPointForWindowPoint(targetFrame, point.pos());
3704 } 3705 }
3705 3706
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
4024 unsigned EventHandler::accessKeyModifiers() 4025 unsigned EventHandler::accessKeyModifiers()
4025 { 4026 {
4026 #if OS(MACOSX) 4027 #if OS(MACOSX)
4027 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 4028 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
4028 #else 4029 #else
4029 return PlatformEvent::AltKey; 4030 return PlatformEvent::AltKey;
4030 #endif 4031 #endif
4031 } 4032 }
4032 4033
4033 } // namespace WebCore 4034 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698