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

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: Add test for external handlers. Created 6 years, 8 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 3634 matching lines...) Expand 10 before | Expand all | Expand 10 after
3683 // Touch events should not go to text nodes 3684 // Touch events should not go to text nodes
3684 if (node->isTextNode()) 3685 if (node->isTextNode())
3685 node = NodeRenderingTraversal::parent(node); 3686 node = NodeRenderingTraversal::parent(node);
3686 3687
3687 Document& doc = node->document(); 3688 Document& doc = node->document();
3688 // Record the originating touch document even if it does not have a touch listener. 3689 // Record the originating touch document even if it does not have a touch listener.
3689 if (freshTouchEvents) { 3690 if (freshTouchEvents) {
3690 m_originatingTouchPointDocument = &doc; 3691 m_originatingTouchPointDocument = &doc;
3691 freshTouchEvents = false; 3692 freshTouchEvents = false;
3692 } 3693 }
3693 if (!doc.hasTouchEventHandlers()) 3694 if (!EventHandlerRegistry::from(doc)->hasEventHandlers(EventHandlerR egistry::TouchEvent))
3694 continue; 3695 continue;
3695 m_originatingTouchPointTargets.set(touchPointTargetKey, node); 3696 m_originatingTouchPointTargets.set(touchPointTargetKey, node);
3696 touchTarget = node; 3697 touchTarget = node;
3697 3698
3698 TouchAction effectiveTouchAction = computeEffectiveTouchAction(pageP oint); 3699 TouchAction effectiveTouchAction = computeEffectiveTouchAction(pageP oint);
3699 if (effectiveTouchAction != TouchActionAuto) 3700 if (effectiveTouchAction != TouchActionAuto)
3700 m_frame->page()->chrome().client().setTouchAction(effectiveTouch Action); 3701 m_frame->page()->chrome().client().setTouchAction(effectiveTouch Action);
3701 3702
3702 } else if (pointState == PlatformTouchPoint::TouchReleased || pointState == PlatformTouchPoint::TouchCancelled) { 3703 } else if (pointState == PlatformTouchPoint::TouchReleased || pointState == PlatformTouchPoint::TouchCancelled) {
3703 // The target should be the original target for this touch, so get i t from the hashmap. As it's a release or cancel 3704 // The target should be the original target for this touch, so get i t from the hashmap. As it's a release or cancel
3704 // we also remove it from the map. 3705 // we also remove it from the map.
3705 touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKe y); 3706 touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKe y);
3706 } else 3707 } else
3707 // No hittest is performed on move or stationary, since the target i s not allowed to change anyway. 3708 // No hittest is performed on move or stationary, since the target i s not allowed to change anyway.
3708 touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey ); 3709 touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey );
3709 3710
3710 if (!touchTarget.get()) 3711 if (!touchTarget.get())
3711 continue; 3712 continue;
3712 Document& doc = touchTarget->toNode()->document(); 3713 Document& doc = touchTarget->toNode()->document();
3713 if (!doc.hasTouchEventHandlers()) 3714 if (!EventHandlerRegistry::from(doc)->hasEventHandlers(EventHandlerRegis try::TouchEvent))
3714 continue; 3715 continue;
3715 LocalFrame* targetFrame = doc.frame(); 3716 LocalFrame* targetFrame = doc.frame();
3716 if (!targetFrame) 3717 if (!targetFrame)
3717 continue; 3718 continue;
3718 3719
3719 if (m_frame != targetFrame) { 3720 if (m_frame != targetFrame) {
3720 // pagePoint should always be relative to the target elements contai ning frame. 3721 // pagePoint should always be relative to the target elements contai ning frame.
3721 pagePoint = documentPointForWindowPoint(targetFrame, point.pos()); 3722 pagePoint = documentPointForWindowPoint(targetFrame, point.pos());
3722 } 3723 }
3723 3724
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
4042 unsigned EventHandler::accessKeyModifiers() 4043 unsigned EventHandler::accessKeyModifiers()
4043 { 4044 {
4044 #if OS(MACOSX) 4045 #if OS(MACOSX)
4045 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 4046 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
4046 #else 4047 #else
4047 return PlatformEvent::AltKey; 4048 return PlatformEvent::AltKey;
4048 #endif 4049 #endif
4049 } 4050 }
4050 4051
4051 } // namespace WebCore 4052 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698