Changeset 127514 in webkit
- Timestamp:
- Sep 4, 2012 3:22:40 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r127513 r127514 1 2012-09-04 Nikhil Bhargava <nbhargava@google.com> 2 3 Fix style for Event.h 4 https://bugs.webkit.org/show_bug.cgi?id=95779 5 6 Reviewed by Eric Seidel. 7 8 Changes indenting for Event.h to match style guidelines for namespaces 9 10 * dom/Event.h: 11 1 12 2012-09-04 Jeffrey Pfau <jpfau@apple.com> 2 13 -
trunk/Source/WebCore/dom/Event.h
r126256 r127514 32 32 namespace WebCore { 33 33 34 35 36 37 34 class EventTarget; 35 class EventDispatcher; 36 class HTMLIFrameElement; 37 class MemoryInstrumentation; 38 38 39 struct EventInit { 40 EventInit(); 41 42 bool bubbles; 43 bool cancelable; 39 struct EventInit { 40 EventInit(); 41 42 bool bubbles; 43 bool cancelable; 44 }; 45 46 class Event : public RefCounted<Event> { 47 public: 48 enum PhaseType { 49 NONE = 0, 50 CAPTURING_PHASE = 1, 51 AT_TARGET = 2, 52 BUBBLING_PHASE = 3 44 53 }; 45 54 46 class Event : public RefCounted<Event> { 47 public: 48 enum PhaseType { 49 NONE = 0, 50 CAPTURING_PHASE = 1, 51 AT_TARGET = 2, 52 BUBBLING_PHASE = 3 53 }; 55 enum EventType { 56 MOUSEDOWN = 1, 57 MOUSEUP = 2, 58 MOUSEOVER = 4, 59 MOUSEOUT = 8, 60 MOUSEMOVE = 16, 61 MOUSEDRAG = 32, 62 CLICK = 64, 63 DBLCLICK = 128, 64 KEYDOWN = 256, 65 KEYUP = 512, 66 KEYPRESS = 1024, 67 DRAGDROP = 2048, 68 FOCUS = 4096, 69 BLUR = 8192, 70 SELECT = 16384, 71 CHANGE = 32768 72 }; 54 73 55 enum EventType { 56 MOUSEDOWN = 1, 57 MOUSEUP = 2, 58 MOUSEOVER = 4, 59 MOUSEOUT = 8, 60 MOUSEMOVE = 16, 61 MOUSEDRAG = 32, 62 CLICK = 64, 63 DBLCLICK = 128, 64 KEYDOWN = 256, 65 KEYUP = 512, 66 KEYPRESS = 1024, 67 DRAGDROP = 2048, 68 FOCUS = 4096, 69 BLUR = 8192, 70 SELECT = 16384, 71 CHANGE = 32768 72 }; 74 static PassRefPtr<Event> create() 75 { 76 return adoptRef(new Event); 77 } 78 static PassRefPtr<Event> create(const AtomicString& type, bool canBubble, bool cancelable) 79 { 80 return adoptRef(new Event(type, canBubble, cancelable)); 81 } 73 82 74 static PassRefPtr<Event> create() 75 { 76 return adoptRef(new Event); 77 } 78 static PassRefPtr<Event> create(const AtomicString& type, bool canBubble, bool cancelable) 79 { 80 return adoptRef(new Event(type, canBubble, cancelable)); 81 } 83 static PassRefPtr<Event> create(const AtomicString& type, const EventInit& initializer) 84 { 85 return adoptRef(new Event(type, initializer)); 86 } 82 87 83 static PassRefPtr<Event> create(const AtomicString& type, const EventInit& initializer) 84 { 85 return adoptRef(new Event(type, initializer)); 86 } 88 virtual ~Event(); 87 89 88 virtual ~Event();90 void initEvent(const AtomicString& type, bool canBubble, bool cancelable); 89 91 90 void initEvent(const AtomicString& type, bool canBubble, bool cancelable); 92 const AtomicString& type() const { return m_type; } 93 94 EventTarget* target() const { return m_target.get(); } 95 void setTarget(PassRefPtr<EventTarget>); 91 96 92 const AtomicString& type() const { return m_type; } 93 94 EventTarget* target() const { return m_target.get(); } 95 void setTarget(PassRefPtr<EventTarget>); 97 EventTarget* currentTarget() const { return m_currentTarget; } 98 void setCurrentTarget(EventTarget* currentTarget) { m_currentTarget = currentTarget; } 96 99 97 EventTarget* currentTarget() const { return m_currentTarget; }98 void setCurrentTarget(EventTarget* currentTarget) { m_currentTarget = currentTarget; }100 unsigned short eventPhase() const { return m_eventPhase; } 101 void setEventPhase(unsigned short eventPhase) { m_eventPhase = eventPhase; } 99 102 100 unsigned short eventPhase() const { return m_eventPhase; } 101 void setEventPhase(unsigned short eventPhase) { m_eventPhase = eventPhase; } 103 bool bubbles() const { return m_canBubble; } 104 bool cancelable() const { return m_cancelable; } 105 DOMTimeStamp timeStamp() const { return m_createTime; } 102 106 103 bool bubbles() const { return m_canBubble; } 104 bool cancelable() const { return m_cancelable; } 105 DOMTimeStamp timeStamp() const { return m_createTime; } 107 void stopPropagation() { m_propagationStopped = true; } 108 void stopImmediatePropagation() { m_immediatePropagationStopped = true; } 109 110 // IE Extensions 111 EventTarget* srcElement() const { return target(); } // MSIE extension - "the object that fired the event" 106 112 107 void stopPropagation() { m_propagationStopped = true; } 108 void stopImmediatePropagation() { m_immediatePropagationStopped = true; } 109 110 // IE Extensions 111 EventTarget* srcElement() const { return target(); } // MSIE extension - "the object that fired the event" 113 bool returnValue() const { return !defaultPrevented(); } 114 void setReturnValue(bool returnValue) { setDefaultPrevented(!returnValue); } 112 115 113 bool returnValue() const { return !defaultPrevented(); } 114 void setReturnValue(bool returnValue) { setDefaultPrevented(!returnValue); } 116 Clipboard* clipboardData() const { return isClipboardEvent() ? clipboard() : 0; } 115 117 116 Clipboard* clipboardData() const { return isClipboardEvent() ? clipboard() : 0; } 118 virtual const AtomicString& interfaceName() const; 119 bool hasInterface(const AtomicString&) const; 117 120 118 virtual const AtomicString& interfaceName() const; 119 bool hasInterface(const AtomicString&) const; 121 // These events are general classes of events. 122 virtual bool isUIEvent() const; 123 virtual bool isMouseEvent() const; 124 virtual bool isKeyboardEvent() const; 125 virtual bool isTouchEvent() const; 120 126 121 // These events are general classes of events. 122 virtual bool isUIEvent() const; 123 virtual bool isMouseEvent() const; 124 virtual bool isKeyboardEvent() const; 125 virtual bool isTouchEvent() const; 127 // Drag events are a subset of mouse events. 128 virtual bool isDragEvent() const; 126 129 127 // Drag events are a subset of mouse events. 128 virtual bool isDragEvent() const; 130 // These events lack a DOM interface. 131 virtual bool isClipboardEvent() const; 132 virtual bool isBeforeTextInsertedEvent() const; 129 133 130 // These events lack a DOM interface. 131 virtual bool isClipboardEvent() const; 132 virtual bool isBeforeTextInsertedEvent() const; 134 bool propagationStopped() const { return m_propagationStopped || m_immediatePropagationStopped; } 135 bool immediatePropagationStopped() const { return m_immediatePropagationStopped; } 133 136 134 bool propagationStopped() const { return m_propagationStopped || m_immediatePropagationStopped; } 135 bool immediatePropagationStopped() const { return m_immediatePropagationStopped; } 137 bool defaultPrevented() const { return m_defaultPrevented; } 138 void preventDefault() 139 { 140 if (m_cancelable) 141 m_defaultPrevented = true; 142 } 143 void setDefaultPrevented(bool defaultPrevented) { m_defaultPrevented = defaultPrevented; } 136 144 137 bool defaultPrevented() const { return m_defaultPrevented; } 138 void preventDefault() { if (m_cancelable) m_defaultPrevented = true; } 139 void setDefaultPrevented(bool defaultPrevented) { m_defaultPrevented = defaultPrevented; } 145 bool defaultHandled() const { return m_defaultHandled; } 146 void setDefaultHandled() { m_defaultHandled = true; } 140 147 141 bool defaultHandled() const { return m_defaultHandled; }142 void setDefaultHandled() { m_defaultHandled = true; }148 bool cancelBubble() const { return m_cancelBubble; } 149 void setCancelBubble(bool cancel) { m_cancelBubble = cancel; } 143 150 144 bool cancelBubble() const { return m_cancelBubble; }145 void setCancelBubble(bool cancel) { m_cancelBubble = cancel; }151 Event* underlyingEvent() const { return m_underlyingEvent.get(); } 152 void setUnderlyingEvent(PassRefPtr<Event>); 146 153 147 Event* underlyingEvent() const { return m_underlyingEvent.get(); }148 void setUnderlyingEvent(PassRefPtr<Event>);154 virtual bool storesResultAsString() const; 155 virtual void storeResult(const String&); 149 156 150 virtual bool storesResultAsString() const; 151 virtual void storeResult(const String&); 157 virtual Clipboard* clipboard() const { return 0; } 152 158 153 virtual Clipboard* clipboard() const { return 0; }159 bool isBeingDispatched() const { return eventPhase(); } 154 160 155 bool isBeingDispatched() const { return eventPhase(); }161 virtual void reportMemoryUsage(MemoryObjectInfo*) const; 156 162 157 virtual void reportMemoryUsage(MemoryObjectInfo*) const;163 virtual PassRefPtr<Event> cloneFor(HTMLIFrameElement*) const; 158 164 159 virtual PassRefPtr<Event> cloneFor(HTMLIFrameElement*) const; 165 protected: 166 Event(); 167 Event(const AtomicString& type, bool canBubble, bool cancelable); 168 Event(const AtomicString& type, const EventInit&); 160 169 161 protected: 162 Event(); 163 Event(const AtomicString& type, bool canBubble, bool cancelable); 164 Event(const AtomicString& type, const EventInit&); 170 virtual void receivedTarget(); 171 bool dispatched() const { return m_target; } 165 172 166 virtual void receivedTarget(); 167 bool dispatched() const { return m_target; } 173 private: 174 AtomicString m_type; 175 bool m_canBubble; 176 bool m_cancelable; 168 177 169 private: 170 AtomicString m_type; 171 bool m_canBubble; 172 bool m_cancelable; 178 bool m_propagationStopped; 179 bool m_immediatePropagationStopped; 180 bool m_defaultPrevented; 181 bool m_defaultHandled; 182 bool m_cancelBubble; 173 183 174 bool m_propagationStopped; 175 bool m_immediatePropagationStopped; 176 bool m_defaultPrevented; 177 bool m_defaultHandled; 178 bool m_cancelBubble; 184 unsigned short m_eventPhase; 185 EventTarget* m_currentTarget; 186 RefPtr<EventTarget> m_target; 187 DOMTimeStamp m_createTime; 179 188 180 unsigned short m_eventPhase; 181 EventTarget* m_currentTarget; 182 RefPtr<EventTarget> m_target; 183 DOMTimeStamp m_createTime; 184 185 RefPtr<Event> m_underlyingEvent; 186 }; 189 RefPtr<Event> m_underlyingEvent; 190 }; 187 191 188 192 } // namespace WebCore
Note: See TracChangeset
for help on using the changeset viewer.