summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/FocusEvent.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/dom/FocusEvent.h')
-rw-r--r--Source/WebCore/dom/FocusEvent.h54
1 files changed, 17 insertions, 37 deletions
diff --git a/Source/WebCore/dom/FocusEvent.h b/Source/WebCore/dom/FocusEvent.h
index 474f45db9..7733173cf 100644
--- a/Source/WebCore/dom/FocusEvent.h
+++ b/Source/WebCore/dom/FocusEvent.h
@@ -23,8 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef FocusEvent_h
-#define FocusEvent_h
+#pragma once
#include "EventTarget.h"
#include "UIEvent.h"
@@ -33,55 +32,36 @@ namespace WebCore {
class Node;
-struct FocusEventInit : public UIEventInit {
- FocusEventInit();
-
- RefPtr<EventTarget> relatedTarget;
-};
-
-class FocusEvent : public UIEvent {
+class FocusEvent final : public UIEvent {
public:
- static PassRefPtr<FocusEvent> create()
+ static Ref<FocusEvent> create(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail, RefPtr<EventTarget>&& relatedTarget)
{
- return adoptRef(new FocusEvent);
+ return adoptRef(*new FocusEvent(type, canBubble, cancelable, view, detail, WTFMove(relatedTarget)));
}
- static PassRefPtr<FocusEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view, int detail, PassRefPtr<EventTarget> relatedTarget)
- {
- return adoptRef(new FocusEvent(type, canBubble, cancelable, view, detail, relatedTarget));
- }
+ struct Init : UIEventInit {
+ RefPtr<EventTarget> relatedTarget;
+ };
- static PassRefPtr<FocusEvent> create(const AtomicString& type, const FocusEventInit& initializer)
+ static Ref<FocusEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No)
{
- return adoptRef(new FocusEvent(type, initializer));
+ return adoptRef(*new FocusEvent(type, initializer, isTrusted));
}
- virtual EventTarget* relatedTarget() const override final { return m_relatedTarget.get(); }
- void setRelatedTarget(PassRefPtr<EventTarget> relatedTarget) { m_relatedTarget = relatedTarget; }
+ EventTarget* relatedTarget() const override { return m_relatedTarget.get(); }
+ void setRelatedTarget(RefPtr<EventTarget>&& relatedTarget) { m_relatedTarget = WTFMove(relatedTarget); }
- virtual EventInterface eventInterface() const override;
- virtual bool isFocusEvent() const override;
+ EventInterface eventInterface() const override;
private:
- FocusEvent();
- FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, int, PassRefPtr<EventTarget>);
- FocusEvent(const AtomicString& type, const FocusEventInit&);
+ FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int, RefPtr<EventTarget>&&);
+ FocusEvent(const AtomicString& type, const Init&, IsTrusted);
+
+ bool isFocusEvent() const override;
RefPtr<EventTarget> m_relatedTarget;
};
-inline FocusEvent* toFocusEvent(Event* event)
-{
- ASSERT_WITH_SECURITY_IMPLICATION(event && event->isFocusEvent());
- return static_cast<FocusEvent*>(event);
-}
-
-inline FocusEvent& toFocusEvent(Event& event)
-{
- ASSERT(event.isFocusEvent());
- return static_cast<FocusEvent&>(event);
-}
-
} // namespace WebCore
-#endif // FocusEvent_h
+SPECIALIZE_TYPE_TRAITS_EVENT(FocusEvent)