Changeset 216114 in webkit
- Timestamp:
- May 3, 2017 1:55:56 AM (7 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r216112 r216114 1 2017-05-03 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Add GTK+ implementation of WebAutomationSession 4 https://bugs.webkit.org/show_bug.cgi?id=171431 5 6 Reviewed by Michael Catanzaro. 7 8 Add platform dependent methods for GTK+ to synthesize events. 9 10 * PlatformGTK.cmake: 11 * UIProcess/API/gtk/WebKitUIClient.cpp: Always resize the window for web views controlled by automation. 12 * UIProcess/Automation/WebAutomationSession.cpp: 13 (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext): 14 (WebKit::WebAutomationSession::moveWindowOfBrowsingContext): 15 (WebKit::WebAutomationSession::performMouseInteraction): 16 (WebKit::WebAutomationSession::performKeyboardInteractions): 17 * UIProcess/Automation/WebAutomationSession.h: 18 * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: Added. 19 (WebKit::modifiersToEventState): 20 (WebKit::mouseButtonToGdkButton): 21 (WebKit::doMouseEvent): 22 (WebKit::doMotionEvent): 23 (WebKit::WebAutomationSession::platformSimulateMouseInteraction): 24 (WebKit::doKeyStrokeEvent): 25 (WebKit::keyCodeForVirtualKey): 26 (WebKit::WebAutomationSession::platformSimulateKeyStroke): 27 (WebKit::WebAutomationSession::platformSimulateKeySequence): 28 (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData): 29 1 30 2017-05-03 Carlos Garcia Campos <cgarcia@igalia.com> 2 31 -
trunk/Source/WebKit2/PlatformGTK.cmake
r216006 r216114 305 305 UIProcess/API/gtk/webkit2.h 306 306 307 UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp 308 307 309 UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp 308 310 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp
r215149 r216114 140 140 { 141 141 GdkRectangle geometry = WebCore::IntRect(frame); 142 webkitWindowPropertiesSetGeometry(webkit_web_view_get_window_properties(m_webView), &geometry); 142 GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView)); 143 if (webkit_web_view_is_controlled_by_automation(m_webView) && WebCore::widgetIsOnscreenToplevelWindow(window) && gtk_widget_get_visible(window)) { 144 if (geometry.x >= 0 && geometry.y >= 0) 145 gtk_window_move(GTK_WINDOW(window), geometry.x, geometry.y); 146 if (geometry.width > 0 && geometry.height > 0) 147 gtk_window_resize(GTK_WINDOW(window), geometry.width, geometry.height); 148 } else 149 webkitWindowPropertiesSetGeometry(webkit_web_view_get_window_properties(m_webView), &geometry); 143 150 } 144 151 -
trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp
r216070 r216114 321 321 page->setWindowFrame(newFrame); 322 322 323 #if !PLATFORM(GTK) 323 324 // If nothing changed at all, it's probably fair to report that something went wrong. 324 325 // (We can't assume that the requested frame size will be honored exactly, however.) … … 328 329 FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InternalError, "The window size was expected to have changed, but did not."); 329 330 #endif 331 #endif 330 332 } 331 333 … … 362 364 page->setWindowFrame(newFrame); 363 365 366 #if !PLATFORM(GTK) 364 367 // If nothing changed at all, it's probably fair to report that something went wrong. 365 368 // (We can't assume that the requested frame size will be honored exactly, however.) … … 368 371 if (originalFrame == updatedFrame) 369 372 FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InternalError, "The window position was expected to have changed, but did not."); 373 #endif 370 374 #endif 371 375 } … … 834 838 } 835 839 836 #if USE(APPKIT) 840 #if USE(APPKIT) || PLATFORM(GTK) 837 841 static WebEvent::Modifiers protocolModifierToWebEventModifier(Inspector::Protocol::Automation::KeyModifier modifier) 838 842 { … … 854 858 void WebAutomationSession::performMouseInteraction(Inspector::ErrorString& errorString, const String& handle, const Inspector::InspectorObject& requestedPositionObject, const String& mouseButtonString, const String& mouseInteractionString, const Inspector::InspectorArray& keyModifierStrings, RefPtr<Inspector::Protocol::Automation::Point>& updatedPositionObject) 855 859 { 856 #if !USE(APPKIT) 860 #if !USE(APPKIT) && !PLATFORM(GTK) 857 861 FAIL_WITH_PREDEFINED_ERROR(NotImplemented); 858 862 #else … … 909 913 void WebAutomationSession::performKeyboardInteractions(ErrorString& errorString, const String& handle, const Inspector::InspectorArray& interactions, Ref<PerformKeyboardInteractionsCallback>&& callback) 910 914 { 911 #if !PLATFORM(COCOA) 915 #if !PLATFORM(COCOA) && !PLATFORM(GTK) 912 916 FAIL_WITH_PREDEFINED_ERROR(NotImplemented); 913 917 #else … … 1016 1020 // Platform-dependent Implementation Stubs. 1017 1021 1018 #if !PLATFORM(MAC) 1022 #if !PLATFORM(MAC) && !PLATFORM(GTK) 1019 1023 void WebAutomationSession::platformSimulateMouseInteraction(WebKit::WebPageProxy&, const WebCore::IntPoint&, Inspector::Protocol::Automation::MouseInteraction, Inspector::Protocol::Automation::MouseButton, WebEvent::Modifiers) 1020 1024 { … … 1022 1026 #endif // !PLATFORM(MAC) 1023 1027 1024 #if !PLATFORM(COCOA) 1028 #if !PLATFORM(COCOA) && !PLATFORM(GTK) 1025 1029 void WebAutomationSession::platformSimulateKeyStroke(WebPageProxy&, Inspector::Protocol::Automation::KeyboardInteractionType, Inspector::Protocol::Automation::VirtualKey) 1026 1030 { -
trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h
r216070 r216114 226 226 #endif 227 227 228 #if PLATFORM(IOS) 228 #if PLATFORM(IOS) || PLATFORM(GTK) 229 229 // Keep track of currently active modifiers across multiple keystrokes. 230 230 // We don't synthesize platform keyboard events on iOS, so we need to track it ourselves. 231 // GTK+ doesn't keep track of the active modifiers when using synthesized events. 231 232 unsigned m_currentModifiers { 0 }; 232 233 #endif
Note: See TracChangeset
for help on using the changeset viewer.