Diff
Modified: trunk/Source/WebKit2/ChangeLog (210926 => 210927)
--- trunk/Source/WebKit2/ChangeLog 2017-01-19 17:28:24 UTC (rev 210926)
+++ trunk/Source/WebKit2/ChangeLog 2017-01-19 17:52:36 UTC (rev 210927)
@@ -1,3 +1,58 @@
+2017-01-19 Brian Burg <[email protected]>
+
+ Web Inspector: move Mac-specific automation commands to a separate implementation file
+ https://bugs.webkit.org/show_bug.cgi?id=163297
+ <rdar://problem/28718990>
+
+ Reviewed by Timothy Hatcher.
+
+ Not all Automation commands are available on all platforms. Start splitting out
+ command declarations and implementations based on the target platform.
+
+ * DerivedSources.make:
+ Set an appropriate --platform so the correct backend interface is generated.
+
+ * UIProcess/Automation/Automation.json:
+ Guard commands that should not be available on iOS:
+ - resizeWindowOfBrowsingContext
+ - moveWindowOfBrowsingContext
+ - inspectBrowsingContext
+
+ * UIProcess/Automation/WebAutomationSession.cpp:
+ (WebKit::WebAutomationSession::platformSimulateKeySequence): Deleted.
+ - Move shared convenience macros to header file.
+ - Move out Cocoa-only or Mac-only command implementations.
+
+ * UIProcess/Automation/WebAutomationSession.h:
+ Rearrange some declarations and switch from USE(APPKIT) to PLATFORM(MAC).
+
+ * UIProcess/Automation/WebAutomationSessionMacros.h: Added.
+
+ * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm: Added.
+ (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData):
+ Moved from WebAutomationSessionCocoa.mm. Add iOS-specific header includes.
+
+ * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Renamed from Source/WebKit2/UIProcess/Cocoa/WebAutomationSessionCocoa.mm.
+ (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext):
+ (WebKit::WebAutomationSession::moveWindowOfBrowsingContext):
+ (WebKit::WebAutomationSession::inspectBrowsingContext):
+ Move macOS platform command implementations to here. If other desktop ports want
+ to use these commands, we can move them somewhere else later.
+
+ (WebKit::WebAutomationSession::sendSynthesizedEventsToPage):
+ (WebKit::WebAutomationSession::markEventAsSynthesizedForAutomation):
+ (WebKit::WebAutomationSession::wasEventSynthesizedForAutomation):
+ Move out AppKit-specific event simulation code to here.
+
+ (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
+ (WebKit::WebAutomationSession::platformSimulateKeyStroke):
+ (WebKit::WebAutomationSession::platformSimulateKeySequence):
+ Move out Mac platformFoo implementations to here.
+
+ * WebKit2.xcodeproj/project.pbxproj:
+ - Added UIProcess/Automation/{mac,cocoa} groups.
+ - Add new platform-specific implementation files.
+
2017-01-19 Carlos Garcia Campos <[email protected]>
[GTK] Provide API to set proxy settings
Modified: trunk/Source/WebKit2/DerivedSources.make (210926 => 210927)
--- trunk/Source/WebKit2/DerivedSources.make 2017-01-19 17:28:24 UTC (rev 210926)
+++ trunk/Source/WebKit2/DerivedSources.make 2017-01-19 17:52:36 UTC (rev 210927)
@@ -234,9 +234,17 @@
AutomationBackendDispatchers.cpp \
#
+ifeq ($(OS),MACOS)
+ifeq ($(shell $(CC) -std=gnu++11 -x c++ -E -P -dM $(SDK_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep ' WTF_PLATFORM_IOS ' | cut -d' ' -f3), 1)
+ AUTOMATION_BACKEND_PLATFORM_ARGUMENTS = --platform iOS
+else
+ AUTOMATION_BACKEND_PLATFORM_ARGUMENTS = --platform macOS
+endif
+endif # MACOS
+
# JSON-RPC Backend Dispatchers, Type Builders
$(firstword $(AUTOMATION_PROTOCOL_OUTPUT_FILES)) : $(AUTOMATION_PROTOCOL_INPUT_FILES) $(AUTOMATION_PROTOCOL_GENERATOR_SCRIPTS)
- $(PYTHON) $(_javascript_Core_SCRIPTS_DIR)/generate-inspector-protocol-bindings.py --framework WebKit --backend --outputDir . $(AUTOMATION_PROTOCOL_INPUT_FILES)
+ $(PYTHON) $(_javascript_Core_SCRIPTS_DIR)/generate-inspector-protocol-bindings.py --framework WebKit $(AUTOMATION_BACKEND_PLATFORM_ARGUMENTS) --backend --outputDir . $(AUTOMATION_PROTOCOL_INPUT_FILES)
all : $(firstword $(AUTOMATION_PROTOCOL_OUTPUT_FILES))
Modified: trunk/Source/WebKit2/UIProcess/Automation/Automation.json (210926 => 210927)
--- trunk/Source/WebKit2/UIProcess/Automation/Automation.json 2017-01-19 17:28:24 UTC (rev 210926)
+++ trunk/Source/WebKit2/UIProcess/Automation/Automation.json 2017-01-19 17:52:36 UTC (rev 210927)
@@ -248,6 +248,7 @@
{
"name": "resizeWindowOfBrowsingContext",
"description": "Resizes the window of the specified browsing context to the specified size.",
+ "platform": "macOS",
"parameters": [
{ "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context to be resized." },
{ "name": "size", "$ref": "Size", "description": "The new size for the browsing context's window." }
@@ -256,6 +257,7 @@
{
"name": "moveWindowOfBrowsingContext",
"description": "Moves the window of the specified browsing context to the specified position.",
+ "platform": "macOS",
"parameters": [
{ "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context to be moved." },
{ "name": "origin", "$ref": "Point", "description": "The new origin for the browsing context's window. The position is interpreted in screen coordinate space, relative to the upper left corner of the screen." }
@@ -297,6 +299,7 @@
{
"name": "inspectBrowsingContext",
"description": "Inspect the specified browsing context using Web Inspector.",
+ "platform": "macOS",
"parameters": [
{ "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context that should be inspected." },
{ "name": "enableAutoCapturing", "type": "boolean", "optional": true, "description": "If this option is present and set to true, the Web Inspector will automatically start a timeline recording of the specified browsing context once it is attached. Note that this disables the debugger for the duration of the recording." }
Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp (210926 => 210927)
--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp 2017-01-19 17:28:24 UTC (rev 210926)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp 2017-01-19 17:52:36 UTC (rev 210927)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016, 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,6 +28,7 @@
#include "APIAutomationSessionClient.h"
#include "AutomationProtocolObjects.h"
+#include "WebAutomationSessionMacros.h"
#include "WebAutomationSessionMessages.h"
#include "WebAutomationSessionProxyMessages.h"
#include "WebCookieManagerProxy.h"
@@ -44,32 +45,6 @@
using namespace Inspector;
-static const char* const errorNameAndDetailsSeparator = ";";
-
-// Make sure the predefined error name is valid, otherwise use InternalError.
-#define VALIDATED_ERROR_MESSAGE(errorString) Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::ErrorMessage>(errorString).value_or(Inspector::Protocol::Automation::ErrorMessage::InternalError)
-
-// If the error name is incorrect for these macros, it will be a compile-time error.
-#define STRING_FOR_PREDEFINED_ERROR_NAME(errorName) Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::errorName)
-#define STRING_FOR_PREDEFINED_ERROR_NAME_AND_DETAILS(errorName, detailsString) makeString(Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::errorName), errorNameAndDetailsSeparator, detailsString)
-
-// If the error message is not a predefined error, InternalError will be used instead.
-#define STRING_FOR_PREDEFINED_ERROR_MESSAGE(errorMessage) Inspector::Protocol::AutomationHelpers::getEnumConstantValue(VALIDATED_ERROR_MESSAGE(errorMessage))
-#define STRING_FOR_PREDEFINED_ERROR_MESSAGE_AND_DETAILS(errorMessage, detailsString) makeString(Inspector::Protocol::AutomationHelpers::getEnumConstantValue(VALIDATED_ERROR_MESSAGE(errorMessage)), errorNameAndDetailsSeparator, detailsString)
-
-// Convenience macros for filling in the error string of synchronous commands in bailout branches.
-#define FAIL_WITH_PREDEFINED_ERROR(errorName) \
-do { \
- errorString = STRING_FOR_PREDEFINED_ERROR_NAME(errorName); \
- return; \
-} while (false)
-
-#define FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(errorName, detailsString) \
-do { \
- errorString = STRING_FOR_PREDEFINED_ERROR_NAME_AND_DETAILS(errorName, detailsString); \
- return; \
-} while (false)
-
namespace WebKit {
WebAutomationSession::WebAutomationSession()
@@ -245,6 +220,8 @@
.release();
}
+// Platform-independent Commands.
+
void WebAutomationSession::getBrowsingContexts(Inspector::ErrorString& errorString, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>>& contexts)
{
contexts = Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>::create();
@@ -311,80 +288,6 @@
page->process().send(Messages::WebAutomationSessionProxy::FocusFrame(page->pageID(), frameID.value()), 0);
}
-void WebAutomationSession::resizeWindowOfBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const Inspector::InspectorObject& sizeObject)
-{
- float width;
- if (!sizeObject.getDouble(WTF::ASCIILiteral("width"), width))
- FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(MissingParameter, "The 'width' parameter was not found or invalid.");
-
- float height;
- if (!sizeObject.getDouble(WTF::ASCIILiteral("height"), height))
- FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(MissingParameter, "The 'height' parameter was not found or invalid.");
-
- if (width < 0)
- FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The 'width' parameter had an invalid value.");
-
- if (height < 0)
- FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The 'height' parameter had an invalid value.");
-
- WebPageProxy* page = webPageProxyForHandle(handle);
- if (!page)
- FAIL_WITH_PREDEFINED_ERROR(WindowNotFound);
-
- WebCore::FloatRect originalFrame;
- page->getWindowFrame(originalFrame);
-
- WebCore::FloatRect newFrame = WebCore::FloatRect(originalFrame.location(), WebCore::FloatSize(width, height));
- if (newFrame == originalFrame)
- return;
-
- page->setWindowFrame(newFrame);
-
- // If nothing changed at all, it's probably fair to report that something went wrong.
- // (We can't assume that the requested frame size will be honored exactly, however.)
- WebCore::FloatRect updatedFrame;
- page->getWindowFrame(updatedFrame);
- if (originalFrame == updatedFrame)
- FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InternalError, "The window size was expected to have changed, but did not.");
-}
-
-void WebAutomationSession::moveWindowOfBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const Inspector::InspectorObject& positionObject)
-{
- float x;
- if (!positionObject.getDouble(WTF::ASCIILiteral("x"), x))
- FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(MissingParameter, "The 'x' parameter was not found or invalid.");
-
- float y;
- if (!positionObject.getDouble(WTF::ASCIILiteral("y"), y))
- FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(MissingParameter, "The 'y' parameter was not found or invalid.");
-
- if (x < 0)
- FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The 'x' parameter had an invalid value.");
-
- if (y < 0)
- FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The 'y' parameter had an invalid value.");
-
- WebPageProxy* page = webPageProxyForHandle(handle);
- if (!page)
- FAIL_WITH_PREDEFINED_ERROR(WindowNotFound);
-
- WebCore::FloatRect originalFrame;
- page->getWindowFrame(originalFrame);
-
- WebCore::FloatRect newFrame = WebCore::FloatRect(WebCore::FloatPoint(x, y), originalFrame.size());
- if (newFrame == originalFrame)
- return;
-
- page->setWindowFrame(newFrame);
-
- // If nothing changed at all, it's probably fair to report that something went wrong.
- // (We can't assume that the requested frame size will be honored exactly, however.)
- WebCore::FloatRect updatedFrame;
- page->getWindowFrame(updatedFrame);
- if (originalFrame == updatedFrame)
- FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InternalError, "The window position was expected to have changed, but did not.");
-}
-
void WebAutomationSession::navigateBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const String& url, Ref<NavigateBrowsingContextCallback>&& callback)
{
WebPageProxy* page = webPageProxyForHandle(handle);
@@ -438,27 +341,6 @@
page->reload(reloadFromOrigin, { });
}
-void WebAutomationSession::inspectBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const bool* optionalEnableAutoCapturing, Ref<InspectBrowsingContextCallback>&& callback)
-{
- WebPageProxy* page = webPageProxyForHandle(handle);
- if (!page)
- FAIL_WITH_PREDEFINED_ERROR(WindowNotFound);
-
- if (auto callback = m_pendingInspectorCallbacksPerPage.take(page->pageID()))
- callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_NAME(Timeout));
- m_pendingInspectorCallbacksPerPage.set(page->pageID(), WTFMove(callback));
-
- // Don't bring the inspector to front since this may be done automatically.
- // We just want it loaded so it can pause if a breakpoint is hit during a command.
- if (page->inspector()) {
- page->inspector()->connect();
-
- // Start collecting profile information immediately so the entire session is captured.
- if (optionalEnableAutoCapturing && *optionalEnableAutoCapturing)
- page->inspector()->togglePageProfiling();
- }
-}
-
void WebAutomationSession::navigationOccurredForPage(const WebPageProxy& page)
{
if (auto callback = m_pendingNavigationInBrowsingContextCallbacksPerPage.take(page.pageID()))
@@ -1043,7 +925,9 @@
callback->sendSuccess(base64EncodedData);
}
-#if !USE(APPKIT)
+// Platform-dependent Implementation Stubs.
+
+#if !PLATFORM(MAC)
void WebAutomationSession::platformSimulateMouseInteraction(WebKit::WebPageProxy&, const WebCore::IntPoint&, Inspector::Protocol::Automation::MouseInteraction, Inspector::Protocol::Automation::MouseButton, WebEvent::Modifiers)
{
}
@@ -1055,11 +939,13 @@
void WebAutomationSession::platformSimulateKeySequence(WebPageProxy&, const String&)
{
}
+#endif // !PLATFORM(MAC)
+#if !PLATFORM(COCOA)
String WebAutomationSession::platformGetBase64EncodedPNGData(const ShareableBitmap::Handle&)
{
return String();
}
-#endif // !USE(APPKIT)
+#endif // !PLATFORM(COCOA)
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h (210926 => 210927)
--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h 2017-01-19 17:28:24 UTC (rev 210926)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h 2017-01-19 17:52:36 UTC (rev 210927)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016, 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -96,18 +96,19 @@
void terminate();
// Inspector::AutomationBackendDispatcherHandler API
+ // NOTE: the set of declarations included in this interface depend on the "platform" property in Automation.json
+ // and the --platform argument passed to the protocol bindings generator.
+
+ // Platform: Generic
void getBrowsingContexts(Inspector::ErrorString&, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>>&) override;
void getBrowsingContext(Inspector::ErrorString&, const String&, RefPtr<Inspector::Protocol::Automation::BrowsingContext>&) override;
void createBrowsingContext(Inspector::ErrorString&, String*) override;
void closeBrowsingContext(Inspector::ErrorString&, const String&) override;
void switchToBrowsingContext(Inspector::ErrorString&, const String& browsingContextHandle, const String* optionalFrameHandle) override;
- void resizeWindowOfBrowsingContext(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& size) override;
- void moveWindowOfBrowsingContext(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& position) override;
void navigateBrowsingContext(Inspector::ErrorString&, const String& handle, const String& url, Ref<NavigateBrowsingContextCallback>&&) override;
void goBackInBrowsingContext(Inspector::ErrorString&, const String&, Ref<GoBackInBrowsingContextCallback>&&) override;
void goForwardInBrowsingContext(Inspector::ErrorString&, const String&, Ref<GoForwardInBrowsingContextCallback>&&) override;
void reloadBrowsingContext(Inspector::ErrorString&, const String&, Ref<ReloadBrowsingContextCallback>&&) override;
- void inspectBrowsingContext(Inspector::ErrorString&, const String&, const bool* optionalEnableAutoCapturing, Ref<InspectBrowsingContextCallback>&&) override;
void evaluateJavaScriptFunction(Inspector::ErrorString&, const String& browsingContextHandle, const String* optionalFrameHandle, const String& function, const Inspector::InspectorArray& arguments, const bool* optionalExpectsImplicitCallbackArgument, const int* optionalCallbackTimeout, Ref<Inspector::AutomationBackendDispatcherHandler::EvaluateJavaScriptFunctionCallback>&&) override;
void performMouseInteraction(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& requestedPosition, const String& mouseButton, const String& mouseInteraction, const Inspector::InspectorArray& keyModifiers, RefPtr<Inspector::Protocol::Automation::Point>& updatedPosition) override;
void performKeyboardInteractions(Inspector::ErrorString&, const String& handle, const Inspector::InspectorArray& interactions, Ref<PerformKeyboardInteractionsCallback>&&) override;
@@ -124,7 +125,16 @@
void deleteSingleCookie(Inspector::ErrorString&, const String& browsingContextHandle, const String& cookieName, Ref<DeleteSingleCookieCallback>&&) override;
void addSingleCookie(Inspector::ErrorString&, const String& browsingContextHandle, const Inspector::InspectorObject& cookie, Ref<AddSingleCookieCallback>&&) override;
void deleteAllCookies(Inspector::ErrorString&, const String& browsingContextHandle) override;
-#if USE(APPKIT)
+
+ // Platform: macOS
+#if PLATFORM(MAC)
+ void resizeWindowOfBrowsingContext(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& size) override;
+ void moveWindowOfBrowsingContext(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& position) override;
+ void inspectBrowsingContext(Inspector::ErrorString&, const String&, const bool* optionalEnableAutoCapturing, Ref<InspectBrowsingContextCallback>&&) override;
+#endif
+
+ // Event Simulation Support.
+#if PLATFORM(MAC)
bool wasEventSynthesizedForAutomation(NSEvent *);
void markEventAsSynthesizedForAutomation(NSEvent *);
#endif
@@ -138,10 +148,10 @@
String handleForWebFrameID(uint64_t frameID);
String handleForWebFrameProxy(const WebFrameProxy&);
- // Implemented in generated WebAutomationSessionMessageReceiver.cpp
+ // Implemented in generated WebAutomationSessionMessageReceiver.cpp.
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
- // Called by WebAutomationSession messages
+ // Called by WebAutomationSession messages.
void didEvaluateJavaScriptFunction(uint64_t callbackID, const String& result, const String& errorType);
void didResolveChildFrame(uint64_t callbackID, uint64_t frameID, const String& errorType);
void didResolveParentFrame(uint64_t callbackID, uint64_t frameID, const String& errorType);
@@ -150,7 +160,7 @@
void didGetCookiesForFrame(uint64_t callbackID, Vector<WebCore::Cookie>, const String& errorType);
void didDeleteCookie(uint64_t callbackID, const String& errorType);
- // Platform-specific helper methods.
+ // Platform-dependent implementations.
void platformSimulateMouseInteraction(WebPageProxy&, const WebCore::IntPoint& viewPosition, Inspector::Protocol::Automation::MouseInteraction, Inspector::Protocol::Automation::MouseButton, WebEvent::Modifiers);
// Simulates a single virtual key being pressed, such as Control, F-keys, Numpad keys, etc. as allowed by the protocol.
void platformSimulateKeyStroke(WebPageProxy&, Inspector::Protocol::Automation::KeyboardInteractionType, Inspector::Protocol::Automation::VirtualKey);
@@ -159,7 +169,7 @@
// Get base64 encoded PNG data from a bitmap.
String platformGetBase64EncodedPNGData(const ShareableBitmap::Handle&);
-#if USE(APPKIT)
+#if PLATFORM(MAC)
void sendSynthesizedEventsToPage(WebPageProxy&, NSArray *eventsToSend);
#endif
Added: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSessionMacros.h (0 => 210927)
--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSessionMacros.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSessionMacros.h 2017-01-19 17:52:36 UTC (rev 210927)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#define errorNameAndDetailsSeparator ";"
+
+// Make sure the predefined error name is valid, otherwise use InternalError.
+#define VALIDATED_ERROR_MESSAGE(errorString) Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::ErrorMessage>(errorString).value_or(Inspector::Protocol::Automation::ErrorMessage::InternalError)
+
+// If the error name is incorrect for these macros, it will be a compile-time error.
+#define STRING_FOR_PREDEFINED_ERROR_NAME(errorName) Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::errorName)
+#define STRING_FOR_PREDEFINED_ERROR_NAME_AND_DETAILS(errorName, detailsString) makeString(Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::errorName), errorNameAndDetailsSeparator, detailsString)
+
+// If the error message is not a predefined error, InternalError will be used instead.
+#define STRING_FOR_PREDEFINED_ERROR_MESSAGE(errorMessage) Inspector::Protocol::AutomationHelpers::getEnumConstantValue(VALIDATED_ERROR_MESSAGE(errorMessage))
+#define STRING_FOR_PREDEFINED_ERROR_MESSAGE_AND_DETAILS(errorMessage, detailsString) makeString(Inspector::Protocol::AutomationHelpers::getEnumConstantValue(VALIDATED_ERROR_MESSAGE(errorMessage)), errorNameAndDetailsSeparator, detailsString)
+
+// Convenience macros for filling in the error string of synchronous commands in bailout branches.
+#define FAIL_WITH_PREDEFINED_ERROR(errorName) \
+do { \
+ errorString = STRING_FOR_PREDEFINED_ERROR_NAME(errorName); \
+ return; \
+} while (false)
+
+#define FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(errorName, detailsString) \
+do { \
+ errorString = STRING_FOR_PREDEFINED_ERROR_NAME_AND_DETAILS(errorName, detailsString); \
+ return; \
+} while (false)
Added: trunk/Source/WebKit2/UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm (0 => 210927)
--- trunk/Source/WebKit2/UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm 2017-01-19 17:52:36 UTC (rev 210927)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2016, 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WebAutomationSession.h"
+
+#if PLATFORM(COCOA)
+
+#if PLATFORM(IOS)
+#include <ImageIO/CGImageDestination.h>
+#include <MobileCoreServices/UTCoreTypes.h>
+#endif
+
+using namespace WebCore;
+
+namespace WebKit {
+
+String WebAutomationSession::platformGetBase64EncodedPNGData(const ShareableBitmap::Handle& imageDataHandle)
+{
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(imageDataHandle, SharedMemory::Protection::ReadOnly);
+ RetainPtr<CGImageRef> cgImage = bitmap->makeCGImage();
+ RetainPtr<NSMutableData> imageData = adoptNS([[NSMutableData alloc] init]);
+ RetainPtr<CGImageDestinationRef> destination = adoptCF(CGImageDestinationCreateWithData((CFMutableDataRef)imageData.get(), kUTTypePNG, 1, 0));
+ if (!destination)
+ return String();
+
+ CGImageDestinationAddImage(destination.get(), cgImage.get(), 0);
+ CGImageDestinationFinalize(destination.get());
+
+ return [imageData base64EncodedStringWithOptions:0];
+}
+
+} // namespace WebKit
+
+#endif // PLATFORM(COCOA)
Copied: trunk/Source/WebKit2/UIProcess/Automation/mac/WebAutomationSessionMac.mm (from rev 210926, trunk/Source/WebKit2/UIProcess/Cocoa/WebAutomationSessionCocoa.mm) (0 => 210927)
--- trunk/Source/WebKit2/UIProcess/Automation/mac/WebAutomationSessionMac.mm (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Automation/mac/WebAutomationSessionMac.mm 2017-01-19 17:52:36 UTC (rev 210927)
@@ -0,0 +1,594 @@
+/*
+ * Copyright (C) 2016, 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WebAutomationSession.h"
+
+#if PLATFORM(MAC)
+
+#import "WebAutomationSessionMacros.h"
+#import "WebInspectorProxy.h"
+#import "WebPageProxy.h"
+#import "_WKAutomationSession.h"
+#import <HIToolbox/Events.h>
+#import <WebCore/IntPoint.h>
+#import <WebCore/IntSize.h>
+#import <WebCore/PlatformMouseEvent.h>
+#import <objc/runtime.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+#pragma mark Commands for Platform: 'macOS'
+
+void WebAutomationSession::resizeWindowOfBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const Inspector::InspectorObject& sizeObject)
+{
+ float width;
+ if (!sizeObject.getDouble(WTF::ASCIILiteral("width"), width))
+ FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(MissingParameter, "The 'width' parameter was not found or invalid.");
+
+ float height;
+ if (!sizeObject.getDouble(WTF::ASCIILiteral("height"), height))
+ FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(MissingParameter, "The 'height' parameter was not found or invalid.");
+
+ if (width < 0)
+ FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The 'width' parameter had an invalid value.");
+
+ if (height < 0)
+ FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The 'height' parameter had an invalid value.");
+
+ WebPageProxy* page = webPageProxyForHandle(handle);
+ if (!page)
+ FAIL_WITH_PREDEFINED_ERROR(WindowNotFound);
+
+ WebCore::FloatRect originalFrame;
+ page->getWindowFrame(originalFrame);
+
+ WebCore::FloatRect newFrame = WebCore::FloatRect(originalFrame.location(), WebCore::FloatSize(width, height));
+ if (newFrame == originalFrame)
+ return;
+
+ page->setWindowFrame(newFrame);
+
+ // If nothing changed at all, it's probably fair to report that something went wrong.
+ // (We can't assume that the requested frame size will be honored exactly, however.)
+ WebCore::FloatRect updatedFrame;
+ page->getWindowFrame(updatedFrame);
+ if (originalFrame == updatedFrame)
+ FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InternalError, "The window size was expected to have changed, but did not.");
+}
+
+void WebAutomationSession::moveWindowOfBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const Inspector::InspectorObject& positionObject)
+{
+ float x;
+ if (!positionObject.getDouble(WTF::ASCIILiteral("x"), x))
+ FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(MissingParameter, "The 'x' parameter was not found or invalid.");
+
+ float y;
+ if (!positionObject.getDouble(WTF::ASCIILiteral("y"), y))
+ FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(MissingParameter, "The 'y' parameter was not found or invalid.");
+
+ if (x < 0)
+ FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The 'x' parameter had an invalid value.");
+
+ if (y < 0)
+ FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The 'y' parameter had an invalid value.");
+
+ WebPageProxy* page = webPageProxyForHandle(handle);
+ if (!page)
+ FAIL_WITH_PREDEFINED_ERROR(WindowNotFound);
+
+ WebCore::FloatRect originalFrame;
+ page->getWindowFrame(originalFrame);
+
+ WebCore::FloatRect newFrame = WebCore::FloatRect(WebCore::FloatPoint(x, y), originalFrame.size());
+ if (newFrame == originalFrame)
+ return;
+
+ page->setWindowFrame(newFrame);
+
+ // If nothing changed at all, it's probably fair to report that something went wrong.
+ // (We can't assume that the requested frame size will be honored exactly, however.)
+ WebCore::FloatRect updatedFrame;
+ page->getWindowFrame(updatedFrame);
+ if (originalFrame == updatedFrame)
+ FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InternalError, "The window position was expected to have changed, but did not.");
+}
+
+void WebAutomationSession::inspectBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const bool* optionalEnableAutoCapturing, Ref<InspectBrowsingContextCallback>&& callback)
+{
+ WebPageProxy* page = webPageProxyForHandle(handle);
+ if (!page)
+ FAIL_WITH_PREDEFINED_ERROR(WindowNotFound);
+
+ if (auto callback = m_pendingInspectorCallbacksPerPage.take(page->pageID()))
+ callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_NAME(Timeout));
+ m_pendingInspectorCallbacksPerPage.set(page->pageID(), WTFMove(callback));
+
+ // Don't bring the inspector to front since this may be done automatically.
+ // We just want it loaded so it can pause if a breakpoint is hit during a command.
+ if (page->inspector()) {
+ page->inspector()->connect();
+
+ // Start collecting profile information immediately so the entire session is captured.
+ if (optionalEnableAutoCapturing && *optionalEnableAutoCapturing)
+ page->inspector()->togglePageProfiling();
+ }
+}
+
+#pragma mark AppKit Event Simulation Support
+
+static const NSInteger synthesizedMouseEventMagicEventNumber = 0;
+static const void *synthesizedAutomationEventAssociatedObjectKey = &synthesizedAutomationEventAssociatedObjectKey;
+
+void WebAutomationSession::sendSynthesizedEventsToPage(WebPageProxy& page, NSArray *eventsToSend)
+{
+ NSWindow *window = page.platformWindow();
+
+ for (NSEvent *event in eventsToSend) {
+ // Take focus back in case the Inspector became focused while the prior command or
+ // NSEvent was delivered to the window.
+ [window makeKeyAndOrderFront:nil];
+
+ markEventAsSynthesizedForAutomation(event);
+ [window sendEvent:event];
+ }
+}
+
+void WebAutomationSession::markEventAsSynthesizedForAutomation(NSEvent *event)
+{
+ objc_setAssociatedObject(event, &synthesizedAutomationEventAssociatedObjectKey, m_sessionIdentifier, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+bool WebAutomationSession::wasEventSynthesizedForAutomation(NSEvent *event)
+{
+ NSString *senderSessionIdentifier = objc_getAssociatedObject(event, &synthesizedAutomationEventAssociatedObjectKey);
+ if ([senderSessionIdentifier isEqualToString:m_sessionIdentifier])
+ return true;
+
+ switch (event.type) {
+ case NSEventTypeLeftMouseDown:
+ case NSEventTypeLeftMouseDragged:
+ case NSEventTypeLeftMouseUp:
+ case NSEventTypeMouseMoved:
+ case NSEventTypeOtherMouseDown:
+ case NSEventTypeOtherMouseDragged:
+ case NSEventTypeOtherMouseUp:
+ case NSEventTypeRightMouseDown:
+ case NSEventTypeRightMouseDragged:
+ case NSEventTypeRightMouseUp:
+ // Use this as a backup for checking mouse events, which are frequently copied
+ // and/or faked by AppKit, causing them to lose their associated object tag.
+ return event.eventNumber == synthesizedMouseEventMagicEventNumber;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+#pragma mark Platform-dependent Implementations
+
+void WebAutomationSession::platformSimulateMouseInteraction(WebPageProxy& page, const WebCore::IntPoint& viewPosition, Inspector::Protocol::Automation::MouseInteraction interaction, Inspector::Protocol::Automation::MouseButton button, WebEvent::Modifiers keyModifiers)
+{
+ IntRect windowRect;
+ page.rootViewToWindow(IntRect(viewPosition, IntSize()), windowRect);
+ IntPoint windowPosition = windowRect.location();
+
+ NSEventModifierFlags modifiers = 0;
+ if (keyModifiers & WebEvent::MetaKey)
+ modifiers |= NSEventModifierFlagCommand;
+ if (keyModifiers & WebEvent::AltKey)
+ modifiers |= NSEventModifierFlagOption;
+ if (keyModifiers & WebEvent::ControlKey)
+ modifiers |= NSEventModifierFlagControl;
+ if (keyModifiers & WebEvent::ShiftKey)
+ modifiers |= NSEventModifierFlagShift;
+ if (keyModifiers & WebEvent::CapsLockKey)
+ modifiers |= NSEventModifierFlagCapsLock;
+
+ NSTimeInterval timestamp = [NSDate timeIntervalSinceReferenceDate];
+ NSWindow *window = page.platformWindow();
+ NSInteger windowNumber = window.windowNumber;
+
+ NSEventType downEventType;
+ NSEventType dragEventType;
+ NSEventType upEventType;
+ switch (button) {
+ case Inspector::Protocol::Automation::MouseButton::None:
+ downEventType = upEventType = dragEventType = NSEventTypeMouseMoved;
+ break;
+ case Inspector::Protocol::Automation::MouseButton::Left:
+ downEventType = NSEventTypeLeftMouseDown;
+ dragEventType = NSEventTypeLeftMouseDragged;
+ upEventType = NSEventTypeLeftMouseUp;
+ break;
+ case Inspector::Protocol::Automation::MouseButton::Middle:
+ downEventType = NSEventTypeOtherMouseDown;
+ dragEventType = NSEventTypeLeftMouseDragged;
+ upEventType = NSEventTypeOtherMouseUp;
+ break;
+ case Inspector::Protocol::Automation::MouseButton::Right:
+ downEventType = NSEventTypeRightMouseDown;
+ upEventType = NSEventTypeRightMouseUp;
+ break;
+ }
+
+ auto eventsToBeSent = adoptNS([[NSMutableArray alloc] init]);
+
+ NSInteger eventNumber = synthesizedMouseEventMagicEventNumber;
+
+ switch (interaction) {
+ case Inspector::Protocol::Automation::MouseInteraction::Move:
+ [eventsToBeSent addObject:[NSEvent mouseEventWithType:dragEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:0 pressure:0.0f]];
+ break;
+ case Inspector::Protocol::Automation::MouseInteraction::Down:
+ // Hard-code the click count to one, since clients don't expect successive simulated
+ // down/up events to be potentially counted as a double click event.
+ [eventsToBeSent addObject:[NSEvent mouseEventWithType:downEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:WebCore::ForceAtClick]];
+ break;
+ case Inspector::Protocol::Automation::MouseInteraction::Up:
+ // Hard-code the click count to one, since clients don't expect successive simulated
+ // down/up events to be potentially counted as a double click event.
+ [eventsToBeSent addObject:[NSEvent mouseEventWithType:upEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:0.0f]];
+ break;
+ case Inspector::Protocol::Automation::MouseInteraction::SingleClick:
+ // Send separate down and up events. WebCore will see this as a single-click event.
+ [eventsToBeSent addObject:[NSEvent mouseEventWithType:downEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:WebCore::ForceAtClick]];
+ [eventsToBeSent addObject:[NSEvent mouseEventWithType:upEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:0.0f]];
+ break;
+ case Inspector::Protocol::Automation::MouseInteraction::DoubleClick:
+ // Send multiple down and up events with proper click count.
+ // WebCore will see this as a single-click event then double-click event.
+ [eventsToBeSent addObject:[NSEvent mouseEventWithType:downEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:WebCore::ForceAtClick]];
+ [eventsToBeSent addObject:[NSEvent mouseEventWithType:upEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:0.0f]];
+ [eventsToBeSent addObject:[NSEvent mouseEventWithType:downEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:2 pressure:WebCore::ForceAtClick]];
+ [eventsToBeSent addObject:[NSEvent mouseEventWithType:upEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:2 pressure:0.0f]];
+ }
+
+ sendSynthesizedEventsToPage(page, eventsToBeSent.get());
+}
+
+void WebAutomationSession::platformSimulateKeyStroke(WebPageProxy& page, Inspector::Protocol::Automation::KeyboardInteractionType interaction, Inspector::Protocol::Automation::VirtualKey key)
+{
+ // If true, the key's modifier flags should affect other events while pressed down.
+ bool isStickyModifier = false;
+ // The modifiers changed by the virtual key when it is pressed or released.
+ // The mapping from keys to modifiers is specified in the documentation for NSEvent.
+ NSEventModifierFlags changedModifiers = 0;
+ // The likely keyCode for the virtual key as defined in <HIToolbox/Events.h>.
+ int keyCode = 0;
+ // Typical characters produced by the virtual key, if any.
+ NSString *characters = @"";
+
+ // FIXME: this function and the Automation protocol enum should probably adopt key names
+ // from W3C UIEvents standard. For more details: https://w3c.github.io/uievents-code/
+
+ switch (key) {
+ case Inspector::Protocol::Automation::VirtualKey::Shift:
+ isStickyModifier = true;
+ changedModifiers |= NSEventModifierFlagShift;
+ keyCode = kVK_Shift;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Control:
+ isStickyModifier = true;
+ changedModifiers |= NSEventModifierFlagControl;
+ keyCode = kVK_Control;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Alternate:
+ isStickyModifier = true;
+ changedModifiers |= NSEventModifierFlagOption;
+ keyCode = kVK_Option;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Meta:
+ // The 'meta' key does not exist on Apple keyboards and is usually
+ // mapped to the Command key when using third-party keyboards.
+ case Inspector::Protocol::Automation::VirtualKey::Command:
+ isStickyModifier = true;
+ changedModifiers |= NSEventModifierFlagCommand;
+ keyCode = kVK_Command;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Help:
+ changedModifiers |= NSEventModifierFlagHelp | NSEventModifierFlagFunction;
+ keyCode = kVK_Help;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Backspace:
+ keyCode = kVK_Delete;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Tab:
+ keyCode = kVK_Tab;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Clear:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ keyCode = kVK_ANSI_KeypadClear;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Enter:
+ keyCode = kVK_ANSI_KeypadEnter;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Pause:
+ // The 'pause' key does not exist on Apple keyboards and has no keycode.
+ // The semantics are unclear so just abort and do nothing.
+ return;
+ case Inspector::Protocol::Automation::VirtualKey::Cancel:
+ // The 'cancel' key does not exist on Apple keyboards and has no keycode.
+ // According to the internet its functionality is similar to 'Escape'.
+ case Inspector::Protocol::Automation::VirtualKey::Escape:
+ keyCode = kVK_Escape;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::PageUp:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_PageUp;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::PageDown:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_PageDown;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::End:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_End;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Home:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_Home;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::LeftArrow:
+ changedModifiers |= NSEventModifierFlagNumericPad | NSEventModifierFlagFunction;
+ keyCode = kVK_LeftArrow;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::UpArrow:
+ changedModifiers |= NSEventModifierFlagNumericPad | NSEventModifierFlagFunction;
+ keyCode = kVK_UpArrow;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::RightArrow:
+ changedModifiers |= NSEventModifierFlagNumericPad | NSEventModifierFlagFunction;
+ keyCode = kVK_RightArrow;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::DownArrow:
+ changedModifiers |= NSEventModifierFlagNumericPad | NSEventModifierFlagFunction;
+ keyCode = kVK_DownArrow;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Insert:
+ // The 'insert' key does not exist on Apple keyboards and has no keycode.
+ // The semantics are unclear so just abort and do nothing.
+ return;
+ case Inspector::Protocol::Automation::VirtualKey::Delete:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_ForwardDelete;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Space:
+ keyCode = kVK_Space;
+ characters = @" ";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Semicolon:
+ keyCode = kVK_ANSI_Semicolon;
+ characters = @";";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Equals:
+ keyCode = kVK_ANSI_Equal;
+ characters = @"=";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Return:
+ keyCode = kVK_Return;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::NumberPad0:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ keyCode = kVK_ANSI_Keypad0;
+ characters = @"0";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::NumberPad1:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ keyCode = kVK_ANSI_Keypad1;
+ characters = @"1";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::NumberPad2:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ keyCode = kVK_ANSI_Keypad2;
+ characters = @"2";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::NumberPad3:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ keyCode = kVK_ANSI_Keypad3;
+ characters = @"3";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::NumberPad4:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ keyCode = kVK_ANSI_Keypad4;
+ characters = @"4";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::NumberPad5:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ keyCode = kVK_ANSI_Keypad5;
+ characters = @"5";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::NumberPad6:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ keyCode = kVK_ANSI_Keypad6;
+ characters = @"6";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::NumberPad7:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ keyCode = kVK_ANSI_Keypad7;
+ characters = @"7";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::NumberPad8:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ keyCode = kVK_ANSI_Keypad8;
+ characters = @"8";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::NumberPad9:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ keyCode = kVK_ANSI_Keypad9;
+ characters = @"9";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::NumberPadMultiply:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ keyCode = kVK_ANSI_KeypadMultiply;
+ characters = @"*";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::NumberPadAdd:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ keyCode = kVK_ANSI_KeypadPlus;
+ characters = @"+";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::NumberPadSubtract:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ keyCode = kVK_ANSI_KeypadMinus;
+ characters = @"-";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::NumberPadSeparator:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ // The 'Separator' key is only present on a few international keyboards.
+ // It is usually mapped to the same character as Decimal ('.' or ',').
+ FALLTHROUGH;
+ case Inspector::Protocol::Automation::VirtualKey::NumberPadDecimal:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ keyCode = kVK_ANSI_KeypadDecimal;
+ // FIXME: this might be locale-dependent. See the above comment.
+ characters = @".";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::NumberPadDivide:
+ changedModifiers |= NSEventModifierFlagNumericPad;
+ keyCode = kVK_ANSI_KeypadDivide;
+ characters = @"/";
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Function1:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_F1;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Function2:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_F2;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Function3:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_F3;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Function4:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_F4;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Function5:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_F5;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Function6:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_F6;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Function7:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_F7;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Function8:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_F8;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Function9:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_F9;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Function10:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_F10;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Function11:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_F11;
+ break;
+ case Inspector::Protocol::Automation::VirtualKey::Function12:
+ changedModifiers |= NSEventModifierFlagFunction;
+ keyCode = kVK_F12;
+ break;
+ }
+
+ auto eventsToBeSent = adoptNS([[NSMutableArray alloc] init]);
+
+ ASSERT(isStickyModifier || interaction == Inspector::Protocol::Automation::KeyboardInteractionType::KeyPress);
+
+ NSEventModifierFlags existingModifiers = [NSEvent modifierFlags];
+ NSEventModifierFlags updatedModifiers = 0;
+ NSTimeInterval timestamp = [NSDate timeIntervalSinceReferenceDate];
+ NSWindow *window = page.platformWindow();
+ NSInteger windowNumber = window.windowNumber;
+ NSPoint eventPosition = NSMakePoint(0, window.frame.size.height);
+
+ switch (interaction) {
+ case Inspector::Protocol::Automation::KeyboardInteractionType::KeyPress: {
+ NSEventType eventType = isStickyModifier ? NSEventTypeFlagsChanged : NSEventTypeKeyDown;
+ updatedModifiers = existingModifiers | changedModifiers;
+ [eventsToBeSent addObject:[NSEvent keyEventWithType:eventType location:eventPosition modifierFlags:updatedModifiers timestamp:timestamp windowNumber:windowNumber context:nil characters:characters charactersIgnoringModifiers:characters isARepeat:NO keyCode:keyCode]];
+ break;
+ }
+ case Inspector::Protocol::Automation::KeyboardInteractionType::KeyRelease: {
+ NSEventType eventType = isStickyModifier ? NSEventTypeFlagsChanged : NSEventTypeKeyUp;
+ updatedModifiers = existingModifiers & ~changedModifiers;
+ [eventsToBeSent addObject:[NSEvent keyEventWithType:eventType location:eventPosition modifierFlags:updatedModifiers timestamp:timestamp windowNumber:windowNumber context:nil characters:characters charactersIgnoringModifiers:characters isARepeat:NO keyCode:keyCode]];
+ break;
+ }
+ case Inspector::Protocol::Automation::KeyboardInteractionType::InsertByKey: {
+ // Sticky modifiers should either be 'KeyPress' or 'KeyRelease'.
+ ASSERT(!isStickyModifier);
+ if (isStickyModifier)
+ return;
+
+ updatedModifiers = existingModifiers | changedModifiers;
+ [eventsToBeSent addObject:[NSEvent keyEventWithType:NSEventTypeKeyDown location:eventPosition modifierFlags:updatedModifiers timestamp:timestamp windowNumber:windowNumber context:nil characters:characters charactersIgnoringModifiers:characters isARepeat:NO keyCode:keyCode]];
+ [eventsToBeSent addObject:[NSEvent keyEventWithType:NSEventTypeKeyUp location:eventPosition modifierFlags:updatedModifiers timestamp:timestamp windowNumber:windowNumber context:nil characters:characters charactersIgnoringModifiers:characters isARepeat:NO keyCode:keyCode]];
+ break;
+ }
+ }
+
+ sendSynthesizedEventsToPage(page, eventsToBeSent.get());
+}
+
+void WebAutomationSession::platformSimulateKeySequence(WebPageProxy& page, const String& keySequence)
+{
+ auto eventsToBeSent = adoptNS([[NSMutableArray alloc] init]);
+
+ // Split the text into combining character sequences and send each separately.
+ // This has no similarity to how keyboards work when inputting complex text.
+ // This command is more similar to the 'insertText:' editing command, except
+ // that this emits keyup/keydown/keypress events for roughly each character.
+ // This API should move more towards that direction in the future.
+ NSString *text = keySequence;
+
+ NSEventModifierFlags modifiers = [NSEvent modifierFlags];
+ NSTimeInterval timestamp = [NSDate timeIntervalSinceReferenceDate];
+ NSWindow *window = page.platformWindow();
+ NSInteger windowNumber = window.windowNumber;
+ NSPoint eventPosition = NSMakePoint(0, window.frame.size.height);
+
+ [text enumerateSubstringsInRange:NSMakeRange(0, text.length) options:NSStringEnumerationByComposedCharacterSequences usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
+ [eventsToBeSent addObject:[NSEvent keyEventWithType:NSEventTypeKeyDown location:eventPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil characters:substring charactersIgnoringModifiers:substring isARepeat:NO keyCode:0]];
+ [eventsToBeSent addObject:[NSEvent keyEventWithType:NSEventTypeKeyUp location:eventPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil characters:substring charactersIgnoringModifiers:substring isARepeat:NO keyCode:0]];
+ }];
+
+ sendSynthesizedEventsToPage(page, eventsToBeSent.get());
+}
+
+} // namespace WebKit
+
+#endif // PLATFORM(MAC)
Deleted: trunk/Source/WebKit2/UIProcess/Cocoa/WebAutomationSessionCocoa.mm (210926 => 210927)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebAutomationSessionCocoa.mm 2017-01-19 17:28:24 UTC (rev 210926)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebAutomationSessionCocoa.mm 2017-01-19 17:52:36 UTC (rev 210927)
@@ -1,509 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "WebAutomationSession.h"
-
-#import "WebPageProxy.h"
-#import "_WKAutomationSession.h"
-#import <WebCore/IntPoint.h>
-#import <WebCore/IntSize.h>
-#import <WebCore/PlatformMouseEvent.h>
-#import <objc/runtime.h>
-
-#if USE(APPKIT)
-#import <HIToolbox/Events.h>
-#endif
-
-using namespace WebCore;
-
-namespace WebKit {
-
-#if USE(APPKIT)
-
-static const NSInteger synthesizedMouseEventMagicEventNumber = 0;
-static const void *synthesizedAutomationEventAssociatedObjectKey = &synthesizedAutomationEventAssociatedObjectKey;
-
-void WebAutomationSession::sendSynthesizedEventsToPage(WebPageProxy& page, NSArray *eventsToSend)
-{
- NSWindow *window = page.platformWindow();
-
- for (NSEvent *event in eventsToSend) {
- // Take focus back in case the Inspector became focused while the prior command or
- // NSEvent was delivered to the window.
- [window makeKeyAndOrderFront:nil];
-
- markEventAsSynthesizedForAutomation(event);
- [window sendEvent:event];
- }
-}
-
-void WebAutomationSession::markEventAsSynthesizedForAutomation(NSEvent *event)
-{
- objc_setAssociatedObject(event, &synthesizedAutomationEventAssociatedObjectKey, m_sessionIdentifier, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-bool WebAutomationSession::wasEventSynthesizedForAutomation(NSEvent *event)
-{
- NSString *senderSessionIdentifier = objc_getAssociatedObject(event, &synthesizedAutomationEventAssociatedObjectKey);
- if ([senderSessionIdentifier isEqualToString:m_sessionIdentifier])
- return true;
-
- switch (event.type) {
- case NSEventTypeLeftMouseDown:
- case NSEventTypeLeftMouseDragged:
- case NSEventTypeLeftMouseUp:
- case NSEventTypeMouseMoved:
- case NSEventTypeOtherMouseDown:
- case NSEventTypeOtherMouseDragged:
- case NSEventTypeOtherMouseUp:
- case NSEventTypeRightMouseDown:
- case NSEventTypeRightMouseDragged:
- case NSEventTypeRightMouseUp:
- // Use this as a backup for checking mouse events, which are frequently copied
- // and/or faked by AppKit, causing them to lose their associated object tag.
- return event.eventNumber == synthesizedMouseEventMagicEventNumber;
- default:
- break;
- }
-
- return false;
-}
-
-void WebAutomationSession::platformSimulateMouseInteraction(WebPageProxy& page, const WebCore::IntPoint& viewPosition, Inspector::Protocol::Automation::MouseInteraction interaction, Inspector::Protocol::Automation::MouseButton button, WebEvent::Modifiers keyModifiers)
-{
- IntRect windowRect;
- page.rootViewToWindow(IntRect(viewPosition, IntSize()), windowRect);
- IntPoint windowPosition = windowRect.location();
-
- NSEventModifierFlags modifiers = 0;
- if (keyModifiers & WebEvent::MetaKey)
- modifiers |= NSEventModifierFlagCommand;
- if (keyModifiers & WebEvent::AltKey)
- modifiers |= NSEventModifierFlagOption;
- if (keyModifiers & WebEvent::ControlKey)
- modifiers |= NSEventModifierFlagControl;
- if (keyModifiers & WebEvent::ShiftKey)
- modifiers |= NSEventModifierFlagShift;
- if (keyModifiers & WebEvent::CapsLockKey)
- modifiers |= NSEventModifierFlagCapsLock;
-
- NSTimeInterval timestamp = [NSDate timeIntervalSinceReferenceDate];
- NSWindow *window = page.platformWindow();
- NSInteger windowNumber = window.windowNumber;
-
- NSEventType downEventType;
- NSEventType dragEventType;
- NSEventType upEventType;
- switch (button) {
- case Inspector::Protocol::Automation::MouseButton::None:
- downEventType = upEventType = dragEventType = NSEventTypeMouseMoved;
- break;
- case Inspector::Protocol::Automation::MouseButton::Left:
- downEventType = NSEventTypeLeftMouseDown;
- dragEventType = NSEventTypeLeftMouseDragged;
- upEventType = NSEventTypeLeftMouseUp;
- break;
- case Inspector::Protocol::Automation::MouseButton::Middle:
- downEventType = NSEventTypeOtherMouseDown;
- dragEventType = NSEventTypeLeftMouseDragged;
- upEventType = NSEventTypeOtherMouseUp;
- break;
- case Inspector::Protocol::Automation::MouseButton::Right:
- downEventType = NSEventTypeRightMouseDown;
- upEventType = NSEventTypeRightMouseUp;
- break;
- }
-
- auto eventsToBeSent = adoptNS([[NSMutableArray alloc] init]);
-
- NSInteger eventNumber = synthesizedMouseEventMagicEventNumber;
-
- switch (interaction) {
- case Inspector::Protocol::Automation::MouseInteraction::Move:
- [eventsToBeSent addObject:[NSEvent mouseEventWithType:dragEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:0 pressure:0.0f]];
- break;
- case Inspector::Protocol::Automation::MouseInteraction::Down:
- // Hard-code the click count to one, since clients don't expect successive simulated
- // down/up events to be potentially counted as a double click event.
- [eventsToBeSent addObject:[NSEvent mouseEventWithType:downEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:WebCore::ForceAtClick]];
- break;
- case Inspector::Protocol::Automation::MouseInteraction::Up:
- // Hard-code the click count to one, since clients don't expect successive simulated
- // down/up events to be potentially counted as a double click event.
- [eventsToBeSent addObject:[NSEvent mouseEventWithType:upEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:0.0f]];
- break;
- case Inspector::Protocol::Automation::MouseInteraction::SingleClick:
- // Send separate down and up events. WebCore will see this as a single-click event.
- [eventsToBeSent addObject:[NSEvent mouseEventWithType:downEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:WebCore::ForceAtClick]];
- [eventsToBeSent addObject:[NSEvent mouseEventWithType:upEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:0.0f]];
- break;
- case Inspector::Protocol::Automation::MouseInteraction::DoubleClick:
- // Send multiple down and up events with proper click count.
- // WebCore will see this as a single-click event then double-click event.
- [eventsToBeSent addObject:[NSEvent mouseEventWithType:downEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:WebCore::ForceAtClick]];
- [eventsToBeSent addObject:[NSEvent mouseEventWithType:upEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:0.0f]];
- [eventsToBeSent addObject:[NSEvent mouseEventWithType:downEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:2 pressure:WebCore::ForceAtClick]];
- [eventsToBeSent addObject:[NSEvent mouseEventWithType:upEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:2 pressure:0.0f]];
- }
-
- sendSynthesizedEventsToPage(page, eventsToBeSent.get());
-}
-
-void WebAutomationSession::platformSimulateKeyStroke(WebPageProxy& page, Inspector::Protocol::Automation::KeyboardInteractionType interaction, Inspector::Protocol::Automation::VirtualKey key)
-{
- // If true, the key's modifier flags should affect other events while pressed down.
- bool isStickyModifier = false;
- // The modifiers changed by the virtual key when it is pressed or released.
- // The mapping from keys to modifiers is specified in the documentation for NSEvent.
- NSEventModifierFlags changedModifiers = 0;
- // The likely keyCode for the virtual key as defined in <HIToolbox/Events.h>.
- int keyCode = 0;
- // Typical characters produced by the virtual key, if any.
- NSString *characters = @"";
-
- // FIXME: this function and the Automation protocol enum should probably adopt key names
- // from W3C UIEvents standard. For more details: https://w3c.github.io/uievents-code/
-
- switch (key) {
- case Inspector::Protocol::Automation::VirtualKey::Shift:
- isStickyModifier = true;
- changedModifiers |= NSEventModifierFlagShift;
- keyCode = kVK_Shift;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Control:
- isStickyModifier = true;
- changedModifiers |= NSEventModifierFlagControl;
- keyCode = kVK_Control;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Alternate:
- isStickyModifier = true;
- changedModifiers |= NSEventModifierFlagOption;
- keyCode = kVK_Option;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Meta:
- // The 'meta' key does not exist on Apple keyboards and is usually
- // mapped to the Command key when using third-party keyboards.
- case Inspector::Protocol::Automation::VirtualKey::Command:
- isStickyModifier = true;
- changedModifiers |= NSEventModifierFlagCommand;
- keyCode = kVK_Command;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Help:
- changedModifiers |= NSEventModifierFlagHelp | NSEventModifierFlagFunction;
- keyCode = kVK_Help;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Backspace:
- keyCode = kVK_Delete;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Tab:
- keyCode = kVK_Tab;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Clear:
- changedModifiers |= NSEventModifierFlagNumericPad;
- keyCode = kVK_ANSI_KeypadClear;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Enter:
- keyCode = kVK_ANSI_KeypadEnter;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Pause:
- // The 'pause' key does not exist on Apple keyboards and has no keycode.
- // The semantics are unclear so just abort and do nothing.
- return;
- case Inspector::Protocol::Automation::VirtualKey::Cancel:
- // The 'cancel' key does not exist on Apple keyboards and has no keycode.
- // According to the internet its functionality is similar to 'Escape'.
- case Inspector::Protocol::Automation::VirtualKey::Escape:
- keyCode = kVK_Escape;
- break;
- case Inspector::Protocol::Automation::VirtualKey::PageUp:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_PageUp;
- break;
- case Inspector::Protocol::Automation::VirtualKey::PageDown:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_PageDown;
- break;
- case Inspector::Protocol::Automation::VirtualKey::End:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_End;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Home:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_Home;
- break;
- case Inspector::Protocol::Automation::VirtualKey::LeftArrow:
- changedModifiers |= NSEventModifierFlagNumericPad | NSEventModifierFlagFunction;
- keyCode = kVK_LeftArrow;
- break;
- case Inspector::Protocol::Automation::VirtualKey::UpArrow:
- changedModifiers |= NSEventModifierFlagNumericPad | NSEventModifierFlagFunction;
- keyCode = kVK_UpArrow;
- break;
- case Inspector::Protocol::Automation::VirtualKey::RightArrow:
- changedModifiers |= NSEventModifierFlagNumericPad | NSEventModifierFlagFunction;
- keyCode = kVK_RightArrow;
- break;
- case Inspector::Protocol::Automation::VirtualKey::DownArrow:
- changedModifiers |= NSEventModifierFlagNumericPad | NSEventModifierFlagFunction;
- keyCode = kVK_DownArrow;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Insert:
- // The 'insert' key does not exist on Apple keyboards and has no keycode.
- // The semantics are unclear so just abort and do nothing.
- return;
- case Inspector::Protocol::Automation::VirtualKey::Delete:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_ForwardDelete;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Space:
- keyCode = kVK_Space;
- characters = @" ";
- break;
- case Inspector::Protocol::Automation::VirtualKey::Semicolon:
- keyCode = kVK_ANSI_Semicolon;
- characters = @";";
- break;
- case Inspector::Protocol::Automation::VirtualKey::Equals:
- keyCode = kVK_ANSI_Equal;
- characters = @"=";
- break;
- case Inspector::Protocol::Automation::VirtualKey::Return:
- keyCode = kVK_Return;
- break;
- case Inspector::Protocol::Automation::VirtualKey::NumberPad0:
- changedModifiers |= NSEventModifierFlagNumericPad;
- keyCode = kVK_ANSI_Keypad0;
- characters = @"0";
- break;
- case Inspector::Protocol::Automation::VirtualKey::NumberPad1:
- changedModifiers |= NSEventModifierFlagNumericPad;
- keyCode = kVK_ANSI_Keypad1;
- characters = @"1";
- break;
- case Inspector::Protocol::Automation::VirtualKey::NumberPad2:
- changedModifiers |= NSEventModifierFlagNumericPad;
- keyCode = kVK_ANSI_Keypad2;
- characters = @"2";
- break;
- case Inspector::Protocol::Automation::VirtualKey::NumberPad3:
- changedModifiers |= NSEventModifierFlagNumericPad;
- keyCode = kVK_ANSI_Keypad3;
- characters = @"3";
- break;
- case Inspector::Protocol::Automation::VirtualKey::NumberPad4:
- changedModifiers |= NSEventModifierFlagNumericPad;
- keyCode = kVK_ANSI_Keypad4;
- characters = @"4";
- break;
- case Inspector::Protocol::Automation::VirtualKey::NumberPad5:
- changedModifiers |= NSEventModifierFlagNumericPad;
- keyCode = kVK_ANSI_Keypad5;
- characters = @"5";
- break;
- case Inspector::Protocol::Automation::VirtualKey::NumberPad6:
- changedModifiers |= NSEventModifierFlagNumericPad;
- keyCode = kVK_ANSI_Keypad6;
- characters = @"6";
- break;
- case Inspector::Protocol::Automation::VirtualKey::NumberPad7:
- changedModifiers |= NSEventModifierFlagNumericPad;
- keyCode = kVK_ANSI_Keypad7;
- characters = @"7";
- break;
- case Inspector::Protocol::Automation::VirtualKey::NumberPad8:
- changedModifiers |= NSEventModifierFlagNumericPad;
- keyCode = kVK_ANSI_Keypad8;
- characters = @"8";
- break;
- case Inspector::Protocol::Automation::VirtualKey::NumberPad9:
- changedModifiers |= NSEventModifierFlagNumericPad;
- keyCode = kVK_ANSI_Keypad9;
- characters = @"9";
- break;
- case Inspector::Protocol::Automation::VirtualKey::NumberPadMultiply:
- changedModifiers |= NSEventModifierFlagNumericPad;
- keyCode = kVK_ANSI_KeypadMultiply;
- characters = @"*";
- break;
- case Inspector::Protocol::Automation::VirtualKey::NumberPadAdd:
- changedModifiers |= NSEventModifierFlagNumericPad;
- keyCode = kVK_ANSI_KeypadPlus;
- characters = @"+";
- break;
- case Inspector::Protocol::Automation::VirtualKey::NumberPadSubtract:
- changedModifiers |= NSEventModifierFlagNumericPad;
- keyCode = kVK_ANSI_KeypadMinus;
- characters = @"-";
- break;
- case Inspector::Protocol::Automation::VirtualKey::NumberPadSeparator:
- changedModifiers |= NSEventModifierFlagNumericPad;
- // The 'Separator' key is only present on a few international keyboards.
- // It is usually mapped to the same character as Decimal ('.' or ',').
- FALLTHROUGH;
- case Inspector::Protocol::Automation::VirtualKey::NumberPadDecimal:
- changedModifiers |= NSEventModifierFlagNumericPad;
- keyCode = kVK_ANSI_KeypadDecimal;
- // FIXME: this might be locale-dependent. See the above comment.
- characters = @".";
- break;
- case Inspector::Protocol::Automation::VirtualKey::NumberPadDivide:
- changedModifiers |= NSEventModifierFlagNumericPad;
- keyCode = kVK_ANSI_KeypadDivide;
- characters = @"/";
- break;
- case Inspector::Protocol::Automation::VirtualKey::Function1:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_F1;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Function2:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_F2;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Function3:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_F3;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Function4:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_F4;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Function5:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_F5;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Function6:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_F6;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Function7:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_F7;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Function8:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_F8;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Function9:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_F9;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Function10:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_F10;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Function11:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_F11;
- break;
- case Inspector::Protocol::Automation::VirtualKey::Function12:
- changedModifiers |= NSEventModifierFlagFunction;
- keyCode = kVK_F12;
- break;
- }
-
- auto eventsToBeSent = adoptNS([[NSMutableArray alloc] init]);
-
- ASSERT(isStickyModifier || interaction == Inspector::Protocol::Automation::KeyboardInteractionType::KeyPress);
-
- NSEventModifierFlags existingModifiers = [NSEvent modifierFlags];
- NSEventModifierFlags updatedModifiers = 0;
- NSTimeInterval timestamp = [NSDate timeIntervalSinceReferenceDate];
- NSWindow *window = page.platformWindow();
- NSInteger windowNumber = window.windowNumber;
- NSPoint eventPosition = NSMakePoint(0, window.frame.size.height);
-
- switch (interaction) {
- case Inspector::Protocol::Automation::KeyboardInteractionType::KeyPress: {
- NSEventType eventType = isStickyModifier ? NSEventTypeFlagsChanged : NSEventTypeKeyDown;
- updatedModifiers = existingModifiers | changedModifiers;
- [eventsToBeSent addObject:[NSEvent keyEventWithType:eventType location:eventPosition modifierFlags:updatedModifiers timestamp:timestamp windowNumber:windowNumber context:nil characters:characters charactersIgnoringModifiers:characters isARepeat:NO keyCode:keyCode]];
- break;
- }
- case Inspector::Protocol::Automation::KeyboardInteractionType::KeyRelease: {
- NSEventType eventType = isStickyModifier ? NSEventTypeFlagsChanged : NSEventTypeKeyUp;
- updatedModifiers = existingModifiers & ~changedModifiers;
- [eventsToBeSent addObject:[NSEvent keyEventWithType:eventType location:eventPosition modifierFlags:updatedModifiers timestamp:timestamp windowNumber:windowNumber context:nil characters:characters charactersIgnoringModifiers:characters isARepeat:NO keyCode:keyCode]];
- break;
- }
- case Inspector::Protocol::Automation::KeyboardInteractionType::InsertByKey: {
- // Sticky modifiers should either be 'KeyPress' or 'KeyRelease'.
- ASSERT(!isStickyModifier);
- if (isStickyModifier)
- return;
-
- updatedModifiers = existingModifiers | changedModifiers;
- [eventsToBeSent addObject:[NSEvent keyEventWithType:NSEventTypeKeyDown location:eventPosition modifierFlags:updatedModifiers timestamp:timestamp windowNumber:windowNumber context:nil characters:characters charactersIgnoringModifiers:characters isARepeat:NO keyCode:keyCode]];
- [eventsToBeSent addObject:[NSEvent keyEventWithType:NSEventTypeKeyUp location:eventPosition modifierFlags:updatedModifiers timestamp:timestamp windowNumber:windowNumber context:nil characters:characters charactersIgnoringModifiers:characters isARepeat:NO keyCode:keyCode]];
- break;
- }
- }
-
- sendSynthesizedEventsToPage(page, eventsToBeSent.get());
-}
-
-void WebAutomationSession::platformSimulateKeySequence(WebPageProxy& page, const String& keySequence)
-{
- auto eventsToBeSent = adoptNS([[NSMutableArray alloc] init]);
-
- // Split the text into combining character sequences and send each separately.
- // This has no similarity to how keyboards work when inputting complex text.
- // This command is more similar to the 'insertText:' editing command, except
- // that this emits keyup/keydown/keypress events for roughly each character.
- // This API should move more towards that direction in the future.
- NSString *text = keySequence;
-
- NSEventModifierFlags modifiers = [NSEvent modifierFlags];
- NSTimeInterval timestamp = [NSDate timeIntervalSinceReferenceDate];
- NSWindow *window = page.platformWindow();
- NSInteger windowNumber = window.windowNumber;
- NSPoint eventPosition = NSMakePoint(0, window.frame.size.height);
-
- [text enumerateSubstringsInRange:NSMakeRange(0, text.length) options:NSStringEnumerationByComposedCharacterSequences usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
- [eventsToBeSent addObject:[NSEvent keyEventWithType:NSEventTypeKeyDown location:eventPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil characters:substring charactersIgnoringModifiers:substring isARepeat:NO keyCode:0]];
- [eventsToBeSent addObject:[NSEvent keyEventWithType:NSEventTypeKeyUp location:eventPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil characters:substring charactersIgnoringModifiers:substring isARepeat:NO keyCode:0]];
- }];
-
- sendSynthesizedEventsToPage(page, eventsToBeSent.get());
-}
-
-String WebAutomationSession::platformGetBase64EncodedPNGData(const ShareableBitmap::Handle& imageDataHandle)
-{
- RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(imageDataHandle, SharedMemory::Protection::ReadOnly);
- RetainPtr<CGImageRef> cgImage = bitmap->makeCGImage();
- RetainPtr<NSMutableData> imageData = adoptNS([[NSMutableData alloc] init]);
- RetainPtr<CGImageDestinationRef> destination = adoptCF(CGImageDestinationCreateWithData((CFMutableDataRef)imageData.get(), kUTTypePNG, 1, 0));
- if (!destination)
- return String();
-
- CGImageDestinationAddImage(destination.get(), cgImage.get(), 0);
- CGImageDestinationFinalize(destination.get());
-
- return [imageData base64EncodedStringWithOptions:0];
-}
-
-#endif // USE(APPKIT)
-
-} // namespace WebKit
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (210926 => 210927)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2017-01-19 17:28:24 UTC (rev 210926)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2017-01-19 17:52:36 UTC (rev 210927)
@@ -1323,7 +1323,9 @@
9955A6F51C7986E000EB6A93 /* AutomationBackendDispatchers.h in Headers */ = {isa = PBXBuildFile; fileRef = 9955A6F11C79866400EB6A93 /* AutomationBackendDispatchers.h */; };
9955A6F61C7986E300EB6A93 /* AutomationProtocolObjects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9955A6F21C79866400EB6A93 /* AutomationProtocolObjects.cpp */; };
9955A6F71C7986E500EB6A93 /* AutomationProtocolObjects.h in Headers */ = {isa = PBXBuildFile; fileRef = 9955A6F31C79866400EB6A93 /* AutomationProtocolObjects.h */; };
- 9986BDD71CA9A22C004800AA /* WebAutomationSessionCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9986BDD61CA9A222004800AA /* WebAutomationSessionCocoa.mm */; };
+ 99C3AE241DAD8E3700AF5C16 /* WebAutomationSessionMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 99C3AE231DAD8E3400AF5C16 /* WebAutomationSessionMac.mm */; };
+ 99C3AE271DAD948900AF5C16 /* WebAutomationSessionCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 99C3AE261DAD948500AF5C16 /* WebAutomationSessionCocoa.mm */; };
+ 99C3AE2D1DADA6AD00AF5C16 /* WebAutomationSessionMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 99C3AE2C1DADA6A700AF5C16 /* WebAutomationSessionMacros.h */; };
99C81D591C20E1E5005C4C82 /* AutomationClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 99C81D561C20DFBE005C4C82 /* AutomationClient.mm */; };
99C81D5A1C20E7E2005C4C82 /* AutomationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 99C81D551C20DFBE005C4C82 /* AutomationClient.h */; };
99C81D5D1C21F38B005C4C82 /* APIAutomationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 99C81D5B1C20E817005C4C82 /* APIAutomationClient.h */; };
@@ -3475,7 +3477,9 @@
9955A6F11C79866400EB6A93 /* AutomationBackendDispatchers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutomationBackendDispatchers.h; sourceTree = "<group>"; };
9955A6F21C79866400EB6A93 /* AutomationProtocolObjects.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutomationProtocolObjects.cpp; sourceTree = "<group>"; };
9955A6F31C79866400EB6A93 /* AutomationProtocolObjects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutomationProtocolObjects.h; sourceTree = "<group>"; };
- 9986BDD61CA9A222004800AA /* WebAutomationSessionCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebAutomationSessionCocoa.mm; sourceTree = "<group>"; };
+ 99C3AE231DAD8E3400AF5C16 /* WebAutomationSessionMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebAutomationSessionMac.mm; sourceTree = "<group>"; };
+ 99C3AE261DAD948500AF5C16 /* WebAutomationSessionCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebAutomationSessionCocoa.mm; sourceTree = "<group>"; };
+ 99C3AE2C1DADA6A700AF5C16 /* WebAutomationSessionMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAutomationSessionMacros.h; sourceTree = "<group>"; };
99C81D551C20DFBE005C4C82 /* AutomationClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutomationClient.h; sourceTree = "<group>"; };
99C81D561C20DFBE005C4C82 /* AutomationClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AutomationClient.mm; sourceTree = "<group>"; };
99C81D5B1C20E817005C4C82 /* APIAutomationClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIAutomationClient.h; sourceTree = "<group>"; };
@@ -4914,7 +4918,6 @@
2DAF4FFA1B636181006013D6 /* ViewGestureController.cpp */,
2D125C5C1857EA05003BA3CB /* ViewGestureController.h */,
2D1B5D5A18586599006C6596 /* ViewGestureController.messages.in */,
- 9986BDD61CA9A222004800AA /* WebAutomationSessionCocoa.mm */,
1AC0273E196622D600C12B75 /* WebPageProxyCocoa.mm */,
7C4694CB1A4B510A00AD5845 /* WebPasteboardProxyCocoa.mm */,
CDA29A1E1CBEB5FB00901CCF /* WebPlaybackSessionManagerProxy.h */,
@@ -6025,13 +6028,32 @@
isa = PBXGroup;
children = (
9955A6E91C7980BB00EB6A93 /* Automation.json */,
+ 99C3AE251DAD946700AF5C16 /* cocoa */,
+ 99C3AE221DAD8E1400AF5C16 /* mac */,
9955A6EA1C7980BB00EB6A93 /* WebAutomationSession.cpp */,
9955A6EB1C7980BB00EB6A93 /* WebAutomationSession.h */,
1C0A19591C9006EA00FE0EBB /* WebAutomationSession.messages.in */,
+ 99C3AE2C1DADA6A700AF5C16 /* WebAutomationSessionMacros.h */,
);
path = Automation;
sourceTree = "<group>";
};
+ 99C3AE221DAD8E1400AF5C16 /* mac */ = {
+ isa = PBXGroup;
+ children = (
+ 99C3AE231DAD8E3400AF5C16 /* WebAutomationSessionMac.mm */,
+ );
+ path = mac;
+ sourceTree = "<group>";
+ };
+ 99C3AE251DAD946700AF5C16 /* cocoa */ = {
+ isa = PBXGroup;
+ children = (
+ 99C3AE261DAD948500AF5C16 /* WebAutomationSessionCocoa.mm */,
+ );
+ path = cocoa;
+ sourceTree = "<group>";
+ };
A182D5B11BE6BCF40087A7CC /* ios */ = {
isa = PBXGroup;
children = (
@@ -8301,6 +8323,7 @@
BC49862F124D18C100D834E1 /* WKBundleHitTestResult.h in Headers */,
BC204EF211C83EC8008F3375 /* WKBundleInitialize.h in Headers */,
65B86F1E12F11DE300B7DD8A /* WKBundleInspector.h in Headers */,
+ 99C3AE2D1DADA6AD00AF5C16 /* WebAutomationSessionMacros.h in Headers */,
1A8B66B41BC45B010082DF77 /* WKBundleMac.h in Headers */,
BC7043CC12F75EE0006472B9 /* WKBundleNavigationAction.h in Headers */,
51A728DE1B1BAD3800102EEE /* WKBundleNavigationActionPrivate.h in Headers */,
@@ -9434,6 +9457,7 @@
51FD18B51651FBAD00DBE1CE /* NetworkResourceLoader.cpp in Sources */,
E152551A17011819003D7ADB /* NetworkResourceLoaderMessageReceiver.cpp in Sources */,
5C1426EF1C23F80900D41183 /* NetworkResourceLoadParameters.cpp in Sources */,
+ 99C3AE271DAD948900AF5C16 /* WebAutomationSessionCocoa.mm in Sources */,
BC8283AC16B4BF3F00A278FE /* NetworkServiceEntryPoint.mm in Sources */,
532159531DBAE7180054AA3C /* NetworkSession.cpp in Sources */,
5C20CB9D1BB0DCFA00895BB1 /* NetworkSessionCocoa.mm in Sources */,
@@ -9600,7 +9624,6 @@
1A8E7D3C18C15149005A702A /* VisitedLinkTableControllerMessageReceiver.cpp in Sources */,
CEDA12E2152CD1AE00D9E08D /* WebAlternativeTextClient.cpp in Sources */,
9955A6ED1C7980CA00EB6A93 /* WebAutomationSession.cpp in Sources */,
- 9986BDD71CA9A22C004800AA /* WebAutomationSessionCocoa.mm in Sources */,
1C0A19571C90068F00FE0EBB /* WebAutomationSessionMessageReceiver.cpp in Sources */,
1C0A19461C8FF1A800FE0EBB /* WebAutomationSessionProxy.cpp in Sources */,
1C0A19531C8FFDFB00FE0EBB /* WebAutomationSessionProxyMessageReceiver.cpp in Sources */,
@@ -9744,6 +9767,7 @@
BCBD3914125BB1A800D2C29F /* WebPageProxyMessageReceiver.cpp in Sources */,
512127C31908239A00DAF35C /* WebPasteboardOverrides.cpp in Sources */,
7C4694D01A51E36800AD5845 /* WebPasteboardProxy.cpp in Sources */,
+ 99C3AE241DAD8E3700AF5C16 /* WebAutomationSessionMac.mm in Sources */,
7C4694CC1A4B510A00AD5845 /* WebPasteboardProxyCocoa.mm in Sources */,
7C4694C91A4B4EA100AD5845 /* WebPasteboardProxyMessageReceiver.cpp in Sources */,
1AB1F7741D1B2F8A007C9BD1 /* WebPaymentCoordinator.cpp in Sources */,