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

Side by Side Diff: third_party/WebKit/Source/core/events/RegisteredEventListener.h

Issue 2475443004: Add use counter when touch-action isn't used when preventDefault'd. (Closed)
Patch Set: Rebase Created 4 years, 1 month 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) 2001 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Apple Inc. All rights 5 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 22 matching lines...) Expand all
33 33
34 class RegisteredEventListener { 34 class RegisteredEventListener {
35 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 35 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
36 36
37 public: 37 public:
38 RegisteredEventListener() 38 RegisteredEventListener()
39 : m_useCapture(false), 39 : m_useCapture(false),
40 m_passive(false), 40 m_passive(false),
41 m_once(false), 41 m_once(false),
42 m_blockedEventWarningEmitted(false), 42 m_blockedEventWarningEmitted(false),
43 m_passiveForcedForDocumentTarget(false) {} 43 m_passiveForcedForDocumentTarget(false),
44 m_passiveSpecified(false) {}
44 45
45 RegisteredEventListener(EventListener* listener, 46 RegisteredEventListener(EventListener* listener,
46 const AddEventListenerOptionsResolved& options) 47 const AddEventListenerOptionsResolved& options)
47 : m_listener(listener), 48 : m_listener(listener),
48 m_useCapture(options.capture()), 49 m_useCapture(options.capture()),
49 m_passive(options.passive()), 50 m_passive(options.passive()),
50 m_once(options.once()), 51 m_once(options.once()),
51 m_blockedEventWarningEmitted(false), 52 m_blockedEventWarningEmitted(false),
52 m_passiveForcedForDocumentTarget( 53 m_passiveForcedForDocumentTarget(
53 options.passiveForcedForDocumentTarget()) {} 54 options.passiveForcedForDocumentTarget()),
55 m_passiveSpecified(options.passiveSpecified()) {}
54 56
55 DEFINE_INLINE_TRACE() { visitor->trace(m_listener); } 57 DEFINE_INLINE_TRACE() { visitor->trace(m_listener); }
56 58
57 AddEventListenerOptionsResolved options() const { 59 AddEventListenerOptionsResolved options() const {
58 AddEventListenerOptionsResolved result; 60 AddEventListenerOptionsResolved result;
59 result.setCapture(m_useCapture); 61 result.setCapture(m_useCapture);
60 result.setPassive(m_passive); 62 result.setPassive(m_passive);
61 result.setPassiveForcedForDocumentTarget(m_passiveForcedForDocumentTarget); 63 result.setPassiveForcedForDocumentTarget(m_passiveForcedForDocumentTarget);
62 result.setOnce(m_once); 64 result.setOnce(m_once);
65 result.setPassiveSpecified(m_passiveSpecified);
63 return result; 66 return result;
64 } 67 }
65 68
66 const EventListener* listener() const { return m_listener; } 69 const EventListener* listener() const { return m_listener; }
67 70
68 EventListener* listener() { return m_listener; } 71 EventListener* listener() { return m_listener; }
69 72
70 bool passive() const { return m_passive; } 73 bool passive() const { return m_passive; }
71 74
72 bool once() const { return m_once; } 75 bool once() const { return m_once; }
73 76
74 bool capture() const { return m_useCapture; } 77 bool capture() const { return m_useCapture; }
75 78
76 bool blockedEventWarningEmitted() const { 79 bool blockedEventWarningEmitted() const {
77 return m_blockedEventWarningEmitted; 80 return m_blockedEventWarningEmitted;
78 } 81 }
79 82
80 bool passiveForcedForDocumentTarget() const { 83 bool passiveForcedForDocumentTarget() const {
81 return m_passiveForcedForDocumentTarget; 84 return m_passiveForcedForDocumentTarget;
82 } 85 }
83 86
87 bool passiveSpecified() const { return m_passiveSpecified; }
88
84 void setBlockedEventWarningEmitted() { m_blockedEventWarningEmitted = true; } 89 void setBlockedEventWarningEmitted() { m_blockedEventWarningEmitted = true; }
85 90
86 bool matches(const EventListener* listener, 91 bool matches(const EventListener* listener,
87 const EventListenerOptions& options) const { 92 const EventListenerOptions& options) const {
88 // Equality is soley based on the listener and useCapture flags. 93 // Equality is soley based on the listener and useCapture flags.
89 DCHECK(m_listener); 94 DCHECK(m_listener);
90 DCHECK(listener); 95 DCHECK(listener);
91 return *m_listener == *listener && 96 return *m_listener == *listener &&
92 static_cast<bool>(m_useCapture) == options.capture(); 97 static_cast<bool>(m_useCapture) == options.capture();
93 } 98 }
94 99
95 bool operator==(const RegisteredEventListener& other) const { 100 bool operator==(const RegisteredEventListener& other) const {
96 // Equality is soley based on the listener and useCapture flags. 101 // Equality is soley based on the listener and useCapture flags.
97 DCHECK(m_listener); 102 DCHECK(m_listener);
98 DCHECK(other.m_listener); 103 DCHECK(other.m_listener);
99 return *m_listener == *other.m_listener && 104 return *m_listener == *other.m_listener &&
100 m_useCapture == other.m_useCapture; 105 m_useCapture == other.m_useCapture;
101 } 106 }
102 107
103 private: 108 private:
104 Member<EventListener> m_listener; 109 Member<EventListener> m_listener;
105 unsigned m_useCapture : 1; 110 unsigned m_useCapture : 1;
106 unsigned m_passive : 1; 111 unsigned m_passive : 1;
107 unsigned m_once : 1; 112 unsigned m_once : 1;
108 unsigned m_blockedEventWarningEmitted : 1; 113 unsigned m_blockedEventWarningEmitted : 1;
109 unsigned m_passiveForcedForDocumentTarget : 1; 114 unsigned m_passiveForcedForDocumentTarget : 1;
115 unsigned m_passiveSpecified : 1;
110 }; 116 };
111 117
112 } // namespace blink 118 } // namespace blink
113 119
114 WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(blink::RegisteredEventListener); 120 WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(blink::RegisteredEventListener);
115 121
116 #endif // RegisteredEventListener_h 122 #endif // RegisteredEventListener_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/EventTarget.cpp ('k') | third_party/WebKit/Source/core/events/TouchEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698