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

Side by Side Diff: Source/core/events/EventContext.cpp

Issue 108723007: Introduce TreeScopeEventContext (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename SharedEventContext to TreeScopeEventContext Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/events/EventContext.h ('k') | Source/core/events/EventDispatcher.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All Rights Reserved. 2 * Copyright (C) 2010 Google Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 28 matching lines...) Expand all
39 : m_node(node) 39 : m_node(node)
40 , m_currentTarget(currentTarget) 40 , m_currentTarget(currentTarget)
41 { 41 {
42 ASSERT(m_node); 42 ASSERT(m_node);
43 } 43 }
44 44
45 EventContext::~EventContext() 45 EventContext::~EventContext()
46 { 46 {
47 } 47 }
48 48
49 void EventContext::adoptEventPath(Vector<RefPtr<Node> >& nodes) 49 void TreeScopeEventContext::adoptEventPath(Vector<RefPtr<Node> >& nodes)
50 { 50 {
51 m_eventPath = StaticNodeList::adopt(nodes); 51 m_eventPath = StaticNodeList::adopt(nodes);
52 } 52 }
53 53
54 void EventContext::handleLocalEvents(Event* event) const 54 void EventContext::handleLocalEvents(Event* event) const
55 { 55 {
56 if (m_touchEventContext) { 56 if (touchEventContext()) {
57 m_touchEventContext->handleLocalEvents(event); 57 touchEventContext()->handleLocalEvents(event);
58 } else if (m_relatedTarget && event->isMouseEvent()) { 58 } else if (relatedTarget()) {
59 toMouseEvent(event)->setRelatedTarget(m_relatedTarget.get()); 59 if (event->isMouseEvent()) {
60 } else if (m_relatedTarget && event->isFocusEvent()) { 60 toMouseEvent(event)->setRelatedTarget(relatedTarget());
61 toFocusEvent(event)->setRelatedTarget(m_relatedTarget.get()); 61 } else if (event->isFocusEvent()) {
62 toFocusEvent(event)->setRelatedTarget(relatedTarget());
63 }
62 } 64 }
63 event->setTarget(m_target); 65 event->setTarget(target());
64 event->setCurrentTarget(m_currentTarget.get()); 66 event->setCurrentTarget(m_currentTarget.get());
65 m_node->handleLocalEvents(event); 67 m_node->handleLocalEvents(event);
66 } 68 }
67 69
68 TouchEventContext* EventContext::ensureTouchEventContext() 70 TouchEventContext* TreeScopeEventContext::ensureTouchEventContext()
69 { 71 {
70 if (!m_touchEventContext) 72 if (!m_touchEventContext)
71 m_touchEventContext = TouchEventContext::create(); 73 m_touchEventContext = TouchEventContext::create();
72 return m_touchEventContext.get(); 74 return m_touchEventContext.get();
73 } 75 }
74 76
75 PassRefPtr<TouchEventContext> TouchEventContext::create() 77 PassRefPtr<TouchEventContext> TouchEventContext::create()
76 { 78 {
77 return adoptRef(new TouchEventContext); 79 return adoptRef(new TouchEventContext);
78 } 80 }
(...skipping 11 matching lines...) Expand all
90 92
91 void TouchEventContext::handleLocalEvents(Event* event) const 93 void TouchEventContext::handleLocalEvents(Event* event) const
92 { 94 {
93 ASSERT(event->isTouchEvent()); 95 ASSERT(event->isTouchEvent());
94 TouchEvent* touchEvent = toTouchEvent(event); 96 TouchEvent* touchEvent = toTouchEvent(event);
95 touchEvent->setTouches(m_touches); 97 touchEvent->setTouches(m_touches);
96 touchEvent->setTargetTouches(m_targetTouches); 98 touchEvent->setTargetTouches(m_targetTouches);
97 touchEvent->setChangedTouches(m_changedTouches); 99 touchEvent->setChangedTouches(m_changedTouches);
98 } 100 }
99 101
102 PassRefPtr<TreeScopeEventContext> TreeScopeEventContext::create(TreeScope& treeS cope)
103 {
104 return adoptRef(new TreeScopeEventContext(treeScope));
100 } 105 }
106
107 TreeScopeEventContext::TreeScopeEventContext(TreeScope& treeScope)
108 : m_treeScope(treeScope)
109 {
110 }
111
112 TreeScopeEventContext::~TreeScopeEventContext()
113 {
114 }
115
116 }
OLDNEW
« no previous file with comments | « Source/core/events/EventContext.h ('k') | Source/core/events/EventDispatcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698