Add support for WebKit2GTK+ in wxWebView

This commit is contained in:
Scott Talbert 2017-03-30 21:34:24 -04:00 committed by Steven Lamerton
parent d10c600773
commit cbe0a1f049
24 changed files with 2014 additions and 36 deletions

View File

@ -1663,12 +1663,14 @@ WEBVIEWDLL_CXXFLAGS = $(__webviewdll_PCH_INC) -D__WX$(TOOLKIT)__ \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \
$(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \
$(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_WEBVIEW \
-DWX_WEB_EXTENSIONS_DIRECTORY=\"$(PLUGINS_INST_DIR)/web-extensions\" \
$(PIC_FLAG) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS)
WEBVIEWDLL_OBJCXXFLAGS = $(__webviewdll_PCH_INC) -D__WX$(TOOLKIT)__ \
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \
$(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \
$(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_WEBVIEW \
-DWX_WEB_EXTENSIONS_DIRECTORY=\"$(PLUGINS_INST_DIR)/web-extensions\" \
$(PIC_FLAG) $(CPPFLAGS) $(OBJCXXFLAGS)
WEBVIEWDLL_OBJECTS = \
$(__webviewdll___win32rc) \
@ -2092,6 +2094,10 @@ SOUND_SDL_CXXFLAGS = -DWXUSINGDLL -DwxUSE_GUI=0 $(PIC_FLAG) $(CPPFLAGS) \
$(CXXFLAGS)
SOUND_SDL_OBJECTS = \
sound_sdl_sound_sdl.o
WEBKIT2_EXT_CXXFLAGS = -DWXUSINGDLL -DwxUSE_GUI=0 $(PIC_FLAG) $(CPPFLAGS) \
$(CXXFLAGS)
WEBKIT2_EXT_OBJECTS = \
webkit2_ext_webview_webkit2_extension.o
LOCALE_LINGUAS = ca cs da de el es fi fr hu id it ja nl pl ru sl sv tr uk zh zh_CN zh_TW
LOCALE_MSW_LINGUAS = it
@ -6115,6 +6121,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_1 = \
@COND_PLATFORM_MACOSX_1@ = monodll_osx_webview_webkit.o
@COND_TOOLKIT_GTK@__WEBVIEW_SRC_PLATFORM_OBJECTS = \
@COND_TOOLKIT_GTK@ monodll_gtk_webview_webkit.o
@COND_TOOLKIT_GTK@__WEBVIEW_SRC_PLATFORM_OBJECTS = \
@COND_TOOLKIT_GTK@ monodll_webview_webkit2.o
@COND_TOOLKIT_MSW@__WEBVIEW_SRC_PLATFORM_OBJECTS = monodll_webview_ie.o
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__AUI_GTK_SRC_OBJECTS \
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@ = monodll_tabartgtk.o
@ -8136,6 +8144,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_3 = \
@COND_PLATFORM_MACOSX_1@ = monolib_osx_webview_webkit.o
@COND_TOOLKIT_GTK@__WEBVIEW_SRC_PLATFORM_OBJECTS_1 = \
@COND_TOOLKIT_GTK@ monolib_gtk_webview_webkit.o
@COND_TOOLKIT_GTK@__WEBVIEW_SRC_PLATFORM_OBJECTS_1 = \
@COND_TOOLKIT_GTK@ monolib_webview_webkit2.o
@COND_TOOLKIT_MSW@__WEBVIEW_SRC_PLATFORM_OBJECTS_1 = monolib_webview_ie.o
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__AUI_GTK_SRC_OBJECTS_1 \
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@ = monolib_tabartgtk.o
@ -12412,6 +12422,8 @@ COND_USE_SOVERSOLARIS_1___webviewdll___so_symlinks_uninst_cmd = rm -f \
@COND_PLATFORM_MACOSX_1@ = webviewdll_osx_webview_webkit.o
@COND_TOOLKIT_GTK@__WEBVIEW_SRC_PLATFORM_OBJECTS_2 = \
@COND_TOOLKIT_GTK@ webviewdll_gtk_webview_webkit.o
@COND_TOOLKIT_GTK@__WEBVIEW_SRC_PLATFORM_OBJECTS_2 = \
@COND_TOOLKIT_GTK@ webviewdll_webview_webkit2.o
@COND_TOOLKIT_MSW@__WEBVIEW_SRC_PLATFORM_OBJECTS_2 = \
@COND_TOOLKIT_MSW@ webviewdll_webview_ie.o
COND_MONOLITHIC_0_SHARED_0_USE_GUI_1_USE_WEBVIEW_1___webviewlib___depname = \
@ -12431,6 +12443,8 @@ COND_MONOLITHIC_0_SHARED_0_USE_GUI_1_USE_WEBVIEW_1___webviewlib___depname = \
@COND_PLATFORM_MACOSX_1@ = webviewlib_osx_webview_webkit.o
@COND_TOOLKIT_GTK@__WEBVIEW_SRC_PLATFORM_OBJECTS_3 = \
@COND_TOOLKIT_GTK@ webviewlib_gtk_webview_webkit.o
@COND_TOOLKIT_GTK@__WEBVIEW_SRC_PLATFORM_OBJECTS_3 = \
@COND_TOOLKIT_GTK@ webviewlib_webview_webkit2.o
@COND_TOOLKIT_MSW@__WEBVIEW_SRC_PLATFORM_OBJECTS_3 = \
@COND_TOOLKIT_MSW@ webviewlib_webview_ie.o
@COND_SHARED_1@____wxwebview_namedll_DEP = $(__webviewdll___depname)
@ -13231,6 +13245,13 @@ COND_WITH_PLUGIN_SDL_1___sound_sdl___depname = \
@COND_WITH_PLUGIN_SDL_1@__install_sound_sdl___depname = install_sound_sdl
@COND_WITH_PLUGIN_SDL_1@__uninstall_sound_sdl___depname \
@COND_WITH_PLUGIN_SDL_1@ = uninstall_sound_sdl
COND_USE_WEBVIEW_WEBKIT2_1___webkit2_ext___depname = \
$(DLLPREFIX_MODULE)webkit2_ext$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE)
@COND_USE_WEBVIEW_WEBKIT2_1@__webkit2_ext___depname = $(COND_USE_WEBVIEW_WEBKIT2_1___webkit2_ext___depname)
@COND_USE_WEBVIEW_WEBKIT2_1@__install_webkit2_ext___depname \
@COND_USE_WEBVIEW_WEBKIT2_1@ = install_webkit2_ext
@COND_USE_WEBVIEW_WEBKIT2_1@__uninstall_webkit2_ext___depname \
@COND_USE_WEBVIEW_WEBKIT2_1@ = uninstall_webkit2_ext
@COND_USE_XRC_1@__wxrc___depname = wxrc
@COND_USE_XRC_1@__clean_wxrc___depname = clean-wxrc
@COND_USE_XRC_1@__install_wxrc___depname = install-wxrc
@ -13888,9 +13909,9 @@ COND_wxUSE_REGEX_builtin___LIB_REGEX_p = \
### Targets: ###
all: $(__wxregex___depname) $(__wxzlib___depname) $(__wxpng___depname) $(__wxjpeg___depname) $(__wxtiff___depname) $(__wxexpat___depname) $(__wxscintilla___depname) $(__monodll___depname) $(__monolib___depname) $(__basedll___depname) $(__baselib___depname) $(__netdll___depname) $(__netlib___depname) $(__coredll___depname) $(__corelib___depname) $(__advdll___depname) $(__advlib___depname) $(__mediadll___depname) $(__medialib___depname) $(__htmldll___depname) $(__htmllib___depname) $(__webviewdll___depname) $(__webviewlib___depname) $(__qadll___depname) $(__qalib___depname) $(__xmldll___depname) $(__xmllib___depname) $(__xrcdll___depname) $(__xrclib___depname) $(__auidll___depname) $(__auilib___depname) $(__ribbondll___depname) $(__ribbonlib___depname) $(__propgriddll___depname) $(__propgridlib___depname) $(__richtextdll___depname) $(__richtextlib___depname) $(__stcdll___depname) $(__stclib___depname) $(__gldll___depname) $(__gllib___depname) $(__sound_sdl___depname) $(__wxrc___depname) $(__cocoa_res___depname)
all: $(__wxregex___depname) $(__wxzlib___depname) $(__wxpng___depname) $(__wxjpeg___depname) $(__wxtiff___depname) $(__wxexpat___depname) $(__wxscintilla___depname) $(__monodll___depname) $(__monolib___depname) $(__basedll___depname) $(__baselib___depname) $(__netdll___depname) $(__netlib___depname) $(__coredll___depname) $(__corelib___depname) $(__advdll___depname) $(__advlib___depname) $(__mediadll___depname) $(__medialib___depname) $(__htmldll___depname) $(__htmllib___depname) $(__webviewdll___depname) $(__webviewlib___depname) $(__qadll___depname) $(__qalib___depname) $(__xmldll___depname) $(__xmllib___depname) $(__xrcdll___depname) $(__xrclib___depname) $(__auidll___depname) $(__auilib___depname) $(__ribbondll___depname) $(__ribbonlib___depname) $(__propgriddll___depname) $(__propgridlib___depname) $(__richtextdll___depname) $(__richtextlib___depname) $(__stcdll___depname) $(__stclib___depname) $(__gldll___depname) $(__gllib___depname) $(__sound_sdl___depname) $(__webkit2_ext___depname) $(__wxrc___depname) $(__cocoa_res___depname)
install: $(__install_wxregex___depname) $(__install_wxzlib___depname) $(__install_wxpng___depname) $(__install_wxjpeg___depname) $(__install_wxtiff___depname) $(__install_wxexpat___depname) $(__install_wxscintilla___depname) $(__install_monodll___depname) $(__install_monolib___depname) $(__install_basedll___depname) $(__install_baselib___depname) $(__install_netdll___depname) $(__install_netlib___depname) $(__install_coredll___depname) $(__install_corelib___depname) $(__install_advdll___depname) $(__install_advlib___depname) $(__install_mediadll___depname) $(__install_medialib___depname) $(__install_htmldll___depname) $(__install_htmllib___depname) $(__install_webviewdll___depname) $(__install_webviewlib___depname) $(__install_qadll___depname) $(__install_qalib___depname) $(__install_xmldll___depname) $(__install_xmllib___depname) $(__install_xrcdll___depname) $(__install_xrclib___depname) $(__install_auidll___depname) $(__install_auilib___depname) $(__install_ribbondll___depname) $(__install_ribbonlib___depname) $(__install_propgriddll___depname) $(__install_propgridlib___depname) $(__install_richtextdll___depname) $(__install_richtextlib___depname) $(__install_stcdll___depname) $(__install_stclib___depname) $(__install_gldll___depname) $(__install_gllib___depname) $(__install_sound_sdl___depname) $(__install_wxrc___depname) install-wxconfig locale_install locale_msw_install $(__cocoa_res_install___depname)
install: $(__install_wxregex___depname) $(__install_wxzlib___depname) $(__install_wxpng___depname) $(__install_wxjpeg___depname) $(__install_wxtiff___depname) $(__install_wxexpat___depname) $(__install_wxscintilla___depname) $(__install_monodll___depname) $(__install_monolib___depname) $(__install_basedll___depname) $(__install_baselib___depname) $(__install_netdll___depname) $(__install_netlib___depname) $(__install_coredll___depname) $(__install_corelib___depname) $(__install_advdll___depname) $(__install_advlib___depname) $(__install_mediadll___depname) $(__install_medialib___depname) $(__install_htmldll___depname) $(__install_htmllib___depname) $(__install_webviewdll___depname) $(__install_webviewlib___depname) $(__install_qadll___depname) $(__install_qalib___depname) $(__install_xmldll___depname) $(__install_xmllib___depname) $(__install_xrcdll___depname) $(__install_xrclib___depname) $(__install_auidll___depname) $(__install_auilib___depname) $(__install_ribbondll___depname) $(__install_ribbonlib___depname) $(__install_propgriddll___depname) $(__install_propgridlib___depname) $(__install_richtextdll___depname) $(__install_richtextlib___depname) $(__install_stcdll___depname) $(__install_stclib___depname) $(__install_gldll___depname) $(__install_gllib___depname) $(__install_sound_sdl___depname) $(__install_webkit2_ext___depname) $(__install_wxrc___depname) install-wxconfig locale_install locale_msw_install $(__cocoa_res_install___depname)
$(INSTALL_DIR) $(DESTDIR)$(datadir)/aclocal
(cd $(srcdir) ; $(INSTALL_DATA) wxwin.m4 $(DESTDIR)$(datadir)/aclocal)
$(INSTALL_DIR) $(DESTDIR)$(datadir)/bakefile/presets
@ -13926,7 +13947,7 @@ install: $(__install_wxregex___depname) $(__install_wxzlib___depname) $(__instal
@echo " ------------------------------------------------------"
@echo " "
uninstall: $(__uninstall_wxregex___depname) $(__uninstall_wxzlib___depname) $(__uninstall_wxpng___depname) $(__uninstall_wxjpeg___depname) $(__uninstall_wxtiff___depname) $(__uninstall_wxexpat___depname) $(__uninstall_wxscintilla___depname) $(__uninstall_monodll___depname) $(__uninstall_monolib___depname) $(__uninstall_basedll___depname) $(__uninstall_baselib___depname) $(__uninstall_netdll___depname) $(__uninstall_netlib___depname) $(__uninstall_coredll___depname) $(__uninstall_corelib___depname) $(__uninstall_advdll___depname) $(__uninstall_advlib___depname) $(__uninstall_mediadll___depname) $(__uninstall_medialib___depname) $(__uninstall_htmldll___depname) $(__uninstall_htmllib___depname) $(__uninstall_webviewdll___depname) $(__uninstall_webviewlib___depname) $(__uninstall_qadll___depname) $(__uninstall_qalib___depname) $(__uninstall_xmldll___depname) $(__uninstall_xmllib___depname) $(__uninstall_xrcdll___depname) $(__uninstall_xrclib___depname) $(__uninstall_auidll___depname) $(__uninstall_auilib___depname) $(__uninstall_ribbondll___depname) $(__uninstall_ribbonlib___depname) $(__uninstall_propgriddll___depname) $(__uninstall_propgridlib___depname) $(__uninstall_richtextdll___depname) $(__uninstall_richtextlib___depname) $(__uninstall_stcdll___depname) $(__uninstall_stclib___depname) $(__uninstall_gldll___depname) $(__uninstall_gllib___depname) $(__uninstall_sound_sdl___depname) locale_uninstall locale_msw_uninstall
uninstall: $(__uninstall_wxregex___depname) $(__uninstall_wxzlib___depname) $(__uninstall_wxpng___depname) $(__uninstall_wxjpeg___depname) $(__uninstall_wxtiff___depname) $(__uninstall_wxexpat___depname) $(__uninstall_wxscintilla___depname) $(__uninstall_monodll___depname) $(__uninstall_monolib___depname) $(__uninstall_basedll___depname) $(__uninstall_baselib___depname) $(__uninstall_netdll___depname) $(__uninstall_netlib___depname) $(__uninstall_coredll___depname) $(__uninstall_corelib___depname) $(__uninstall_advdll___depname) $(__uninstall_advlib___depname) $(__uninstall_mediadll___depname) $(__uninstall_medialib___depname) $(__uninstall_htmldll___depname) $(__uninstall_htmllib___depname) $(__uninstall_webviewdll___depname) $(__uninstall_webviewlib___depname) $(__uninstall_qadll___depname) $(__uninstall_qalib___depname) $(__uninstall_xmldll___depname) $(__uninstall_xmllib___depname) $(__uninstall_xrcdll___depname) $(__uninstall_xrclib___depname) $(__uninstall_auidll___depname) $(__uninstall_auilib___depname) $(__uninstall_ribbondll___depname) $(__uninstall_ribbonlib___depname) $(__uninstall_propgriddll___depname) $(__uninstall_propgridlib___depname) $(__uninstall_richtextdll___depname) $(__uninstall_richtextlib___depname) $(__uninstall_stcdll___depname) $(__uninstall_stclib___depname) $(__uninstall_gldll___depname) $(__uninstall_gllib___depname) $(__uninstall_sound_sdl___depname) $(__uninstall_webkit2_ext___depname) locale_uninstall locale_msw_uninstall
(cd $(DESTDIR)$(datadir)/aclocal ; rm -f wxwin.m4)
(cd $(DESTDIR)$(datadir)/bakefile/presets ; rm -f wx.bkl wx_unix.bkl wx_win32.bkl wx_xrc.bkl wx_presets.py)
for f in setup.h $(RCDEFS_H); do \
@ -13955,6 +13976,7 @@ install-strip: install
$(STRIP) $(DESTDIR)$(libdir)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_stc$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3)
$(STRIP) $(DESTDIR)$(libdir)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3)
$(STRIP) $(DESTDIR)$(PLUGINS_INST_DIR)/$(DLLPREFIX_MODULE)sound_sdl$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE)
$(STRIP) $(DESTDIR)$(PLUGINS_INST_DIR)/web-extensions/$(DLLPREFIX_MODULE)webkit2_ext$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE)
clean: $(__clean_wxrc___depname)
rm -rf ./.deps ./.pch
@ -14035,6 +14057,7 @@ clean: $(__clean_wxrc___depname)
rm -f $(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX) $(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf2)
rm -f $(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl-$(WX_RELEASE)$(HOST_SUFFIX)$(LIBEXT)
rm -f $(DLLPREFIX_MODULE)sound_sdl$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE)
rm -f $(DLLPREFIX_MODULE)webkit2_ext$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE)
-(cd samples && $(MAKE) clean)
rm -f lib/libwx_$(TOOLCHAIN_NAME).1.rsrc lib/libwx_$(TOOLCHAIN_NAME).1.r
@ -14763,6 +14786,16 @@ distclean: clean
@COND_WITH_PLUGIN_SDL_1@uninstall_sound_sdl:
@COND_WITH_PLUGIN_SDL_1@ rm -f $(DESTDIR)$(PLUGINS_INST_DIR)/$(DLLPREFIX_MODULE)sound_sdl$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE)
@COND_USE_WEBVIEW_WEBKIT2_1@$(DLLPREFIX_MODULE)webkit2_ext$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE): $(WEBKIT2_EXT_OBJECTS)
@COND_USE_WEBVIEW_WEBKIT2_1@ $(SHARED_LD_MODULE_CXX) $@ $(WEBKIT2_EXT_OBJECTS) $(LDFLAGS) $(EXTRALIBS_WEBVIEW) $(LIBS)
@COND_USE_WEBVIEW_WEBKIT2_1@install_webkit2_ext: $(__webkit2_ext___depname)
@COND_USE_WEBVIEW_WEBKIT2_1@ $(INSTALL_DIR) $(DESTDIR)$(PLUGINS_INST_DIR)/web-extensions
@COND_USE_WEBVIEW_WEBKIT2_1@ $(INSTALL_PROGRAM) $(DLLPREFIX_MODULE)webkit2_ext$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE) $(DESTDIR)$(PLUGINS_INST_DIR)/web-extensions
@COND_USE_WEBVIEW_WEBKIT2_1@uninstall_webkit2_ext:
@COND_USE_WEBVIEW_WEBKIT2_1@ rm -f $(DESTDIR)$(PLUGINS_INST_DIR)/web-extensions/$(DLLPREFIX_MODULE)webkit2_ext$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(PLUGVERDELIM)$(PLUGIN_VERSION0)$(WXCOMPILER).$(SO_SUFFIX_MODULE)
samples:
(cd samples && $(MAKE) all)
@ -16878,6 +16911,9 @@ monodll_webview_ie.o: $(srcdir)/src/msw/webview_ie.cpp $(MONODLL_ODEP)
monodll_gtk_webview_webkit.o: $(srcdir)/src/gtk/webview_webkit.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit.cpp
monodll_webview_webkit2.o: $(srcdir)/src/gtk/webview_webkit2.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit2.cpp
monodll_osx_webview_webkit.o: $(srcdir)/src/osx/webview_webkit.mm $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/webview_webkit.mm
@ -21726,6 +21762,9 @@ monolib_webview_ie.o: $(srcdir)/src/msw/webview_ie.cpp $(MONOLIB_ODEP)
monolib_gtk_webview_webkit.o: $(srcdir)/src/gtk/webview_webkit.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit.cpp
monolib_webview_webkit2.o: $(srcdir)/src/gtk/webview_webkit2.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit2.cpp
monolib_osx_webview_webkit.o: $(srcdir)/src/osx/webview_webkit.mm $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/webview_webkit.mm
@ -34339,7 +34378,7 @@ htmllib_htmllbox.o: $(srcdir)/src/generic/htmllbox.cpp $(HTMLLIB_ODEP)
@COND_PLATFORM_MACOSX_1@ $(CXXC) -c -o $@ $(HTMLLIB_CXXFLAGS) $(srcdir)/src/html/chm.cpp
webviewdll_version_rc.o: $(srcdir)/src/msw/version.rc $(WEBVIEWDLL_ODEP)
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_67) $(__DEBUG_DEFINE_p_66) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) --define WXBUILDING --define WXDLLNAME=$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_webview$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG) $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include $(__INC_TIFF_BUILD_p_66) $(__INC_TIFF_p_66) $(__INC_JPEG_p_66) $(__INC_PNG_p_65) $(__INC_ZLIB_p_67) $(__INC_REGEX_p_65) $(__INC_EXPAT_p_65) --define WXUSINGDLL --define WXMAKINGDLL_WEBVIEW
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_67) $(__DEBUG_DEFINE_p_66) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) --define WXBUILDING --define WXDLLNAME=$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_webview$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG) $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include $(__INC_TIFF_BUILD_p_66) $(__INC_TIFF_p_66) $(__INC_JPEG_p_66) $(__INC_PNG_p_65) $(__INC_ZLIB_p_67) $(__INC_REGEX_p_65) $(__INC_EXPAT_p_65) --define WXUSINGDLL --define WXMAKINGDLL_WEBVIEW --define WX_WEB_EXTENSIONS_DIRECTORY="$(PLUGINS_INST_DIR)/web-extensions"
webviewdll_webview_ie.o: $(srcdir)/src/msw/webview_ie.cpp $(WEBVIEWDLL_ODEP)
$(CXXC) -c -o $@ $(WEBVIEWDLL_CXXFLAGS) $(srcdir)/src/msw/webview_ie.cpp
@ -34347,6 +34386,9 @@ webviewdll_webview_ie.o: $(srcdir)/src/msw/webview_ie.cpp $(WEBVIEWDLL_ODEP)
webviewdll_gtk_webview_webkit.o: $(srcdir)/src/gtk/webview_webkit.cpp $(WEBVIEWDLL_ODEP)
$(CXXC) -c -o $@ $(WEBVIEWDLL_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit.cpp
webviewdll_webview_webkit2.o: $(srcdir)/src/gtk/webview_webkit2.cpp $(WEBVIEWDLL_ODEP)
$(CXXC) -c -o $@ $(WEBVIEWDLL_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit2.cpp
webviewdll_osx_webview_webkit.o: $(srcdir)/src/osx/webview_webkit.mm $(WEBVIEWDLL_ODEP)
$(CXXC) -c -o $@ $(WEBVIEWDLL_OBJCXXFLAGS) $(srcdir)/src/osx/webview_webkit.mm
@ -34365,6 +34407,9 @@ webviewlib_webview_ie.o: $(srcdir)/src/msw/webview_ie.cpp $(WEBVIEWLIB_ODEP)
webviewlib_gtk_webview_webkit.o: $(srcdir)/src/gtk/webview_webkit.cpp $(WEBVIEWLIB_ODEP)
$(CXXC) -c -o $@ $(WEBVIEWLIB_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit.cpp
webviewlib_webview_webkit2.o: $(srcdir)/src/gtk/webview_webkit2.cpp $(WEBVIEWLIB_ODEP)
$(CXXC) -c -o $@ $(WEBVIEWLIB_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit2.cpp
webviewlib_osx_webview_webkit.o: $(srcdir)/src/osx/webview_webkit.mm $(WEBVIEWLIB_ODEP)
$(CXXC) -c -o $@ $(WEBVIEWLIB_OBJCXXFLAGS) $(srcdir)/src/osx/webview_webkit.mm
@ -35211,6 +35256,9 @@ gllib_msw_glcanvas.o: $(srcdir)/src/msw/glcanvas.cpp $(GLLIB_ODEP)
sound_sdl_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp
$(CXXC) -c -o $@ $(SOUND_SDL_CXXFLAGS) $(srcdir)/src/unix/sound_sdl.cpp
webkit2_ext_webview_webkit2_extension.o: $(srcdir)/src/gtk/webview_webkit2_extension.cpp
$(CXXC) -c -o $@ $(WEBKIT2_EXT_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit2_extension.cpp
@COND_PYTHON@@COND_USE_STC_1@$(srcdir)/include/wx/stc/stc.h: \
@COND_PYTHON@@COND_USE_STC_1@$(srcdir)/src/stc/scintilla/include/Scintilla.iface \
@ -36107,4 +36155,4 @@ win-dist: MSW_ZIP_TEXT_DIST SAMPLES_DIST DEMOS_DIST UTILS_DIST MISC_DIST INTL_DI
uninstall_richtextlib wxrichtext install_stcdll uninstall_stcdll \
install_stclib uninstall_stclib wxstc install_gldll uninstall_gldll \
install_gllib uninstall_gllib wxgl install_sound_sdl uninstall_sound_sdl \
samples
install_webkit2_ext uninstall_webkit2_ext samples

View File

@ -1028,6 +1028,12 @@ dnl ### begin block 20_COND_USE_THREADS_1[../../demos/bombs/bombs.bkl,../../demo
COND_USE_THREADS_1=""
fi
AC_SUBST(COND_USE_THREADS_1)
dnl ### begin block 20_COND_USE_WEBVIEW_WEBKIT2_1[wx.bkl] ###
COND_USE_WEBVIEW_WEBKIT2_1="#"
if test "x$USE_WEBVIEW_WEBKIT2" = "x1" ; then
COND_USE_WEBVIEW_WEBKIT2_1=""
fi
AC_SUBST(COND_USE_WEBVIEW_WEBKIT2_1)
dnl ### begin block 20_COND_USE_XRC_1[../../utils/execmon/execmon.bkl,../../utils/wxrc/wxrc.bkl,wx.bkl] ###
COND_USE_XRC_1="#"
if test "x$USE_XRC" = "x1" ; then

View File

@ -417,6 +417,7 @@ to run the tests, include CppUnit library here.
<option name="DYLIB_RPATH_POSTLINK"/>
<option name="SAMPLES_RPATH_FLAG"/>
<option name="SAMPLES_CXXFLAGS"/>
<option name="USE_WEBVIEW_WEBKIT2"/>
<!-- see configure.in; it's required by some samples on Mac OS X -->
<option name="HEADER_PAD_OPTION"/>

View File

@ -3095,6 +3095,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
<set var="WEBVIEW_SRC_PLATFORM">
<if cond="TOOLKIT=='MSW'">src/msw/webview_ie.cpp</if>
<if cond="TOOLKIT=='GTK'">src/gtk/webview_webkit.cpp</if>
<if cond="TOOLKIT=='GTK'">src/gtk/webview_webkit2.cpp</if>
<if cond="PLATFORM_MACOSX=='1'">src/osx/webview_webkit.mm</if>
</set>
<set var="WEBVIEW_CMN_SRC" hints="files">
@ -3132,6 +3133,10 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
$(WEBVIEW_CMN_HDR)
</set>
<set var="WEBVIEW_WEBKIT2_EXTENSION_SRC" hints="files">
src/gtk/webview_webkit2_extension.cpp
</set>
<!-- ====================================================================== -->
<!-- wxXRC -->
<!-- ====================================================================== -->

View File

@ -180,6 +180,7 @@
cond="SHARED=='1' and USE_GUI=='1' and USE_WEBVIEW=='1' and MONOLITHIC=='0'">
<define>WXUSINGDLL</define>
<define>WXMAKINGDLL_WEBVIEW</define>
<define>WX_WEB_EXTENSIONS_DIRECTORY="$(PLUGINS_INST_DIR)/web-extensions"</define>
<sources>$(WEBVIEW_SRC)</sources>
<library>coredll</library>
<library>basedll</library>

View File

@ -11,5 +11,10 @@
<ldlibs>$(EXTRALIBS_SDL)</ldlibs>
</wx-base-plugin>
<wx-base-plugin id="webkit2_ext" cond="USE_WEBVIEW_WEBKIT2=='1'">
<sources>$(WEBVIEW_WEBKIT2_EXTENSION_SRC)</sources>
<ldlibs>$(EXTRALIBS_WEBVIEW)</ldlibs>
<install-to>$(PLUGINS_INST_DIR)/web-extensions</install-to>
</wx-base-plugin>
</makefile>

94
configure vendored
View File

@ -675,6 +675,7 @@ COND_WXUNIV_0
COND_WITH_PLUGIN_SDL_1
COND_WINDOWS_IMPLIB_1
COND_USE_XRC_1
COND_USE_WEBVIEW_WEBKIT2_1
COND_USE_THREADS_1
COND_USE_THREADS_0
COND_USE_STC_1
@ -35007,8 +35008,91 @@ fi
if test "$wxUSE_WEBVIEW" = "yes"; then
USE_WEBVIEW_WEBKIT=0
USE_WEBVIEW_WEBKIT2=0
if test "$wxUSE_WEBVIEW_WEBKIT" = "yes"; then
if test "$wxUSE_GTK" = 1; then
if test "$WXGTK3" = 1; then
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WEBKIT" >&5
$as_echo_n "checking for WEBKIT... " >&6; }
if test -n "$PKG_CONFIG"; then
if test -n "$WEBKIT_CFLAGS"; then
pkg_cv_WEBKIT_CFLAGS="$WEBKIT_CFLAGS"
else
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"webkit2gtk-4.0\""; } >&5
($PKG_CONFIG --exists --print-errors "webkit2gtk-4.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_WEBKIT_CFLAGS=`$PKG_CONFIG --cflags "webkit2gtk-4.0" 2>/dev/null`
else
pkg_failed=yes
fi
fi
else
pkg_failed=untried
fi
if test -n "$PKG_CONFIG"; then
if test -n "$WEBKIT_LIBS"; then
pkg_cv_WEBKIT_LIBS="$WEBKIT_LIBS"
else
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"webkit2gtk-4.0\""; } >&5
($PKG_CONFIG --exists --print-errors "webkit2gtk-4.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_WEBKIT_LIBS=`$PKG_CONFIG --libs "webkit2gtk-4.0" 2>/dev/null`
else
pkg_failed=yes
fi
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
WEBKIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "webkit2gtk-4.0"`
else
WEBKIT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "webkit2gtk-4.0"`
fi
# Put the nasty error message in config.log where it belongs
echo "$WEBKIT_PKG_ERRORS" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: webkit2gtk not found, falling back to webkitgtk" >&5
$as_echo "$as_me: WARNING: webkit2gtk not found, falling back to webkitgtk" >&2;}
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: webkit2gtk not found, falling back to webkitgtk" >&5
$as_echo "$as_me: WARNING: webkit2gtk not found, falling back to webkitgtk" >&2;}
else
WEBKIT_CFLAGS=$pkg_cv_WEBKIT_CFLAGS
WEBKIT_LIBS=$pkg_cv_WEBKIT_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
USE_WEBVIEW_WEBKIT2=1
CPPFLAGS="$CPPFLAGS $WEBKIT_CFLAGS"
EXTRALIBS_WEBVIEW="$WEBKIT_LIBS"
fi
fi
if test "$USE_WEBVIEW_WEBKIT2" = 0; then
webkitgtk=webkit-1.0
if test "$WXGTK3" = 1; then
webkitgtk=webkitgtk-3.0
@ -35092,6 +35176,7 @@ $as_echo "yes" >&6; }
EXTRALIBS_WEBVIEW="$WEBKIT_LIBS"
fi
fi
elif test "$wxUSE_MAC" = 1 -a "$USE_DARWIN" = 1; then
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-x objective-c++ $CPPFLAGS"
@ -35123,6 +35208,10 @@ fi
wxUSE_WEBVIEW="yes"
$as_echo "#define wxUSE_WEBVIEW_WEBKIT 1" >>confdefs.h
elif test "$USE_WEBVIEW_WEBKIT2" = 1; then
wxUSE_WEBVIEW="yes"
$as_echo "#define wxUSE_WEBVIEW_WEBKIT2 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: WebKit not available, disabling wxWebView" >&5
$as_echo "$as_me: WARNING: WebKit not available, disabling wxWebView" >&2;}
@ -38758,6 +38847,11 @@ EOF
COND_USE_THREADS_1=""
fi
COND_USE_WEBVIEW_WEBKIT2_1="#"
if test "x$USE_WEBVIEW_WEBKIT2" = "x1" ; then
COND_USE_WEBVIEW_WEBKIT2_1=""
fi
COND_USE_XRC_1="#"
if test "x$USE_XRC" = "x1" ; then
COND_USE_XRC_1=""

View File

@ -7058,8 +7058,22 @@ fi
if test "$wxUSE_WEBVIEW" = "yes"; then
USE_WEBVIEW_WEBKIT=0
USE_WEBVIEW_WEBKIT2=0
if test "$wxUSE_WEBVIEW_WEBKIT" = "yes"; then
if test "$wxUSE_GTK" = 1; then
if test "$WXGTK3" = 1; then
PKG_CHECK_MODULES([WEBKIT],
[webkit2gtk-4.0],
[
USE_WEBVIEW_WEBKIT2=1
CPPFLAGS="$CPPFLAGS $WEBKIT_CFLAGS"
EXTRALIBS_WEBVIEW="$WEBKIT_LIBS"
],
[
AC_MSG_WARN([webkit2gtk not found, falling back to webkitgtk])
])
fi
if test "$USE_WEBVIEW_WEBKIT2" = 0; then
webkitgtk=webkit-1.0
if test "$WXGTK3" = 1; then
webkitgtk=webkitgtk-3.0
@ -7074,6 +7088,7 @@ if test "$wxUSE_WEBVIEW" = "yes"; then
[
AC_MSG_WARN([webkitgtk not found.])
])
fi
elif test "$wxUSE_MAC" = 1 -a "$USE_DARWIN" = 1; then
dnl Under Mac we always have the libraries but check for the
dnl headers
@ -7100,6 +7115,9 @@ if test "$wxUSE_WEBVIEW" = "yes"; then
if test "$USE_WEBVIEW_WEBKIT" = 1; then
wxUSE_WEBVIEW="yes"
AC_DEFINE(wxUSE_WEBVIEW_WEBKIT)
elif test "$USE_WEBVIEW_WEBKIT2" = 1; then
wxUSE_WEBVIEW="yes"
AC_DEFINE(wxUSE_WEBVIEW_WEBKIT2)
else
AC_MSG_WARN([WebKit not available, disabling wxWebView])
fi

View File

@ -753,12 +753,23 @@
// Default is 1 on GTK and OSX
//
// Recommended setting: 1
#if defined(__WXGTK__) || defined(__WXOSX__)
#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__)
#define wxUSE_WEBVIEW_WEBKIT 1
#else
#define wxUSE_WEBVIEW_WEBKIT 0
#endif
// Use the WebKit2 wxWebView backend
//
// Default is 1 on GTK3
//
// Recommended setting: 1
#if defined(__WXGTK3__)
#define wxUSE_WEBVIEW_WEBKIT2 1
#else
#define wxUSE_WEBVIEW_WEBKIT2 0
#endif
// Enable wxGraphicsContext and related classes for a modern 2D drawing API.
//
// Default is 1 except if you're using a non-Microsoft compiler under Windows

View File

@ -2261,7 +2261,7 @@
# endif
#endif /* wxUSE_TREELISTCTRL */
#if wxUSE_WEBVIEW && !(wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_IE)
#if wxUSE_WEBVIEW && !(wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_WEBKIT2 || wxUSE_WEBVIEW_IE)
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_WEBVIEW requires at least one backend"
# else

View File

@ -754,12 +754,23 @@
// Default is 1 on GTK and OSX
//
// Recommended setting: 1
#if defined(__WXGTK__) || defined(__WXOSX__)
#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__)
#define wxUSE_WEBVIEW_WEBKIT 1
#else
#define wxUSE_WEBVIEW_WEBKIT 0
#endif
// Use the WebKit2 wxWebView backend
//
// Default is 1 on GTK3
//
// Recommended setting: 1
#if defined(__WXGTK3__)
#define wxUSE_WEBVIEW_WEBKIT2 1
#else
#define wxUSE_WEBVIEW_WEBKIT2 0
#endif
// Enable wxGraphicsContext and related classes for a modern 2D drawing API.
//
// Default is 1 except if you're using a non-Microsoft compiler under Windows

View File

@ -11,10 +11,15 @@
#include "wx/defs.h"
#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__)
// NOTE: this header is used for both the WebKit1 and WebKit2 implementations
#if wxUSE_WEBVIEW && (wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_WEBKIT2) && defined(__WXGTK__)
#include "wx/sharedptr.h"
#include "wx/webview.h"
#if wxUSE_WEBVIEW_WEBKIT2
#include <glib.h>
#include <gio/gio.h>
#endif
typedef struct _WebKitWebView WebKitWebView;
@ -152,6 +157,11 @@ private:
// focus event handler: calls GTKUpdateBitmap()
void GTKOnFocus(wxFocusEvent& event);
#if wxUSE_WEBVIEW_WEBKIT2
bool CanExecuteEditingCommand(const gchar* command) const;
void SetupWebExtensionServer();
#endif
WebKitWebView *m_web_view;
int m_historyLimit;
@ -163,6 +173,12 @@ private:
int m_findPosition;
int m_findCount;
#if wxUSE_WEBVIEW_WEBKIT2
//Used for webkit2 extension
GDBusServer *m_dbusServer;
GDBusProxy *m_extension;
#endif
wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit);
};

View File

@ -0,0 +1,15 @@
/////////////////////////////////////////////////////////////////////////////
// Name: include/gtk/wx/webview_webkit2_extension.h
// Purpose: Common elements for webview webkit2 extension
// Author: Scott Talbert
// Copyright: (c) 2017 Scott Talbert
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_WEBVIEW_WEBKIT2_EXTENSION_H_
#define _WX_GTK_WEBVIEW_WEBKIT2_EXTENSION_H_
#define WXGTK_WEB_EXTENSION_OBJECT_PATH "/org/wxwidgets/wxGTK/WebExtension"
#define WXGTK_WEB_EXTENSION_INTERFACE "org.wxwidgets.wxGTK.WebExtension"
#endif

View File

@ -11,7 +11,7 @@
#include "wx/setup.h"
#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__)
#if wxUSE_WEBVIEW && (wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_WEBKIT2) && defined(__WXGTK__)
class WXDLLIMPEXP_WEBVIEW wxWebViewHistoryItem
{

View File

@ -754,12 +754,23 @@
// Default is 1 on GTK and OSX
//
// Recommended setting: 1
#if defined(__WXGTK__) || defined(__WXOSX__)
#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__)
#define wxUSE_WEBVIEW_WEBKIT 1
#else
#define wxUSE_WEBVIEW_WEBKIT 0
#endif
// Use the WebKit2 wxWebView backend
//
// Default is 1 on GTK3
//
// Recommended setting: 1
#if defined(__WXGTK3__)
#define wxUSE_WEBVIEW_WEBKIT2 1
#else
#define wxUSE_WEBVIEW_WEBKIT2 0
#endif
// Enable wxGraphicsContext and related classes for a modern 2D drawing API.
//
// Default is 1 except if you're using a non-Microsoft compiler under Windows

View File

@ -754,12 +754,23 @@
// Default is 1 on GTK and OSX
//
// Recommended setting: 1
#if defined(__WXGTK__) || defined(__WXOSX__)
#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__)
#define wxUSE_WEBVIEW_WEBKIT 1
#else
#define wxUSE_WEBVIEW_WEBKIT 0
#endif
// Use the WebKit2 wxWebView backend
//
// Default is 1 on GTK3
//
// Recommended setting: 1
#if defined(__WXGTK3__)
#define wxUSE_WEBVIEW_WEBKIT2 1
#else
#define wxUSE_WEBVIEW_WEBKIT2 0
#endif
// Enable wxGraphicsContext and related classes for a modern 2D drawing API.
//
// Default is 1 except if you're using a non-Microsoft compiler under Windows

View File

@ -755,12 +755,23 @@
// Default is 1 on GTK and OSX
//
// Recommended setting: 1
#if defined(__WXGTK__) || defined(__WXOSX__)
#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__)
#define wxUSE_WEBVIEW_WEBKIT 1
#else
#define wxUSE_WEBVIEW_WEBKIT 0
#endif
// Use the WebKit2 wxWebView backend
//
// Default is 1 on GTK3
//
// Recommended setting: 1
#if defined(__WXGTK3__)
#define wxUSE_WEBVIEW_WEBKIT2 1
#else
#define wxUSE_WEBVIEW_WEBKIT2 0
#endif
// Enable wxGraphicsContext and related classes for a modern 2D drawing API.
//
// Default is 1 except if you're using a non-Microsoft compiler under Windows

View File

@ -750,12 +750,23 @@
// Default is 1 on GTK and OSX
//
// Recommended setting: 1
#if defined(__WXGTK__) || defined(__WXOSX__)
#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__)
#define wxUSE_WEBVIEW_WEBKIT 1
#else
#define wxUSE_WEBVIEW_WEBKIT 0
#endif
// Use the WebKit2 wxWebView backend
//
// Default is 1 on GTK3
//
// Recommended setting: 1
#if defined(__WXGTK3__)
#define wxUSE_WEBVIEW_WEBKIT2 1
#else
#define wxUSE_WEBVIEW_WEBKIT2 0
#endif
// Enable wxGraphicsContext and related classes for a modern 2D drawing API.
//
// Default is 1 except if you're using a non-Microsoft compiler under Windows

View File

@ -753,12 +753,23 @@
// Default is 1 on GTK and OSX
//
// Recommended setting: 1
#if defined(__WXGTK__) || defined(__WXOSX__)
#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__)
#define wxUSE_WEBVIEW_WEBKIT 1
#else
#define wxUSE_WEBVIEW_WEBKIT 0
#endif
// Use the WebKit2 wxWebView backend
//
// Default is 1 on GTK3
//
// Recommended setting: 1
#if defined(__WXGTK3__)
#define wxUSE_WEBVIEW_WEBKIT2 1
#else
#define wxUSE_WEBVIEW_WEBKIT2 0
#endif
// Enable wxGraphicsContext and related classes for a modern 2D drawing API.
//
// Default is 1 except if you're using a non-Microsoft compiler under Windows

View File

@ -571,11 +571,15 @@ public:
/**
Clear the history, this will also remove the visible page.
@note This is not implemented on the WebKit2GTK+ backend.
*/
virtual void ClearHistory() = 0;
/**
Enable or disable the history. This will also clear the history.
@note This is not implemented on the WebKit2GTK+ backend.
*/
virtual void EnableHistory(bool enable = true) = 0;

View File

@ -21,7 +21,7 @@
#include "wx/wx.h"
#endif
#if !wxUSE_WEBVIEW_WEBKIT && !wxUSE_WEBVIEW_IE
#if !wxUSE_WEBVIEW_WEBKIT && !wxUSE_WEBVIEW_WEBKIT2 && !wxUSE_WEBVIEW_IE
#error "A wxWebView backend is required by this sample"
#endif

View File

@ -334,12 +334,18 @@
#define wxUSE_WEBVIEW_IE 0
#endif
#if defined(__WXGTK__) || defined(__WXOSX__)
#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__)
#define wxUSE_WEBVIEW_WEBKIT 0
#else
#define wxUSE_WEBVIEW_WEBKIT 0
#endif
#if defined(__WXGTK3__)
#define wxUSE_WEBVIEW_WEBKIT2 0
#else
#define wxUSE_WEBVIEW_WEBKIT2 0
#endif
#ifdef _MSC_VER
#define wxUSE_GRAPHICS_CONTEXT 0

1261
src/gtk/webview_webkit2.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,421 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/gtk/webview_webkit2_extension.cpp
// Purpose: GTK WebKit2 extension for web view component
// Author: Scott Talbert
// Copyright: (c) 2017 Scott Talbert
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/defs.h"
#include "wx/gtk/webview_webkit2_extension.h"
#include <webkit2/webkit-web-extension.h>
#define WEBKIT_DOM_USE_UNSTABLE_API
#include <webkitdom/WebKitDOMDOMSelection.h>
#include <webkitdom/WebKitDOMDOMWindowUnstable.h>
static const char introspection_xml[] =
"<node>"
" <interface name='org.wxwidgets.wxGTK.WebExtension'>"
" <method name='ClearSelection'>"
" <arg type='t' name='page_id' direction='in'/>"
" </method>"
" <method name='DeleteSelection'>"
" <arg type='t' name='page_id' direction='in'/>"
" </method>"
" <method name='GetPageSource'>"
" <arg type='t' name='page_id' direction='in'/>"
" <arg type='s' name='source' direction='out'/>"
" </method>"
" <method name='GetPageText'>"
" <arg type='t' name='page_id' direction='in'/>"
" <arg type='s' name='text' direction='out'/>"
" </method>"
" <method name='GetSelectedSource'>"
" <arg type='t' name='page_id' direction='in'/>"
" <arg type='s' name='source' direction='out'/>"
" </method>"
" <method name='GetSelectedText'>"
" <arg type='t' name='page_id' direction='in'/>"
" <arg type='s' name='text' direction='out'/>"
" </method>"
" <method name='HasSelection'>"
" <arg type='t' name='page_id' direction='in'/>"
" <arg type='b' name='has_selection' direction='out'/>"
" </method>"
" </interface>"
"</node>";
class wxWebViewWebKitExtension;
static gboolean
wxgtk_webview_authorize_authenticated_peer_cb(GDBusAuthObserver *observer,
GIOStream *stream,
GCredentials *credentials,
wxWebViewWebKitExtension *extension);
static void
wxgtk_webview_dbus_connection_created_cb(GObject *source_object,
GAsyncResult *result,
wxWebViewWebKitExtension *extension);
static wxWebViewWebKitExtension *gs_extension = NULL;
class wxWebViewWebKitExtension
{
public:
wxWebViewWebKitExtension(WebKitWebExtension *webkit_extension, const char* server_address);
void ClearSelection(GVariant *parameters, GDBusMethodInvocation *invocation);
void DeleteSelection(GVariant *parameters, GDBusMethodInvocation *invocation);
void GetPageSource(GVariant *parameters, GDBusMethodInvocation *invocation);
void GetPageText(GVariant *parameters, GDBusMethodInvocation *invocation);
void GetSelectedSource(GVariant *parameters, GDBusMethodInvocation *invocation);
void GetSelectedText(GVariant *parameters, GDBusMethodInvocation *invocation);
void HasSelection(GVariant *parameters, GDBusMethodInvocation *invocation);
void SetDBusConnection(GDBusConnection *dbusConnection);
private:
WebKitWebPage* GetWebPageOrReturnError(GVariant *parameters, GDBusMethodInvocation *invocation);
void ReturnDBusStringValue(GDBusMethodInvocation *invocation, gchar *value);
GDBusConnection *m_dbusConnection;
WebKitWebExtension *m_webkitExtension;
};
wxWebViewWebKitExtension::wxWebViewWebKitExtension(WebKitWebExtension *extension, const char* server_address)
{
m_webkitExtension = (WebKitWebExtension*)g_object_ref(extension);
GDBusAuthObserver *observer = g_dbus_auth_observer_new();
g_signal_connect(observer, "authorize-authenticated-peer",
G_CALLBACK(wxgtk_webview_authorize_authenticated_peer_cb),
this);
g_dbus_connection_new_for_address(server_address,
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
observer,
NULL,
(GAsyncReadyCallback)wxgtk_webview_dbus_connection_created_cb,
this);
g_object_unref(observer);
}
WebKitWebPage* wxWebViewWebKitExtension::GetWebPageOrReturnError(GVariant *parameters, GDBusMethodInvocation *invocation)
{
guint64 page_id;
g_variant_get(parameters, "(t)", &page_id);
WebKitWebPage *web_page = webkit_web_extension_get_page(m_webkitExtension,
page_id);
if (!web_page)
{
g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"Invalid page ID: %" G_GUINT64_FORMAT, page_id);
}
return web_page;
}
void wxWebViewWebKitExtension::GetSelectedSource(GVariant *parameters,
GDBusMethodInvocation *invocation)
{
WebKitWebPage *web_page = GetWebPageOrReturnError(parameters, invocation);
if (!web_page)
{
return;
}
WebKitDOMDocument *doc = webkit_web_page_get_dom_document(web_page);
WebKitDOMDOMWindow *win = webkit_dom_document_get_default_view(doc);
WebKitDOMDOMSelection *sel = webkit_dom_dom_window_get_selection(win);
g_object_unref(win);
if (!sel)
{
ReturnDBusStringValue(invocation, NULL);
return;
}
WebKitDOMRange *range = webkit_dom_dom_selection_get_range_at(sel, 0, NULL);
if (!range)
{
ReturnDBusStringValue(invocation, NULL);
return;
}
WebKitDOMElement *div = webkit_dom_document_create_element(doc, "div",
NULL);
WebKitDOMDocumentFragment *clone = webkit_dom_range_clone_contents(range,
NULL);
webkit_dom_node_append_child(&div->parent_instance,
&clone->parent_instance, NULL);
WebKitDOMElement *html = (WebKitDOMElement*)div;
gchar *text = webkit_dom_element_get_inner_html(html);
g_object_unref(range);
ReturnDBusStringValue(invocation, text);
}
void wxWebViewWebKitExtension::GetPageSource(GVariant *parameters,
GDBusMethodInvocation *invocation)
{
WebKitWebPage *web_page = GetWebPageOrReturnError(parameters, invocation);
if (!web_page)
{
return;
}
WebKitDOMDocument *doc = webkit_web_page_get_dom_document(web_page);
WebKitDOMElement *body = webkit_dom_document_get_document_element(doc);
gchar *source = webkit_dom_element_get_outer_html(body);
g_dbus_method_invocation_return_value(invocation,
g_variant_new("(s)", source ? source : ""));
}
void wxWebViewWebKitExtension::GetPageText(GVariant *parameters,
GDBusMethodInvocation *invocation)
{
WebKitWebPage *web_page = GetWebPageOrReturnError(parameters, invocation);
if (!web_page)
{
return;
}
WebKitDOMDocument *doc = webkit_web_page_get_dom_document(web_page);
WebKitDOMHTMLElement *body = webkit_dom_document_get_body(doc);
gchar *text = webkit_dom_html_element_get_inner_text(body);
g_dbus_method_invocation_return_value(invocation,
g_variant_new("(s)", text));
}
void wxWebViewWebKitExtension::GetSelectedText(GVariant *parameters,
GDBusMethodInvocation *invocation)
{
WebKitWebPage *web_page = GetWebPageOrReturnError(parameters, invocation);
if (!web_page)
{
return;
}
WebKitDOMDocument *doc = webkit_web_page_get_dom_document(web_page);
WebKitDOMDOMWindow *win = webkit_dom_document_get_default_view(doc);
WebKitDOMDOMSelection *sel = webkit_dom_dom_window_get_selection(win);
g_object_unref(win);
if (!sel)
{
ReturnDBusStringValue(invocation, NULL);
return;
}
WebKitDOMRange *range = webkit_dom_dom_selection_get_range_at(sel, 0, NULL);
if (!range)
{
ReturnDBusStringValue(invocation, NULL);
return;
}
gchar *text = webkit_dom_range_get_text(range);
g_object_unref(range);
ReturnDBusStringValue(invocation, text);
}
void wxWebViewWebKitExtension::ClearSelection(GVariant *parameters,
GDBusMethodInvocation *invocation)
{
WebKitWebPage *web_page = GetWebPageOrReturnError(parameters, invocation);
if (!web_page)
{
return;
}
WebKitDOMDocument *doc = webkit_web_page_get_dom_document(web_page);
WebKitDOMDOMWindow *win = webkit_dom_document_get_default_view(doc);
WebKitDOMDOMSelection *sel = webkit_dom_dom_window_get_selection(win);
g_object_unref(win);
if (sel)
{
webkit_dom_dom_selection_remove_all_ranges(sel);
}
g_dbus_method_invocation_return_value(invocation, NULL);
}
void wxWebViewWebKitExtension::HasSelection(GVariant *parameters,
GDBusMethodInvocation *invocation)
{
WebKitWebPage *web_page = GetWebPageOrReturnError(parameters, invocation);
if (!web_page)
{
return;
}
WebKitDOMDocument *doc = webkit_web_page_get_dom_document(web_page);
WebKitDOMDOMWindow *win = webkit_dom_document_get_default_view(doc);
WebKitDOMDOMSelection *sel = webkit_dom_dom_window_get_selection(win);
g_object_unref(win);
gboolean has_selection = FALSE;
if (WEBKIT_DOM_IS_DOM_SELECTION(sel))
{
if (!webkit_dom_dom_selection_get_is_collapsed(sel))
{
has_selection = TRUE;
}
}
g_dbus_method_invocation_return_value(invocation,
g_variant_new("(b)", has_selection));
}
void wxWebViewWebKitExtension::DeleteSelection(GVariant *parameters,
GDBusMethodInvocation *invocation)
{
WebKitWebPage *web_page = GetWebPageOrReturnError(parameters, invocation);
if (!web_page)
{
return;
}
WebKitDOMDocument *doc = webkit_web_page_get_dom_document(web_page);
WebKitDOMDOMWindow *win = webkit_dom_document_get_default_view(doc);
WebKitDOMDOMSelection *sel = webkit_dom_dom_window_get_selection(win);
g_object_unref(win);
if (sel)
{
webkit_dom_dom_selection_delete_from_document(sel);
}
g_dbus_method_invocation_return_value(invocation, NULL);
}
void wxWebViewWebKitExtension::ReturnDBusStringValue(GDBusMethodInvocation *invocation, gchar *value)
{
g_dbus_method_invocation_return_value(invocation,
g_variant_new("(s)", value ? value : ""));
}
void wxWebViewWebKitExtension::SetDBusConnection(GDBusConnection *dbusConnection)
{
m_dbusConnection = dbusConnection;
}
static void
wxgtk_webview_handle_method_call(GDBusConnection *connection,
const char *sender,
const char *object_path,
const char *interface_name,
const char *method_name,
GVariant *parameters,
GDBusMethodInvocation *invocation,
gpointer user_data)
{
if (g_strcmp0(interface_name, WXGTK_WEB_EXTENSION_INTERFACE) != 0)
{
return;
}
wxWebViewWebKitExtension *extension = (wxWebViewWebKitExtension*)user_data;
if (g_strcmp0(method_name, "ClearSelection") == 0)
{
extension->ClearSelection(parameters, invocation);
}
else if (g_strcmp0(method_name, "DeleteSelection") == 0)
{
extension->DeleteSelection(parameters, invocation);
}
else if (g_strcmp0(method_name, "GetPageSource") == 0)
{
extension->GetPageSource(parameters, invocation);
}
else if (g_strcmp0(method_name, "GetPageText") == 0)
{
extension->GetPageText(parameters, invocation);
}
else if (g_strcmp0(method_name, "GetSelectedSource") == 0)
{
extension->GetSelectedSource(parameters, invocation);
}
else if (g_strcmp0(method_name, "GetSelectedText") == 0)
{
extension->GetSelectedText(parameters, invocation);
}
else if (g_strcmp0(method_name, "HasSelection") == 0)
{
extension->HasSelection(parameters, invocation);
}
}
static const GDBusInterfaceVTable interface_vtable = {
wxgtk_webview_handle_method_call,
NULL,
NULL
};
gboolean
wxgtk_webview_dbus_peer_is_authorized(GCredentials *peer_credentials)
{
static GCredentials *own_credentials = g_credentials_new();
GError *error = NULL;
if (peer_credentials && g_credentials_is_same_user(peer_credentials, own_credentials, &error))
{
return TRUE;
}
if (error)
{
g_warning("Failed to authorize web extension connection: %s", error->message);
g_error_free(error);
}
return FALSE;
}
static gboolean
wxgtk_webview_authorize_authenticated_peer_cb(GDBusAuthObserver *observer,
GIOStream *stream,
GCredentials *credentials,
wxWebViewWebKitExtension *extension)
{
return wxgtk_webview_dbus_peer_is_authorized(credentials);
}
static void
wxgtk_webview_dbus_connection_created_cb(GObject *source_object,
GAsyncResult *result,
wxWebViewWebKitExtension *extension)
{
static GDBusNodeInfo *introspection_data =
g_dbus_node_info_new_for_xml(introspection_xml, NULL);
GError *error = NULL;
GDBusConnection *connection =
g_dbus_connection_new_for_address_finish(result, &error);
if (error)
{
g_warning("Failed to connect to UI process: %s", error->message);
g_error_free(error);
return;
}
guint registration_id =
g_dbus_connection_register_object(connection,
WXGTK_WEB_EXTENSION_OBJECT_PATH,
introspection_data->interfaces[0],
&interface_vtable,
extension,
NULL,
&error);
if (!registration_id)
{
g_warning ("Failed to register web extension object: %s\n", error->message);
g_error_free (error);
g_object_unref (connection);
return;
}
extension->SetDBusConnection(connection);
}
extern "C" WXEXPORT void
webkit_web_extension_initialize_with_user_data (WebKitWebExtension *webkit_extension,
GVariant *user_data)
{
const char *server_address;
g_variant_get (user_data, "(&s)", &server_address);
gs_extension = new wxWebViewWebKitExtension(webkit_extension,
server_address);
}