Make all ScriptWrappable IsoHeap-ed
[WebKit-https.git] / Source / WebCore / dom / KeyboardEvent.cpp
index eed5bd9..0f294fc 100644 (file)
 #include "Frame.h"
 #include "PlatformKeyboardEvent.h"
 #include "WindowsKeyboardCodes.h"
+#include <wtf/IsoMallocInlines.h>
 
 namespace WebCore {
 
-static inline const AtomicString& eventTypeForKeyboardEventType(PlatformEvent::Type type)
+WTF_MAKE_ISO_ALLOCATED_IMPL(KeyboardEvent);
+
+static inline const AtomString& eventTypeForKeyboardEventType(PlatformEvent::Type type)
 {
     switch (type) {
         case PlatformEvent::KeyUp:
@@ -96,7 +99,7 @@ inline KeyboardEvent::KeyboardEvent() = default;
 inline KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, RefPtr<WindowProxy>&& view)
     : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), CanBubble::Yes, IsCancelable::Yes, IsComposed::Yes,
         key.timestamp().approximateMonotonicTime(), view.copyRef(), 0, key.modifiers(), IsTrusted::Yes)
-    , m_underlyingPlatformEvent(std::make_unique<PlatformKeyboardEvent>(key))
+    , m_underlyingPlatformEvent(makeUnique<PlatformKeyboardEvent>(key))
 #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
     , m_key(key.key())
 #endif
@@ -107,14 +110,16 @@ inline KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, RefPtr<Win
     , m_location(keyLocationCode(key))
     , m_repeat(key.isAutoRepeat())
     , m_isComposing(view && is<DOMWindow>(view->window()) && downcast<DOMWindow>(*view->window()).frame() && downcast<DOMWindow>(*view->window()).frame()->editor().hasComposition())
-#if USE(APPKIT)
+#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS)
     , m_handledByInputMethod(key.handledByInputMethod())
+#endif
+#if USE(APPKIT)
     , m_keypressCommands(key.commands())
 #endif
 {
 }
 
-inline KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const Init& initializer)
+inline KeyboardEvent::KeyboardEvent(const AtomString& eventType, const Init& initializer)
     : UIEventWithKeyState(eventType, initializer)
 #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
     , m_key(initializer.key)
@@ -144,12 +149,12 @@ Ref<KeyboardEvent> KeyboardEvent::createForBindings()
     return adoptRef(*new KeyboardEvent);
 }
 
-Ref<KeyboardEvent> KeyboardEvent::create(const AtomicString& type, const Init& initializer)
+Ref<KeyboardEvent> KeyboardEvent::create(const AtomString& type, const Init& initializer)
 {
     return adoptRef(*new KeyboardEvent(type, initializer));
 }
 
-void KeyboardEvent::initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view,
+void KeyboardEvent::initKeyboardEvent(const AtomString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view,
     const String& keyIdentifier, unsigned location, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey)
 {
     if (isBeingDispatched())
@@ -162,12 +167,12 @@ void KeyboardEvent::initKeyboardEvent(const AtomicString& type, bool canBubble,
 
     setModifierKeys(ctrlKey, altKey, shiftKey, metaKey, altGraphKey);
 
-    m_charCode = std::nullopt;
+    m_charCode = WTF::nullopt;
     m_isComposing = false;
-    m_keyCode = std::nullopt;
+    m_keyCode = WTF::nullopt;
     m_repeat = false;
     m_underlyingPlatformEvent = nullptr;
-    m_which = std::nullopt;
+    m_which = WTF::nullopt;
 
 #if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
     m_code = { };