diff options
Diffstat (limited to 'Tools/WebKitTestRunner/PlatformWebView.h')
-rw-r--r-- | Tools/WebKitTestRunner/PlatformWebView.h | 74 |
1 files changed, 45 insertions, 29 deletions
diff --git a/Tools/WebKitTestRunner/PlatformWebView.h b/Tools/WebKitTestRunner/PlatformWebView.h index fa8d1236c..aa0ab2e49 100644 --- a/Tools/WebKitTestRunner/PlatformWebView.h +++ b/Tools/WebKitTestRunner/PlatformWebView.h @@ -26,29 +26,28 @@ #ifndef PlatformWebView_h #define PlatformWebView_h -#include <WebKit2/WKRetainPtr.h> +#include "TestOptions.h" +#include <WebKit/WKRetainPtr.h> -#if defined(__APPLE__) && __APPLE__ -#ifdef __OBJC__ -@class WKView; -@class WebKitTestRunnerWindow; +#if PLATFORM(COCOA) && !defined(BUILDING_GTK__) +#include <WebKit/WKFoundation.h> +OBJC_CLASS NSView; +OBJC_CLASS UIView; +OBJC_CLASS TestRunnerWKWebView; +OBJC_CLASS WKWebViewConfiguration; +OBJC_CLASS WebKitTestRunnerWindow; + +#if WK_API_ENABLED +typedef TestRunnerWKWebView *PlatformWKView; #else -class WKView; -class WebKitTestRunnerWindow; +typedef NSView *PlatformWKView; #endif -typedef WKView* PlatformWKView; -typedef WebKitTestRunnerWindow* PlatformWindow; +typedef WebKitTestRunnerWindow *PlatformWindow; #elif defined(BUILDING_GTK__) typedef struct _GtkWidget GtkWidget; typedef WKViewRef PlatformWKView; typedef GtkWidget* PlatformWindow; #elif PLATFORM(EFL) -typedef struct _Ecore_Evas Ecore_Evas; -#if USE(EO) -typedef struct _Eo_Opaque Evas_Object; -#else -typedef struct _Evas_Object Evas_Object; -#endif typedef Evas_Object* PlatformWKView; typedef Ecore_Evas* PlatformWindow; #endif @@ -57,43 +56,60 @@ namespace WTR { class PlatformWebView { public: - PlatformWebView(WKContextRef, WKPageGroupRef, WKPageRef relatedPage, WKDictionaryRef options = 0); +#if PLATFORM(COCOA) + PlatformWebView(WKWebViewConfiguration*, const TestOptions&); +#else + PlatformWebView(WKPageConfigurationRef, const TestOptions&); +#endif ~PlatformWebView(); WKPageRef page(); PlatformWKView platformView() { return m_view; } PlatformWindow platformWindow() { return m_window; } - void resizeTo(unsigned width, unsigned height); - void focus(); + static PlatformWindow keyWindow(); - // Window snapshot is always enabled by default on all other platform. - static bool windowSnapshotEnabled() { return true; } + enum class WebViewSizingMode { + Default, + HeightRespectsStatusBar + }; + + void resizeTo(unsigned width, unsigned height, WebViewSizingMode = WebViewSizingMode::Default); + void focus(); WKRect windowFrame(); - void setWindowFrame(WKRect); + void setWindowFrame(WKRect, WebViewSizingMode = WebViewSizingMode::Default); void didInitializeClients(); void addChromeInputField(); void removeChromeInputField(); void makeWebViewFirstResponder(); - void setWindowIsKey(bool isKey) { m_windowIsKey = isKey; } + void setWindowIsKey(bool); bool windowIsKey() const { return m_windowIsKey; } + + void removeFromWindow(); + void addToWindow(); -#if PLATFORM(MAC) || PLATFORM(EFL) - bool viewSupportsOptions(WKDictionaryRef) const; -#else - bool viewSupportsOptions(WKDictionaryRef) const { return true; } -#endif + bool viewSupportsOptions(const TestOptions&) const; WKRetainPtr<WKImageRef> windowSnapshotImage(); - WKDictionaryRef options() const { return m_options.get(); } + const TestOptions& options() const { return m_options; } + + void changeWindowScaleIfNeeded(float newScale); + void setNavigationGesturesEnabled(bool); + +#if PLATFORM(GTK) + void dismissAllPopupMenus(); +#endif private: + void forceWindowFramesChanged(); + PlatformWKView m_view; PlatformWindow m_window; bool m_windowIsKey; - WKRetainPtr<WKDictionaryRef> m_options; + const TestOptions m_options; + #if PLATFORM(EFL) bool m_usingFixedLayout; #endif |