.
Created attachment 262892 [details] Patch
Comment on attachment 262892 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=262892&action=review I don't understand why the casts are needed. > Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:64 > + gtk_widget_destroy(GTK_WIDGET(m_window)); isn't m_window a GtkWidget* already? typedef GtkWidget *PlatformWindow; > Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:70 > + m_window = reinterpret_cast<PlatformWindow>(gtk_window_new(GTK_WINDOW_TOPLEVEL)); > + m_view = reinterpret_cast<PlatformWKView>(WKViewCreate(configuration)); I don't understand why we need the casts, gtk_window_new() returns a GtkWidget* and WKViewCreate a WKViewRef
CLang errors out without the casts... I'll post the error messages here.
../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:62:5: error: no matching function for call to 'gtk_widget_destroy' gtk_widget_destroy(m_window); ^~~~~~~~~~~~~~~~~~ ../DependenciesGTK/Root/include/gtk-3.0/gtk/gtkwidget.h:639:6: note: candidate function not viable: cannot convert argument of incomplete type 'PlatformWindow' (aka 'NSWindow *') to 'GtkWidget *' (aka '_GtkWidget *') void gtk_widget_destroy (GtkWidget *widget); ^ ../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:67:14: error: assigning to 'PlatformWindow' (aka 'NSWindow *') from incompatible type 'GtkWidget *' (aka '_GtkWidget *') m_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:68:14: error: use of undeclared identifier 'WKViewCreate'; did you mean 'WKSizeCreate'? m_view = WKViewCreate(configuration); ^~~~~~~~~~~~ WKSizeCreate ../../Source/WebKit2/Shared/API/c/WKGeometry.h:84:50: note: 'WKSizeCreate' declared here __attribute__((visibility("default"))) WKSizeRef WKSizeCreate(WKSize size); ^ ../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:68:27: error: no viable conversion from 'WKPageConfigurationRef' (aka 'const OpaqueWKPageConfiguration *') to 'WKSize' m_view = WKViewCreate(configuration); ^~~~~~~~~~~~~ ../../Source/WebKit2/Shared/API/c/WKGeometry.h:49:8: note: candidate constructor (the implicit copy constructor) not viable: cannot convert argument of incomplete type 'WKPageConfigurationRef' (aka 'const OpaqueWKPageConfiguration *') to 'const WKSize &' struct WKSize { ^ ../../Source/WebKit2/Shared/API/c/WKGeometry.h:49:8: note: candidate constructor (the implicit move constructor) not viable: cannot convert argument of incomplete type 'WKPageConfigurationRef' (aka 'const OpaqueWKPageConfiguration *') to 'WKSize &&' struct WKSize { ^ ../../Source/WebKit2/Shared/API/c/WKGeometry.h:84:70: note: passing argument to parameter 'size' here __attribute__((visibility("default"))) WKSizeRef WKSizeCreate(WKSize size); ^ ../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:71:5: error: no matching function for call to 'gtk_widget_show' gtk_widget_show(m_window); ^~~~~~~~~~~~~~~ ../DependenciesGTK/Root/include/gtk-3.0/gtk/gtkwidget.h:646:6: note: candidate function not viable: cannot convert argument of incomplete type 'PlatformWindow' (aka 'NSWindow *') to 'GtkWidget *' (aka '_GtkWidget *') void gtk_widget_show (GtkWidget *widget); ^ ../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:76:12: error: use of undeclared identifier 'WKViewGetPage' return WKViewGetPage(m_view); ^ ../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:109:9: error: no matching function for call to 'gtk_widget_show' gtk_widget_show(m_window); ^~~~~~~~~~~~~~~ ../DependenciesGTK/Root/include/gtk-3.0/gtk/gtkwidget.h:646:6: note: candidate function not viable: cannot convert argument of incomplete type 'PlatformWindow' (aka 'NSWindow *') to 'GtkWidget *' (aka '_GtkWidget *') void gtk_widget_show (GtkWidget *widget); ^ ../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:117:9: error: no matching function for call to 'gtk_widget_show' gtk_widget_show(m_window); ^~~~~~~~~~~~~~~ ../DependenciesGTK/Root/include/gtk-3.0/gtk/gtkwidget.h:646:6: note: candidate function not viable: cannot convert argument of incomplete type 'PlatformWindow' (aka 'NSWindow *') to 'GtkWidget *' (aka '_GtkWidget *') void gtk_widget_show (GtkWidget *widget); ^ ../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:145:9: error: no matching function for call to 'gtk_widget_show' gtk_widget_show(m_window); ^~~~~~~~~~~~~~~ ../DependenciesGTK/Root/include/gtk-3.0/gtk/gtkwidget.h:646:6: note: candidate function not viable: cannot convert argument of incomplete type 'PlatformWindow' (aka 'NSWindow *') to 'GtkWidget *' (aka '_GtkWidget *') void gtk_widget_show (GtkWidget *widget); ^ ../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:161:9: error: no matching function for call to 'gtk_widget_show' gtk_widget_show(m_window); ^~~~~~~~~~~~~~~ ../DependenciesGTK/Root/include/gtk-3.0/gtk/gtkwidget.h:646:6: note: candidate function not viable: cannot convert argument of incomplete type 'PlatformWindow' (aka 'NSWindow *') to 'GtkWidget *' (aka '_GtkWidget *') void gtk_widget_show (GtkWidget *widget); ^ 10 errors generated. [4446/4564] Building CXX object Tools/WebKitTestRunner/CMakeFiles/WebKitTestRunner.dir/gtk/PlatformWebViewGtk.cpp.o FAILED: /usr/local/opt/ccache/libexec/c++ -DBUILDING_GTK__=1 -DBUILDING_WITH_CMAKE=1 -DDATA_DIR=\"share\" -DFONTS_CONF_DIR=\"/Users/philn/dev/WebKit/Tools/WebKitTestRunner/gtk/fonts\" -DGETTEXT_PACKAGE=\"WebKit2GTK-4.0\" -DHAVE_CONFIG_H=1 -DTOP_LEVEL_DIR=\"/Users/philn/dev/WebKit\" -DUSER_AGENT_GTK_MAJOR_VERSION=602 -DUSER_AGENT_GTK_MINOR_VERSION=1 -DWEBKITGTK_API_VERSION_STRING=\"4.0\" -std=c++11 -fcolor-diagnostics -Qunused-arguments -O3 -DNDEBUG -fno-exceptions -fno-strict-aliasing -fno-rtti -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -I../../Tools/WebKitTestRunner -I../../Tools/WebKitTestRunner/InjectedBundle -I../../Tools/WebKitTestRunner/InjectedBundle/Bindings -I../../Tools/WebKitTestRunner/InjectedBundle/atk -I../../Tools/WebKitTestRunner/UIScriptContext -I../../Tools/WebKitTestRunner/UIScriptContext/Bindings -I../../Source/JavaScriptCore -I../../Source/JavaScriptCore/ForwardingHeaders -IDerivedSources/JavaScriptCore -I../../Source/WebCore/editing -I../../Source/WebCore/platform -I../../Source/WebCore/platform/graphics -I../../Source/WebCore/platform/graphics/harfbuzz -I../../Source/WebCore/platform/graphics/harfbuzz/ng -I../../Source/WebCore/platform/network -I../../Source/WebCore/platform/text -I../../Source/WebCore/testing/js -I../../Source/WebKit2/Platform/IPC -I../../Source/WebKit2/Shared -I../../Source/WebKit2/Shared/API/c -I../../Source/WebKit2/Shared/Plugins -I../../Source/WebKit2/UIProcess -I../../Source/WebKit2/UIProcess/API/C/soup -I../../Source/WebKit2/WebProcess/InjectedBundle -I../../Source/WebKit2/WebProcess/InjectedBundle/API/c -I../../Source/WTF -IDerivedSources/InjectedBundle -IDerivedSources/UIScriptContext -I. -I../../Source -IDerivedSources/ForwardingHeaders -I../../Source/WTF/wtf/glib -isystem ../DependenciesGTK/Root/include/libsoup-2.4 -isystem ../DependenciesGTK/Root/include/atk-1.0 -isystem ../DependenciesGTK/Root/include/cairo -isystem ../DependenciesGTK/Root/include/gtk-3.0 -isystem ../DependenciesGTK/Root/include/gio-unix-2.0 -isystem ../DependenciesGTK/Root/include/pango-1.0 -isystem ../DependenciesGTK/Root/include/pixman-1 -isystem ../DependenciesGTK/Root/include/freetype2 -isystem ../DependenciesGTK/Root/include/libxml2 -isystem ../DependenciesGTK/Root/include/gdk-pixbuf-2.0 -isystem ../DependenciesGTK/Root/include/glib-2.0 -isystem ../DependenciesGTK/Root/lib/glib-2.0/include -isystem /usr/local/Cellar/libepoxy/1.3.1/include -isystem /usr/local/Cellar/libpng/1.6.18/include/libpng16 -MMD -MT Tools/WebKitTestRunner/CMakeFiles/WebKitTestRunner.dir/gtk/PlatformWebViewGtk.cpp.o -MF Tools/WebKitTestRunner/CMakeFiles/WebKitTestRunner.dir/gtk/PlatformWebViewGtk.cpp.o.d -o Tools/WebKitTestRunner/CMakeFiles/WebKitTestRunner.dir/gtk/PlatformWebViewGtk.cpp.o -c ../../Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp ../../Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:40:14: error: use of undeclared identifier 'WKViewCreate'; did you mean 'WKSizeCreate'? : m_view(WKViewCreate(configuration)) ^~~~~~~~~~~~ WKSizeCreate ../../Source/WebKit2/Shared/API/c/WKGeometry.h:84:50: note: 'WKSizeCreate' declared here __attribute__((visibility("default"))) WKSizeRef WKSizeCreate(WKSize size); ^ ../../Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:40:27: error: no viable conversion from 'WKPageConfigurationRef' (aka 'const OpaqueWKPageConfiguration *') to 'WKSize' : m_view(WKViewCreate(configuration)) ^~~~~~~~~~~~~ ../../Source/WebKit2/Shared/API/c/WKGeometry.h:49:8: note: candidate constructor (the implicit copy constructor) not viable: cannot convert argument of incomplete type 'WKPageConfigurationRef' (aka 'const OpaqueWKPageConfiguration *') to 'const WKSize &' struct WKSize { ^ ../../Source/WebKit2/Shared/API/c/WKGeometry.h:49:8: note: candidate constructor (the implicit move constructor) not viable: cannot convert argument of incomplete type 'WKPageConfigurationRef' (aka 'const OpaqueWKPageConfiguration *') to 'WKSize &&' struct WKSize { ^ ../../Source/WebKit2/Shared/API/c/WKGeometry.h:84:70: note: passing argument to parameter 'size' here __attribute__((visibility("default"))) WKSizeRef WKSizeCreate(WKSize size); ^ ../../Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:76:12: error: use of undeclared identifier 'WKViewGetPage' return WKViewGetPage(m_view); ^ 3 errors generated.
There is something fishy here. I'll rework this patch.
(In reply to comment #4) > ../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:62:5: error: no > matching function for call to 'gtk_widget_destroy' > gtk_widget_destroy(m_window); > ^~~~~~~~~~~~~~~~~~ > ../DependenciesGTK/Root/include/gtk-3.0/gtk/gtkwidget.h:639:6: note: > candidate function not viable: cannot convert argument of incomplete type > 'PlatformWindow' (aka 'NSWindow *') to 'GtkWidget *' (aka '_GtkWidget *') > void gtk_widget_destroy (GtkWidget *widget); > ^ So, this is the actual problem, PlatformWindow is NSWindow and not GtkWidget as expected. A cast would fix the build, but will not work at runtime.
Created attachment 263826 [details] Patch
That looks better, though I wonder why you needed to use BUILDING_GTK_ instead of PLATFORM(GTK)?
(In reply to comment #8) > That looks better, though I wonder why you needed to use BUILDING_GTK_ > instead of PLATFORM(GTK)? It is used below in the same file. I can replace all occurrences with PLATFORM(GTK) if needed...
Committed r191783: <http://trac.webkit.org/changeset/191783>