Web Inspector: save sheet should be anchored underneath the tab bar when detached
[WebKit-https.git] / Source / WebCore / replay / UserInputBridge.cpp
index 364a3f0..66e4517 100644 (file)
 #include "FocusController.h"
 #include "Frame.h"
 #include "FrameLoadRequest.h"
-#include "MainFrame.h"
+#include "FrameLoader.h"
 #include "Page.h"
 #include "PlatformKeyboardEvent.h"
 #include "PlatformMouseEvent.h"
 #include "PlatformWheelEvent.h"
 
-#if ENABLE(WEB_REPLAY)
-#include "ReplayController.h"
-#include "SerializationMethods.h"
-#include "WebReplayInputs.h"
-#include <replay/InputCursor.h>
-#endif
-
-#define EARLY_RETURN_IF_SHOULD_IGNORE_INPUT \
-    do { \
-        if (inputSource == InputSource::User && m_state == UserInputBridge::State::Replaying) \
-            return true; \
-    } while (false)
-
 namespace WebCore {
 
 UserInputBridge::UserInputBridge(Page& page)
     : m_page(page)
-#if ENABLE(WEB_REPLAY)
-    , m_state(UserInputBridge::State::Open)
-#endif
 {
 }
 
-#if ENABLE(WEB_REPLAY)
-InputCursor& UserInputBridge::activeCursor() const
-{
-    return m_page.replayController().activeInputCursor();
-}
-#endif
-
 #if ENABLE(CONTEXT_MENUS)
-bool UserInputBridge::handleContextMenuEvent(const PlatformMouseEvent& mouseEvent, const Frame* frame, InputSource)
+bool UserInputBridge::handleContextMenuEvent(const PlatformMouseEvent& mouseEvent, Frame& frame, InputSource)
 {
-    return frame->eventHandler().sendContextMenuEvent(mouseEvent);
+    return frame.eventHandler().sendContextMenuEvent(mouseEvent);
 }
 #endif
 
-bool UserInputBridge::handleMousePressEvent(const PlatformMouseEvent& mouseEvent, InputSource inputSource)
+bool UserInputBridge::handleMousePressEvent(const PlatformMouseEvent& mouseEvent, InputSource)
 {
-#if ENABLE(WEB_REPLAY)
-    EARLY_RETURN_IF_SHOULD_IGNORE_INPUT;
-
-    InputCursor& cursor = activeCursor();
-    if (cursor.isCapturing()) {
-        std::unique_ptr<PlatformMouseEvent> ownedEvent = std::make_unique<PlatformMouseEvent>(mouseEvent);
-        cursor.appendInput<HandleMousePress>(std::move(ownedEvent));
-    }
-    EventLoopInputExtent extent(cursor);
-#else
-    UNUSED_PARAM(inputSource);
-#endif
-
     return m_page.mainFrame().eventHandler().handleMousePressEvent(mouseEvent);
 }
 
-bool UserInputBridge::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent, InputSource inputSource)
+bool UserInputBridge::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent, InputSource)
 {
-#if ENABLE(WEB_REPLAY)
-    EARLY_RETURN_IF_SHOULD_IGNORE_INPUT;
-
-    InputCursor& cursor = activeCursor();
-    if (cursor.isCapturing()) {
-        std::unique_ptr<PlatformMouseEvent> ownedEvent = std::make_unique<PlatformMouseEvent>(mouseEvent);
-        cursor.appendInput<HandleMouseRelease>(std::move(ownedEvent));
-    }
-    EventLoopInputExtent extent(cursor);
-#else
-    UNUSED_PARAM(inputSource);
-#endif
-
     return m_page.mainFrame().eventHandler().handleMouseReleaseEvent(mouseEvent);
 }
 
-bool UserInputBridge::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, InputSource inputSource)
+bool UserInputBridge::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, InputSource)
 {
-#if ENABLE(WEB_REPLAY)
-    EARLY_RETURN_IF_SHOULD_IGNORE_INPUT;
-
-    InputCursor& cursor = activeCursor();
-    if (cursor.isCapturing()) {
-        std::unique_ptr<PlatformMouseEvent> ownedEvent = std::make_unique<PlatformMouseEvent>(mouseEvent);
-        cursor.appendInput<HandleMouseMove>(std::move(ownedEvent), false);
-    }
-    EventLoopInputExtent extent(cursor);
-#else
-    UNUSED_PARAM(inputSource);
-#endif
-
     return m_page.mainFrame().eventHandler().mouseMoved(mouseEvent);
 }
 
-bool UserInputBridge::handleMouseMoveOnScrollbarEvent(const PlatformMouseEvent& mouseEvent, InputSource inputSource)
+bool UserInputBridge::handleMouseMoveOnScrollbarEvent(const PlatformMouseEvent& mouseEvent, InputSource)
 {
-#if ENABLE(WEB_REPLAY)
-    EARLY_RETURN_IF_SHOULD_IGNORE_INPUT;
-
-    InputCursor& cursor = activeCursor();
-    if (cursor.isCapturing()) {
-        std::unique_ptr<PlatformMouseEvent> ownedEvent = std::make_unique<PlatformMouseEvent>(mouseEvent);
-        cursor.appendInput<HandleMouseMove>(std::move(ownedEvent), true);
-    }
-    EventLoopInputExtent extent(cursor);
-#else
-    UNUSED_PARAM(inputSource);
-#endif
-
     return m_page.mainFrame().eventHandler().passMouseMovedEventToScrollbars(mouseEvent);
 }
 
-bool UserInputBridge::handleKeyEvent(const PlatformKeyboardEvent& keyEvent, InputSource inputSource)
+bool UserInputBridge::handleMouseForceEvent(const PlatformMouseEvent& mouseEvent, InputSource)
 {
-#if ENABLE(WEB_REPLAY)
-    EARLY_RETURN_IF_SHOULD_IGNORE_INPUT;
-
-    InputCursor& cursor = activeCursor();
-    if (cursor.isCapturing()) {
-        std::unique_ptr<PlatformKeyboardEvent> ownedEvent = std::make_unique<PlatformKeyboardEvent>(keyEvent);
-        cursor.appendInput<HandleKeyPress>(std::move(ownedEvent));
-    }
-    EventLoopInputExtent extent(cursor);
-#else
-    UNUSED_PARAM(inputSource);
-#endif
+    return m_page.mainFrame().eventHandler().handleMouseForceEvent(mouseEvent);
+}
 
+bool UserInputBridge::handleKeyEvent(const PlatformKeyboardEvent& keyEvent, InputSource)
+{
     return m_page.focusController().focusedOrMainFrame().eventHandler().keyEvent(keyEvent);
 }
 
@@ -170,21 +87,8 @@ bool UserInputBridge::handleAccessKeyEvent(const PlatformKeyboardEvent& keyEvent
     return m_page.focusController().focusedOrMainFrame().eventHandler().handleAccessKey(keyEvent);
 }
 
-bool UserInputBridge::handleWheelEvent(const PlatformWheelEvent& wheelEvent, InputSource inputSource)
+bool UserInputBridge::handleWheelEvent(const PlatformWheelEvent& wheelEvent, InputSource)
 {
-#if ENABLE(WEB_REPLAY)
-    EARLY_RETURN_IF_SHOULD_IGNORE_INPUT;
-
-    InputCursor& cursor = activeCursor();
-    if (cursor.isCapturing()) {
-        std::unique_ptr<PlatformWheelEvent> ownedEvent = std::make_unique<PlatformWheelEvent>(wheelEvent);
-        cursor.appendInput<HandleWheelEvent>(std::move(ownedEvent));
-    }
-    EventLoopInputExtent extent(cursor);
-#else
-    UNUSED_PARAM(inputSource);
-#endif
-
     return m_page.mainFrame().eventHandler().handleWheelEvent(wheelEvent);
 }
 
@@ -198,48 +102,24 @@ void UserInputBridge::focusSetFocused(bool focused, InputSource)
     m_page.focusController().setFocused(focused);
 }
 
-bool UserInputBridge::scrollRecursively(ScrollDirection direction, ScrollGranularity granularity, InputSource inputSource)
+bool UserInputBridge::scrollRecursively(ScrollDirection direction, ScrollGranularity granularity, InputSource)
 {
-#if ENABLE(WEB_REPLAY)
-    EARLY_RETURN_IF_SHOULD_IGNORE_INPUT;
-
-    InputCursor& cursor = activeCursor();
-    if (cursor.isCapturing())
-        cursor.appendInput<ScrollPage>(direction, granularity);
-
-    EventLoopInputExtent extent(cursor);
-#else
-    UNUSED_PARAM(inputSource);
-#endif
-
     return m_page.focusController().focusedOrMainFrame().eventHandler().scrollRecursively(direction, granularity, nullptr);
 }
 
-bool UserInputBridge::logicalScrollRecursively(ScrollLogicalDirection direction, ScrollGranularity granularity, InputSource inputSource)
+bool UserInputBridge::logicalScrollRecursively(ScrollLogicalDirection direction, ScrollGranularity granularity, InputSource)
 {
-#if ENABLE(WEB_REPLAY)
-    EARLY_RETURN_IF_SHOULD_IGNORE_INPUT;
-
-    InputCursor& cursor = activeCursor();
-    if (cursor.isCapturing())
-        cursor.appendInput<LogicalScrollPage>(direction, granularity);
-
-    EventLoopInputExtent extent(cursor);
-#else
-    UNUSED_PARAM(inputSource);
-#endif
-
     return m_page.focusController().focusedOrMainFrame().eventHandler().logicalScrollRecursively(direction, granularity, nullptr);
 }
 
-void UserInputBridge::loadRequest(const FrameLoadRequest& request, InputSource)
+void UserInputBridge::loadRequest(FrameLoadRequest&& request, InputSource)
 {
-    m_page.mainFrame().loader().load(request);
+    m_page.mainFrame().loader().load(WTFMove(request));
 }
 
-void UserInputBridge::reloadFrame(Frame* frame, bool endToEndReload, InputSource)
+void UserInputBridge::reloadFrame(Frame* frame, OptionSet<ReloadOption> options, InputSource)
 {
-    frame->loader().reload(endToEndReload);
+    frame->loader().reload(options);
 }
 
 void UserInputBridge::stopLoadingFrame(Frame* frame, InputSource)