| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 20 matching lines...) Expand all Loading... |
| 31 #include "core/events/UIEvent.h" | 31 #include "core/events/UIEvent.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 class FocusEvent final : public UIEvent { | 35 class FocusEvent final : public UIEvent { |
| 36 DEFINE_WRAPPERTYPEINFO(); | 36 DEFINE_WRAPPERTYPEINFO(); |
| 37 | 37 |
| 38 public: | 38 public: |
| 39 static FocusEvent* create() { return new FocusEvent; } | 39 static FocusEvent* create() { return new FocusEvent; } |
| 40 | 40 |
| 41 static FocusEvent* create(const AtomicString& type, | 41 static FocusEvent* create( |
| 42 bool canBubble, | 42 const AtomicString& type, |
| 43 bool cancelable, | 43 bool canBubble, |
| 44 AbstractView* view, | 44 bool cancelable, |
| 45 int detail, | 45 AbstractView* view, |
| 46 EventTarget* relatedTarget, | 46 int detail, |
| 47 InputDeviceCapabilities* sourceCapabilities) { | 47 EventTarget* relatedTarget, |
| 48 const InputDeviceCapabilitiesValue& sourceCapabilities) { |
| 48 return new FocusEvent(type, canBubble, cancelable, view, detail, | 49 return new FocusEvent(type, canBubble, cancelable, view, detail, |
| 49 relatedTarget, sourceCapabilities); | 50 relatedTarget, sourceCapabilities); |
| 50 } | 51 } |
| 51 | 52 |
| 52 static FocusEvent* create(const AtomicString& type, | 53 static FocusEvent* create(const AtomicString& type, |
| 53 const FocusEventInit& initializer) { | 54 const FocusEventInit& initializer) { |
| 54 return new FocusEvent(type, initializer); | 55 return new FocusEvent(type, initializer); |
| 55 } | 56 } |
| 56 | 57 |
| 57 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } | 58 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } |
| 58 void setRelatedTarget(EventTarget* relatedTarget) { | 59 void setRelatedTarget(EventTarget* relatedTarget) { |
| 59 m_relatedTarget = relatedTarget; | 60 m_relatedTarget = relatedTarget; |
| 60 } | 61 } |
| 61 | 62 |
| 62 const AtomicString& interfaceName() const override; | 63 const AtomicString& interfaceName() const override; |
| 63 bool isFocusEvent() const override; | 64 bool isFocusEvent() const override; |
| 64 | 65 |
| 65 EventDispatchMediator* createMediator() override; | 66 EventDispatchMediator* createMediator() override; |
| 66 | 67 |
| 67 DECLARE_VIRTUAL_TRACE(); | 68 DECLARE_VIRTUAL_TRACE(); |
| 68 | 69 |
| 69 private: | 70 private: |
| 70 FocusEvent(); | 71 FocusEvent(); |
| 71 FocusEvent(const AtomicString& type, | 72 FocusEvent(const AtomicString& type, |
| 72 bool canBubble, | 73 bool canBubble, |
| 73 bool cancelable, | 74 bool cancelable, |
| 74 AbstractView*, | 75 AbstractView*, |
| 75 int, | 76 int, |
| 76 EventTarget*, | 77 EventTarget*, |
| 77 InputDeviceCapabilities*); | 78 const InputDeviceCapabilitiesValue&); |
| 78 FocusEvent(const AtomicString& type, const FocusEventInit&); | 79 FocusEvent(const AtomicString& type, const FocusEventInit&); |
| 79 | 80 |
| 80 Member<EventTarget> m_relatedTarget; | 81 Member<EventTarget> m_relatedTarget; |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 DEFINE_EVENT_TYPE_CASTS(FocusEvent); | 84 DEFINE_EVENT_TYPE_CASTS(FocusEvent); |
| 84 | 85 |
| 85 class FocusEventDispatchMediator final : public EventDispatchMediator { | 86 class FocusEventDispatchMediator final : public EventDispatchMediator { |
| 86 public: | 87 public: |
| 87 static FocusEventDispatchMediator* create(FocusEvent*); | 88 static FocusEventDispatchMediator* create(FocusEvent*); |
| 88 | 89 |
| 89 private: | 90 private: |
| 90 explicit FocusEventDispatchMediator(FocusEvent*); | 91 explicit FocusEventDispatchMediator(FocusEvent*); |
| 91 FocusEvent& event() const { | 92 FocusEvent& event() const { |
| 92 return static_cast<FocusEvent&>(EventDispatchMediator::event()); | 93 return static_cast<FocusEvent&>(EventDispatchMediator::event()); |
| 93 } | 94 } |
| 94 DispatchEventResult dispatchEvent(EventDispatcher&) const override; | 95 DispatchEventResult dispatchEvent(EventDispatcher&) const override; |
| 95 }; | 96 }; |
| 96 | 97 |
| 97 } // namespace blink | 98 } // namespace blink |
| 98 | 99 |
| 99 #endif // FocusEvent_h | 100 #endif // FocusEvent_h |
| OLD | NEW |