diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-04-19 00:02:16 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-04-19 00:02:16 +0200 |
commit | 2ba0e25a0c6fee7e2144f1fc8b577f73e1155e6d (patch) | |
tree | 504e526cbb840733a316714c890fb25d1d64eb1c | |
parent | 2c246e60e886b082e7438cf8f68cdc22bc919fd9 (diff) | |
parent | f5ec28285ab7f71d6d75af963ae499603da6630e (diff) |
Merge remote-tracking branch 'origin/5.5' into dev
Change-Id: I78c25caf30923fc1101b137f9abc3993e3cf0600
36 files changed, 523 insertions, 240 deletions
diff --git a/examples/webenginewidgets/browser/data/defaultbookmarks.xbel b/examples/webenginewidgets/browser/data/defaultbookmarks.xbel index 65b0b8415..fef7f5514 100644 --- a/examples/webenginewidgets/browser/data/defaultbookmarks.xbel +++ b/examples/webenginewidgets/browser/data/defaultbookmarks.xbel @@ -6,10 +6,10 @@ <bookmark href="http://qt.io/"> <title>Qt Home Page</title> </bookmark> - <bookmark href="http://qt-project.org/doc/"> + <bookmark href="http://doc.qt.io/"> <title>Qt Documentation</title> </bookmark> - <bookmark href="http://planet.qt-project.org/"> + <bookmark href="http://planet.qt.io/"> <title>Qt Blog</title> </bookmark> <bookmark href="http://www.qtcentre.org/"> @@ -18,7 +18,7 @@ <bookmark href="http://qt-apps.org/"> <title>Qt-Apps.org</title> </bookmark> - <bookmark href="http://wiki.qt.io/?title=OnlineCommunities"> + <bookmark href="http://wiki.qt.io/OnlineCommunities"> <title>Online Communities</title> </bookmark> <bookmark href="http://www.chromium.org/"> diff --git a/src/core/browser_accessibility_manager_qt.cpp b/src/core/browser_accessibility_manager_qt.cpp index 7b0e8b49e..7c59db110 100644 --- a/src/core/browser_accessibility_manager_qt.cpp +++ b/src/core/browser_accessibility_manager_qt.cpp @@ -55,12 +55,16 @@ BrowserAccessibilityManager* BrowserAccessibilityManager::Create( #endif // QT_NO_ACCESSIBILITY } -#ifndef QT_NO_ACCESSIBILITY BrowserAccessibility *BrowserAccessibilityFactoryQt::Create() { +#ifndef QT_NO_ACCESSIBILITY return new BrowserAccessibilityQt(); +#else + return 0; +#endif // QT_NO_ACCESSIBILITY } +#ifndef QT_NO_ACCESSIBILITY BrowserAccessibilityManagerQt::BrowserAccessibilityManagerQt( QObject* parentObject, const ui::AXTreeUpdate& initialTree, diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp index 5b787b67d..7cd5ac21f 100644 --- a/src/core/browser_accessibility_qt.cpp +++ b/src/core/browser_accessibility_qt.cpp @@ -39,6 +39,7 @@ // found in the LICENSE file. #include "browser_accessibility_qt.h" + #ifndef QT_NO_ACCESSIBILITY #include "third_party/WebKit/public/web/WebAXEnums.h" diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp index 3e2008bbf..9340923df 100644 --- a/src/core/chromium_overrides.cpp +++ b/src/core/chromium_overrides.cpp @@ -50,10 +50,6 @@ #include <QFontDatabase> #include <QStringList> -#if defined(OS_ANDROID) -#include "media/video/capture/fake_video_capture_device.h" -#endif - #if defined(USE_X11) #include "ui/gfx/x/x11_types.h" #endif @@ -193,20 +189,3 @@ PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string&, int) } // namespace gfx #endif // defined(USE_AURA) && !defined(USE_OZONE) - -#if defined(OS_ANDROID) -namespace ui { -bool GrabViewSnapshot(gfx::NativeView /*view*/, std::vector<unsigned char>* /*png_representation*/, const gfx::Rect& /*snapshot_bounds*/) -{ - NOTIMPLEMENTED(); - return false; -} -} - -namespace media { -const std::string FakeVideoCaptureDevice::Name::GetModel() const -{ - return ""; -} -} -#endif diff --git a/src/core/config/embedded_android.pri b/src/core/config/embedded_android.pri deleted file mode 100644 index 4684c2aef..000000000 --- a/src/core/config/embedded_android.pri +++ /dev/null @@ -1,74 +0,0 @@ - -CC = $$which($$QMAKE_CC) -ANDROID_TOOLCHAIN = $$dirname(CC) -TOOLCHAIN_SYSROOT = $$ANDROID_BUILD_TOP - -GYP_ARGS += "-D qt_os=\"embedded_android\" -D android_src=\"$${TOOLCHAIN_SYSROOT}\" -D android_toolchain=\"$${ANDROID_TOOLCHAIN}\"" \ - "-D android_ndk_root=\"$${TOOLCHAIN_SYSROOT}\" -D android_product_out=\"$${ANDROID_PRODUCT_OUT}\"" - -GYP_CONFIG += \ - OS=android_no_sdk \ - android_webview_build=0 \ - build_ffmpegsumo=0 \ - configuration_policy=0 \ - disable_nacl=1 \ - embedded=1 \ - enable_autofill_dialog=0 \ - enable_automation=0 \ - enable_background=0 \ - enable_captive_portal_detection=0 \ - enable_extensions=0 \ - enable_google_now=0 \ - enable_language_detection=0 \ - enable_managed_users=0 \ - enable_plugin_installation=0 \ - enable_plugins=0 \ - enable_printing=0 \ - enable_session_service=0 \ - enable_spellcheck=0 \ - enable_task_manager=0 \ - enable_themes=0 \ - enable_webrtc=0 \ - gcc_version=46 \ - gtest_target_type=none \ - input_speech=0 \ - java_bridge=0 \ - media_use_ffmpeg=0 \ - media_use_libvpx=0 \ - native_discardable_memory=1 \ - native_memory_pressure_signals=1 \ - notifications=0 \ - p2p_apis=0 \ - posix_avoid_mmap=1 \ - proprietary_codecs=0 \ - remoting=0 \ - safe_browsing=0 \ - skia_os=android \ - test_isolation_mode=noop \ - use_aura=0 \ - use_cairo=0 \ - use_canvas_skia=0 \ - use_cups=0 \ - use_default_render_theme=1 \ - use_ffmpeg=0 \ - use_gconf=0 \ - use_gio=0 \ - use_glib=0 \ - use_gnome_keyring=0 \ - use_kerberos=0 \ - use_libffmpeg=0 \ - use_openmax_dl_fft=0 \ - use_openssl=1 \ - use_openssl_certs=1 \ - use_ozone=0 \ - use_pango=0 \ - use_pulseaudio=0 \ - use_system_expat=1 \ - use_system_icu=0 \ - use_system_libjpeg=0 \ - use_system_skia=0 \ - use_system_sqlite=0 \ - use_system_stlport=0 \ - use_x11=0 \ - v8_use_snapshot=false \ - want_separate_host_toolset=0 \ diff --git a/src/core/core_common.pri b/src/core/core_common.pri index 2e9ee4198..cefde4302 100644 --- a/src/core/core_common.pri +++ b/src/core/core_common.pri @@ -5,4 +5,8 @@ TARGET = QtWebEngineCore QT += qml quick webchannel QT_PRIVATE += quick-private gui-private core-private +# Make QtCreator happy. +CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$${getChromiumSrcDir()} +INCLUDEPATH += $$CHROMIUM_SRC_DIR + qtHaveModule(positioning):QT += positioning diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro index 7ca57f190..07ce48317 100644 --- a/src/core/core_gyp_generator.pro +++ b/src/core/core_gyp_generator.pro @@ -128,6 +128,7 @@ HEADERS = \ process_main.h \ qrc_protocol_handler_qt.h \ qt_render_view_observer_host.h \ + qtwebenginecoreglobal.h \ render_widget_host_view_qt.h \ render_widget_host_view_qt_delegate.h \ renderer/content_renderer_client_qt.h \ diff --git a/src/core/gl_context_qt.cpp b/src/core/gl_context_qt.cpp index b21ef8539..baccddc9d 100644 --- a/src/core/gl_context_qt.cpp +++ b/src/core/gl_context_qt.cpp @@ -134,7 +134,7 @@ void* GLContextHelper::getNativeDisplay() QT_END_NAMESPACE -#if defined(USE_OZONE) || defined(OS_ANDROID) || defined(OS_WIN) +#if defined(USE_OZONE) || defined(OS_WIN) namespace gfx { @@ -158,4 +158,4 @@ scoped_refptr<GLContext> GLContext::CreateGLContext(GLShareGroup* share_group, G } // namespace gfx -#endif // defined(USE_OZONE) || defined(OS_ANDROID) || defined(OS_WIN) +#endif // defined(USE_OZONE) || defined(OS_WIN) diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro index 8d4d77351..e1691faa6 100644 --- a/src/core/gyp_run.pro +++ b/src/core/gyp_run.pro @@ -7,9 +7,8 @@ TEMPLATE = aux cross_compile { GYP_ARGS = "-D qt_cross_compile=1" posix: GYP_ARGS += "-D os_posix=1" - android: include(config/embedded_android.pri) qnx: include(config/embedded_qnx.pri) - linux:!android: include(config/embedded_linux.pri) + linux: include(config/embedded_linux.pri) } else { # !cross_compile GYP_ARGS = "-D qt_cross_compile=0" diff --git a/src/core/qtwebengine.gypi b/src/core/qtwebengine.gypi index cb9ea435b..15da6b6ec 100644 --- a/src/core/qtwebengine.gypi +++ b/src/core/qtwebengine.gypi @@ -55,18 +55,8 @@ '<(chromium_src_dir)/base/allocator/allocator.gyp:allocator', ], }], - # embedded_android and embedded_linux need some additional options. - ['qt_os=="embedded_linux" or qt_os=="embedded_android"', { - 'conditions': [ - ['qt_os=="embedded_android"', { - 'dependencies': [ - '<(chromium_src_dir)/ui/ozone/ozone.gyp:ozone_base', - '<(chromium_src_dir)/third_party/ashmem/ashmem.gyp:ashmem', - '<(chromium_src_dir)/third_party/freetype/freetype.gyp:ft2', - '<(chromium_src_dir)/third_party/android_tools/ndk/android_tools_ndk.gyp:cpu_features', - ], - }], - ], + # embedded_linux need some additional options. + ['qt_os=="embedded_linux"', { 'configurations': { 'Debug_Base': { # Reduce the binary size. diff --git a/src/core/qtwebengine_extras.gypi b/src/core/qtwebengine_extras.gypi index c128f289a..e28d6436e 100644 --- a/src/core/qtwebengine_extras.gypi +++ b/src/core/qtwebengine_extras.gypi @@ -6,7 +6,6 @@ 'target_defaults': { # patterns used to exclude chromium files from the build when we have a drop-in replacement 'sources/': [ - ['exclude', 'clipboard/clipboard_android.cc$'], ['exclude', 'clipboard/clipboard_aura.cc$'], ['exclude', 'clipboard/clipboard_aurax11.cc$'], ['exclude', 'clipboard/clipboard_gtk.cc$'], @@ -16,38 +15,31 @@ ['exclude', 'dragdrop/os_exchange_data_provider_aurax11\\.(cc|h)$'], ['exclude', 'dragdrop/os_exchange_data_provider_win\\.(cc|h)$'], ['exclude', 'dragdrop/os_exchange_data_provider_mac\\.(mm|h)$'], - ['exclude', 'resource/resource_bundle_android.cc$'], ['exclude', 'resource/resource_bundle_auralinux.cc$'], ['exclude', 'resource/resource_bundle_gtk.cc$'], ['exclude', 'resource/resource_bundle_mac.mm$'], ['exclude', 'resource/resource_bundle_win.cc$'], - ['exclude', 'browser/web_contents/web_contents_view_android\\.(cc|h)$'], ['exclude', 'browser/web_contents/web_contents_view_aura\\.(cc|h)$'], ['exclude', 'browser/web_contents/web_contents_view_gtk\\.(cc|h)$'], ['exclude', 'browser/web_contents/web_contents_view_mac\\.(mm|h)$'], ['exclude', 'browser/web_contents/web_contents_view_win\\.(cc|h)$'], ['exclude', 'browser/renderer_host/gtk_im_context_wrapper\\.cc$'], - ['exclude', 'browser/renderer_host/native_web_keyboard_event_android.cc$'], ['exclude', 'browser/renderer_host/native_web_keyboard_event_aura.cc$'], ['exclude', 'browser/renderer_host/native_web_keyboard_event_mac.mm$'], ['exclude', 'browser/renderer_host/pepper/pepper_truetype_font_list_pango\\.cc$'], - ['exclude', 'browser/renderer_host/render_widget_host_view_android\\.(cc|h)$'], ['exclude', 'browser/renderer_host/render_widget_host_view_aura\\.(cc|h)$'], ['exclude', 'browser/renderer_host/render_widget_host_view_gtk\\.(cc|h)$'], ['exclude', 'browser/renderer_host/render_widget_host_view_mac\\.(mm|h)$'], ['exclude', 'browser/renderer_host/render_widget_host_view_win\\.(cc|h)$'], ['exclude', 'common/font_list_pango\\.cc$'], - ['exclude', 'browser/accessibility/browser_accessibility_android\\.(cc|h)$'], ['exclude', 'browser/accessibility/browser_accessibility_cocoa\\.(cc|h)$'], ['exclude', 'browser/accessibility/browser_accessibility_gtk\\.(cc|h)$'], ['exclude', 'browser/accessibility/browser_accessibility_mac\\.(cc|h)$'], ['exclude', 'browser/accessibility/browser_accessibility_win\\.(cc|h)$'], - ['exclude', 'browser/accessibility/browser_accessibility_manager_android\\.(cc|h)$'], ['exclude', 'browser/accessibility/browser_accessibility_manager_gtk\\.(cc|h)$'], ['exclude', 'browser/accessibility/browser_accessibility_manager_mac\\.(cc|h)$'], ['exclude', 'browser/accessibility/browser_accessibility_manager_win\\.(cc|h)$'], ['exclude', 'command_buffer/service/async_pixel_transfer_manager_egl\\.(cc|h)$'], - ['exclude', 'common/gpu/image_transport_surface_android\\.cc$'], ['exclude', 'common/gpu/image_transport_surface_linux\\.cc$'], ['exclude', 'common/gpu/image_transport_surface_win\\.cc$'], ['exclude', 'gl_surface_egl\\.cc$'], @@ -57,7 +49,6 @@ ['exclude', 'gl_surface_ozone\\.cc$'], # Avoid the ATL dependency to allow building with VS Express ['exclude', 'browser/accessibility/accessibility_tree_formatter\\.(cc|h)$',], - ['exclude', 'browser/accessibility/accessibility_tree_formatter_android\\.(cc|h)$',], ['exclude', 'browser/accessibility/accessibility_tree_formatter_mac\\.(mm|h)$',], ['exclude', 'browser/accessibility/accessibility_tree_formatter_utils_win\\.(cc|h)$',], ['exclude', 'browser/accessibility/accessibility_tree_formatter_win\\.(cc|h)$',], diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index 19b551b71..68330a486 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -184,12 +184,6 @@ public: virtual void WindowFrameChanged() Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED } #endif // defined(OS_MACOSX) -#if defined(OS_ANDROID) - virtual void ShowDisambiguationPopup(const gfx::Rect&, const SkBitmap&) Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED } - virtual void LockCompositingSurface() Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED } - virtual void UnlockCompositingSurface() Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED } -#endif // defined(OS_ANDROID) - #if defined(OS_WIN) #if defined(USE_AURA) virtual void SetParentNativeViewAccessible(gfx::NativeViewAccessible accessible_parent) Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED } diff --git a/src/core/surface_factory_qt.cpp b/src/core/surface_factory_qt.cpp index 963f7b517..40c65d9d3 100644 --- a/src/core/surface_factory_qt.cpp +++ b/src/core/surface_factory_qt.cpp @@ -45,7 +45,8 @@ #include <QGuiApplication> -#if defined(USE_OZONE) || defined(OS_ANDROID) +#if defined(USE_OZONE) + #include <EGL/egl.h> #ifndef QT_LIBDIR_EGL @@ -69,12 +70,6 @@ base::NativeLibrary LoadLibrary(const base::FilePath& filename) { bool SurfaceFactoryQt::LoadEGLGLES2Bindings(AddGLLibraryCallback add_gl_library, SetGLGetProcAddressProcCallback set_gl_get_proc_address) { -#if defined(OS_ANDROID) - // This is done in gl_implementation_android.cc for now. We might need to switch if we - // start supporting the emulator platform but that would be a more intrusive change. - Q_UNREACHABLE(); - return false; -#else base::FilePath libEGLPath = QtWebEngineCore::toFilePath(QT_LIBDIR_EGL); libEGLPath = libEGLPath.Append("libEGL.so"); base::NativeLibrary eglLibrary = LoadLibrary(libEGLPath); @@ -99,7 +94,6 @@ bool SurfaceFactoryQt::LoadEGLGLES2Bindings(AddGLLibraryCallback add_gl_library, gfx::AddGLNativeLibrary(eglLibrary); gfx::AddGLNativeLibrary(gles2Library); return true; -#endif // defined(OS_ANDROID) } intptr_t SurfaceFactoryQt::GetNativeDisplay() @@ -114,5 +108,5 @@ intptr_t SurfaceFactoryQt::GetNativeDisplay() } // namespace QtWebEngineCore -#endif // defined(USE_OZONE) || defined(OS_ANDROID) +#endif // defined(USE_OZONE) diff --git a/src/core/surface_factory_qt.h b/src/core/surface_factory_qt.h index 7d6f0435e..26cbf9a01 100644 --- a/src/core/surface_factory_qt.h +++ b/src/core/surface_factory_qt.h @@ -37,7 +37,7 @@ #ifndef SURFACE_FACTORY_QT #define SURFACE_FACTORY_QT -#if defined(USE_OZONE) || defined(OS_ANDROID) +#if defined(USE_OZONE) #include "ui/ozone/public/surface_factory_ozone.h" @@ -54,7 +54,7 @@ class SurfaceFactoryQt } // namespace QtWebEngineCore -#endif // defined(USE_OZONE) || defined(OS_ANDROID) +#endif // defined(USE_OZONE) #endif // SURFACE_FACTORY_QT diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index b830110a7..10d6bdd74 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -214,13 +214,6 @@ WebEngineContext::WebEngineContext() parsedCommandLine->AppendSwitchASCII(switches::kProfilerTiming, switches::kProfilerTimingDisabledValue); #endif -#if defined(OS_ANDROID) - // On eAndroid we use this to get the native display - // from Qt in GLSurfaceEGL::InitializeOneOff. - m_surfaceFactory.reset(new SurfaceFactoryQt()); - parsedCommandLine->AppendSwitch(switches::kDisableOverscrollEdgeEffect); -#endif - GLContextHelper::initialize(); if (usingANGLE() || usingSoftwareDynamicGL() || usingQtQuick2DRenderer()) { diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h index a3795b0a9..f900c93d8 100644 --- a/src/core/web_engine_context.h +++ b/src/core/web_engine_context.h @@ -79,9 +79,6 @@ private: scoped_ptr<QtWebEngineCore::ContentMainDelegateQt> m_mainDelegate; scoped_ptr<content::ContentMainRunner> m_contentRunner; scoped_ptr<content::BrowserMainRunner> m_browserRunner; -#if defined(OS_ANDROID) - scoped_ptr<QtWebEngineCore::SurfaceFactoryQt> m_surfaceFactory; -#endif QObject* m_globalQObject; QExplicitlySharedDataPointer<QtWebEngineCore::BrowserContextAdapter> m_defaultBrowserContext; scoped_ptr<QtWebEngineCore::DevToolsHttpHandlerDelegateQt> m_devtools; diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index ce862aae6..17f6b2a05 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -60,6 +60,11 @@ using namespace QtWebEngineCore; namespace { +QString fallbackDir() { + static QString directory = QDir::homePath() % QLatin1String("/.") % QCoreApplication::applicationName(); + return directory; +} + QString location(QLibraryInfo::LibraryLocation path) { #if defined(Q_OS_BLACKBERRY) @@ -173,7 +178,22 @@ QString pluginsPath() #if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) return getPath(frameworkBundle()) % QLatin1String("/Libraries"); #else - return location(QLibraryInfo::PluginsPath) % QLatin1String("/qtwebengine"); + static bool initialized = false; + static QString potentialPluginsPath = location(QLibraryInfo::PluginsPath) % QDir::separator() % QLatin1String("qtwebengine"); + + if (!initialized) { + initialized = true; + if (!QFileInfo::exists(potentialPluginsPath)) { + qWarning("Installed Qt plugins directory not found at location %s. Trying application directory...", qPrintable(potentialPluginsPath)); + potentialPluginsPath = QCoreApplication::applicationDirPath() % QDir::separator() % QLatin1String("qtwebengine"); + } + if (!QFileInfo::exists(potentialPluginsPath)) { + qWarning("Qt WebEngine Plugins directory not found at location %s. Trying fallback directory... Plugins as for example video codecs MAY NOT work.", qPrintable(potentialPluginsPath)); + potentialPluginsPath = fallbackDir(); + } + } + + return potentialPluginsPath; #endif } @@ -182,30 +202,48 @@ QString localesPath() #if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) return getResourcesPath(frameworkBundle()) % QLatin1String("/qtwebengine_locales"); #else - return location(QLibraryInfo::TranslationsPath) % QDir::separator() % QLatin1String("qtwebengine_locales"); -#endif -} + static bool initialized = false; + static QString potentialLocalesPath = location(QLibraryInfo::TranslationsPath) % QDir::separator() % QLatin1String("qtwebengine_locales"); -QString fallbackDir() { - static QString directory = QDir::homePath() % QLatin1String("/.") % QCoreApplication::applicationName(); - return directory; -} + if (!initialized) { + initialized = true; + if (!QFileInfo::exists(potentialLocalesPath)) { + qWarning("Installed Qt WebEngine locales directory not found at location %s. Trying application directory...", qPrintable(potentialLocalesPath)); + potentialLocalesPath = QCoreApplication::applicationDirPath() % QDir::separator() % QLatin1String("qtwebengine_locales"); + } + if (!QFileInfo::exists(potentialLocalesPath)) { + qWarning("Qt WebEngine locales directory not found at location %s. Trying fallback directory... Translations MAY NOT not be correct.", qPrintable(potentialLocalesPath)); + potentialLocalesPath = fallbackDir(); + } + } -} // namespace + return potentialLocalesPath; +#endif +} -#if defined(OS_ANDROID) -namespace base { -// Replace the Android base path provider that depends on jni. -// With this we avoid patching chromium which we would need since -// PathService registers PathProviderAndroid by default on Android. -bool PathProviderAndroid(int key, FilePath* result) +QString libraryDataPath() { - *result = WebEngineLibraryInfo::getPath(key); - return !(result->empty()); -} +#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) + return getResourcesPath(frameworkBundle()); +#else + static bool initialized = false; + static QString potentialDataPath = location(QLibraryInfo::DataPath); + if (!initialized) { + initialized = true; + if (!QFileInfo::exists(potentialDataPath)) { + qWarning("Qt WebEngine data directory not found at location %s. Trying application directory...", qPrintable(potentialDataPath)); + potentialDataPath = QCoreApplication::applicationDirPath(); + } + if (!QFileInfo::exists(potentialDataPath)) { + qWarning("Qt WebEngine data directory not found at location %s. Trying fallback directory... The application MAY NOT work.", qPrintable(potentialDataPath)); + potentialDataPath = fallbackDir(); + } + } + return potentialDataPath; +#endif } -#endif // defined(OS_ANDROID) +} // namespace base::FilePath WebEngineLibraryInfo::getPath(int key) { @@ -232,18 +270,7 @@ base::FilePath WebEngineLibraryInfo::getPath(int key) directory = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); break; case base::DIR_QT_LIBRARY_DATA: -#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) - return toFilePath(getResourcesPath(frameworkBundle())); -#else - return toFilePath(location(QLibraryInfo::DataPath)); -#endif -#if defined(OS_ANDROID) - case base::DIR_SOURCE_ROOT: - case base::DIR_ANDROID_EXTERNAL_STORAGE: - case base::DIR_ANDROID_APP_DATA: - directory = QStandardPaths::writableLocation(QStandardPaths::DataLocation); - break; -#endif + return toFilePath(libraryDataPath()); case content::DIR_MEDIA_LIBS: return toFilePath(pluginsPath()); case ui::DIR_LOCALES: diff --git a/src/process/process.pro b/src/process/process.pro index 1d57a6c40..1a62a4f2c 100644 --- a/src/process/process.pro +++ b/src/process/process.pro @@ -28,7 +28,8 @@ contains(QT_CONFIG, qt_framework) { "$(TARGET) " } else { CONFIG -= app_bundle - DESTDIR = $$MODULE_BASE_OUTDIR/libexec + win32: DESTDIR = $$MODULE_BASE_OUTDIR/bin + else: DESTDIR = $$MODULE_BASE_OUTDIR/libexec QT_PRIVATE += webenginecore } diff --git a/src/webengine/api/qquickwebenginedownloaditem.cpp b/src/webengine/api/qquickwebenginedownloaditem.cpp index c38f5ea1c..64e75a086 100644 --- a/src/webengine/api/qquickwebenginedownloaditem.cpp +++ b/src/webengine/api/qquickwebenginedownloaditem.cpp @@ -62,6 +62,8 @@ QQuickWebEngineDownloadItemPrivate::QQuickWebEngineDownloadItemPrivate(QQuickWeb : profile(p) , downloadId(-1) , downloadState(QQuickWebEngineDownloadItem::DownloadCancelled) + , totalBytes(-1) + , receivedBytes(0) { } diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index 545352861..69c524356 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -88,6 +88,7 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info) QQuickWebEngineDownloadItemPrivate *itemPrivate = new QQuickWebEngineDownloadItemPrivate(this); itemPrivate->downloadId = info.id; itemPrivate->downloadState = QQuickWebEngineDownloadItem::DownloadRequested; + itemPrivate->totalBytes = info.totalBytes; itemPrivate->downloadPath = info.path; QQuickWebEngineDownloadItem *download = new QQuickWebEngineDownloadItem(itemPrivate, q); diff --git a/src/webengine/doc/src/qquickwebengineview_lgpl.qdoc b/src/webengine/doc/src/qquickwebengineview_lgpl.qdoc index 6d04473d3..5f41fde67 100644 --- a/src/webengine/doc/src/qquickwebengineview_lgpl.qdoc +++ b/src/webengine/doc/src/qquickwebengineview_lgpl.qdoc @@ -176,6 +176,16 @@ */ /*! + \qmlproperty bool WebEngineView::isFullScreen + \since QtWebEngine 1.1 + \readonly + + Returns \c{true} if the web view is in fullscreen mode, \c{false} otherwise. + + \sa WebEngineView::fullScreenRequested(), WebEngineView::fullScreenCancelled() +*/ + +/*! \qmlmethod void WebEngineView::loadHtml(string html, url baseUrl) \brief Loads the specified \a html as the content of the web view. @@ -253,6 +263,30 @@ */ /*! + \qmlmethod void WebEngineView::fullScreenCancelled() + \since QtWebEngine 1.1 + + Immediately sets \c{isFullScreen} property to \c{false}. It can be used to notify the + browser engine when the windowing system forces the application to leave fullscreen mode. + + \code + ApplicationWindow { + onVisibilityChanged: { + if (webEngineView.isFullScreen && visibility != Window.FullScreen) + webEngineView.fullScreenCancelled() + } + + WebEngineView { + id: webEngineView + ... + } + } + \endcode + + \sa WebEngineView::isFullScreen, WebEngineView::fullScreenRequested() +*/ + +/*! \qmlsignal void WebEngineView::featurePermissionRequested(url securityOrigin, WebEngineView::Feature feature) This is signal is emitted when the web site identified by \a securityOrigin requests @@ -365,6 +399,18 @@ */ /*! + \qmlsignal WebEngineView::fullScreenRequested(request) + \since QtWebEngine 1.1 + + This signal is emitted when the web page requests fullscreen mode through the + JavaScript API. + + The corresponding handler is onFullScreenRequested. + + \sa WebEngineFullScreenRequest, WebEngineView::isFullScreen +*/ + +/*! \qmlproperty enumeration WebEngineView::ErrorDomain This enumeration details various high-level error types. @@ -479,3 +525,49 @@ \sa featurePermissionRequested(), grantFeaturePermission() */ + +/*! + \qmltype WebEngineFullScreenRequest + \instantiates QQuickWebEngineFullScreenRequest + \inqmlmodule QtWebEngine 1.1 + \since QtWebEngine 1.1 + + \brief A utility class for the WebEngineView::fullScreenRequested signal. + + \sa WebEngineView::fullScreenRequested +*/ + +/*! + \qmlproperty bool WebEngineFullScreenRequest::toggleOn + \since QtWebEngine 1.1 + \readonly + + Returns \c{true} if the application should toggle fullscreen mode on, \c{false} otherwise. + + \sa WebEngineFullScreenRequest::accept() +*/ + +/*! + \qmlmethod void WebEngineFullScreenRequest::accept() + \since QtWebEngine 1.1 + + Call this method to accept the fullscreen request. It sets the WebEngineView::isFullScreen + property to be equal to WebEngineFullScreenRequest::toggleOn. + + \code + ApplicationWindow { + id: window + WebEngineView { + onFullScreenRequested: { + if (request.toggleOn) + window.showFullScreen() + else + window.showNormal() + request.accept() + } + } + } + \endcode + + \sa WebEngineFullScreenRequest::toggleOn() +*/ diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 7eb29a185..04de59df0 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -47,6 +47,7 @@ #include <QApplication> #include <QAuthenticator> #include <QClipboard> +#include <QContextMenuEvent> #include <QFileDialog> #include <QKeyEvent> #include <QIcon> diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index af24f42ed..eb925b178 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -116,6 +116,8 @@ static QStringList expectedAPI = QStringList() << "QQuickWebEngineView.HttpErrorDomain --> ErrorDomain" << "QQuickWebEngineView.FtpErrorDomain --> ErrorDomain" << "QQuickWebEngineView.DnsErrorDomain --> ErrorDomain" + << "QQuickWebEngineView.FindBackward --> FindFlags" + << "QQuickWebEngineView.FindCaseSensitively --> FindFlags" << "QQuickWebEngineView.LinkClickedNavigation --> NavigationType" << "QQuickWebEngineView.TypedNavigation --> NavigationType" << "QQuickWebEngineView.FormSubmittedNavigation --> NavigationType" @@ -170,17 +172,29 @@ static QStringList expectedAPI = QStringList() << "QQuickWebEngineView.navigationHistory --> QQuickWebEngineHistory*" << "QQuickWebEngineView.newViewRequested(QQuickWebEngineNewViewRequest*) --> void" << "QQuickWebEngineView.userScripts --> QQmlListProperty<QQuickWebEngineScript>" + << "QQuickWebEngineView.settings --> QQuickWebEngineSettings*" + << "QQuickWebEngineView.testSupport --> QQuickWebEngineTestSupport*" + << "QQuickWebEngineView.webChannel --> QQmlWebChannel*" + << "QQuickWebEngineView.webChannelChanged() --> void" + << "QQuickWebEngineView.reloadAndBypassCache() --> void" + << "QQuickWebEngineView.findText(QString,FindFlags,QJSValue) --> void" + << "QQuickWebEngineView.findText(QString,FindFlags) --> void" + << "QQuickWebEngineView.findText(QString) --> void" << "QQuickWebEngineDownloadItem.id --> uint" << "QQuickWebEngineDownloadItem.state --> DownloadState" - << "QQuickWebEngineDownloadItem.progress --> int" << "QQuickWebEngineDownloadItem.path --> QString" + << "QQuickWebEngineDownloadItem.totalBytes --> qlonglong" + << "QQuickWebEngineDownloadItem.receivedBytes --> qlonglong" + << "QQuickWebEngineDownloadItem.DownloadRequested --> DownloadState" << "QQuickWebEngineDownloadItem.DownloadInProgress --> DownloadState" << "QQuickWebEngineDownloadItem.DownloadCompleted --> DownloadState" << "QQuickWebEngineDownloadItem.DownloadCancelled --> DownloadState" << "QQuickWebEngineDownloadItem.DownloadInterrupted --> DownloadState" << "QQuickWebEngineDownloadItem.stateChanged() --> void" - << "QQuickWebEngineDownloadItem.progressChanged() --> void" << "QQuickWebEngineDownloadItem.pathChanged() --> void" + << "QQuickWebEngineDownloadItem.receivedBytesChanged() --> void" + << "QQuickWebEngineDownloadItem.totalBytesChanged() --> void" + << "QQuickWebEngineDownloadItem.accept() --> void" << "QQuickWebEngineDownloadItem.cancel() --> void" << "QQuickWebEngineHistory.items --> QQuickWebEngineHistoryListModel*" << "QQuickWebEngineHistory.backItems --> QQuickWebEngineHistoryListModel*" @@ -210,7 +224,7 @@ static QStringList expectedAPI = QStringList() << "QQuickWebEngineProfile.httpUserAgent --> QString" << "QQuickWebEngineProfile.httpCacheType --> HttpCacheType" << "QQuickWebEngineProfile.persistentCookiesPolicy --> PersistentCookiesPolicy" - << "QQuickWebEngineProfile.httpCacheMaxSize --> int" + << "QQuickWebEngineProfile.httpCacheMaximumSize --> int" << "QQuickWebEngineProfile.storageNameChanged() --> void" << "QQuickWebEngineProfile.offTheRecordChanged() --> void" << "QQuickWebEngineProfile.persistentStoragePathChanged() --> void" @@ -218,7 +232,33 @@ static QStringList expectedAPI = QStringList() << "QQuickWebEngineProfile.httpUserAgentChanged() --> void" << "QQuickWebEngineProfile.httpCacheTypeChanged() --> void" << "QQuickWebEngineProfile.persistentCookiesPolicyChanged() --> void" - << "QQuickWebEngineProfile.httpCacheMaxSizeChanged() --> void" + << "QQuickWebEngineProfile.httpCacheMaximumSizeChanged() --> void" + << "QQuickWebEngineProfile.downloadRequested(QQuickWebEngineDownloadItem*) --> void" + << "QQuickWebEngineProfile.downloadFinished(QQuickWebEngineDownloadItem*) --> void" + << "QQuickWebEngineSettings.autoLoadImages --> bool" + << "QQuickWebEngineSettings.javascriptEnabled --> bool" + << "QQuickWebEngineSettings.javascriptCanOpenWindows --> bool" + << "QQuickWebEngineSettings.javascriptCanAccessClipboard --> bool" + << "QQuickWebEngineSettings.linksIncludedInFocusChain --> bool" + << "QQuickWebEngineSettings.localStorageEnabled --> bool" + << "QQuickWebEngineSettings.localContentCanAccessRemoteUrls --> bool" + << "QQuickWebEngineSettings.spatialNavigationEnabled --> bool" + << "QQuickWebEngineSettings.localContentCanAccessFileUrls --> bool" + << "QQuickWebEngineSettings.hyperlinkAuditingEnabled --> bool" + << "QQuickWebEngineSettings.errorPageEnabled --> bool" + << "QQuickWebEngineSettings.defaultTextEncoding --> QString" + << "QQuickWebEngineSettings.autoLoadImagesChanged() --> void" + << "QQuickWebEngineSettings.javascriptEnabledChanged() --> void" + << "QQuickWebEngineSettings.javascriptCanOpenWindowsChanged() --> void" + << "QQuickWebEngineSettings.javascriptCanAccessClipboardChanged() --> void" + << "QQuickWebEngineSettings.linksIncludedInFocusChainChanged() --> void" + << "QQuickWebEngineSettings.localStorageEnabledChanged() --> void" + << "QQuickWebEngineSettings.localContentCanAccessRemoteUrlsChanged() --> void" + << "QQuickWebEngineSettings.spatialNavigationEnabledChanged() --> void" + << "QQuickWebEngineSettings.localContentCanAccessFileUrlsChanged() --> void" + << "QQuickWebEngineSettings.hyperlinkAuditingEnabledChanged() --> void" + << "QQuickWebEngineSettings.errorPageEnabledChanged() --> void" + << "QQuickWebEngineSettings.defaultTextEncodingChanged() --> void" << "QQuickWebEngineCertificateError.ignoreCertificateError() --> void" << "QQuickWebEngineCertificateError.rejectCertificate() --> void" << "QQuickWebEngineCertificateError.defer() --> void" @@ -226,8 +266,6 @@ static QStringList expectedAPI = QStringList() << "QQuickWebEngineCertificateError.error --> Error" << "QQuickWebEngineCertificateError.description --> QString" << "QQuickWebEngineCertificateError.overridable --> bool" - << "QQuickWebEngineProfile.downloadStarted(QQuickWebEngineDownloadItem*) --> void" - << "QQuickWebEngineProfile.downloadFinished(QQuickWebEngineDownloadItem*) --> void" << "QQuickWebEngineScript.Deferred --> InjectionPoint" << "QQuickWebEngineScript.DocumentReady --> InjectionPoint" << "QQuickWebEngineScript.DocumentCreation --> InjectionPoint" diff --git a/tests/auto/quick/qmltests/data/append-document-title.js b/tests/auto/quick/qmltests/data/append-document-title.js new file mode 100644 index 000000000..fb4a2a6f2 --- /dev/null +++ b/tests/auto/quick/qmltests/data/append-document-title.js @@ -0,0 +1 @@ +document.title += " with appendix"; diff --git a/tests/auto/quick/qmltests/data/big-user-script.js b/tests/auto/quick/qmltests/data/big-user-script.js new file mode 100644 index 000000000..e6e3d2b44 --- /dev/null +++ b/tests/auto/quick/qmltests/data/big-user-script.js @@ -0,0 +1,110 @@ +// Used to make sure serialization of user scripts between UI process and Web process can handle files bigger +// than the maximum message size defined in ConnectionXXX classes. + +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// + +document.title = "Big user script changed title"; diff --git a/tests/auto/quick/qmltests/data/change-document-title.js b/tests/auto/quick/qmltests/data/change-document-title.js new file mode 100644 index 000000000..bdae45c21 --- /dev/null +++ b/tests/auto/quick/qmltests/data/change-document-title.js @@ -0,0 +1 @@ +document.title = "New title"; diff --git a/tests/auto/quick/qmltests/data/tst_userScripts.qml b/tests/auto/quick/qmltests/data/tst_userScripts.qml new file mode 100644 index 000000000..a9ed933d9 --- /dev/null +++ b/tests/auto/quick/qmltests/data/tst_userScripts.qml @@ -0,0 +1,168 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtTest 1.0 +import QtWebEngine 1.1 + +Item { + WebEngineScript { + id: changeDocumentTitleScript + sourceUrl: Qt.resolvedUrl("change-document-title.js") + injectionPoint: WebEngineScript.DocumentReady + } + + WebEngineScript { + id: appendDocumentTitleScript + sourceUrl: Qt.resolvedUrl("append-document-title.js") + injectionPoint: WebEngineScript.DocumentReady + } + + WebEngineScript { + id: bigUserScript + sourceUrl: Qt.resolvedUrl("big-user-script.js") + injectionPoint: WebEngineScript.DocumentReady + } + + TestWebEngineView { + id: webEngineView + width: 400 + height: 300 + } + + TestWebEngineView { + id: webEngineViewWithConditionalUserScripts + width: 400 + height: 300 + + onNavigationRequested: { + var urlString = request.url.toString(); + if (urlString.indexOf("test1.html") !== -1) + userScripts = [ changeDocumentTitleScript ]; + else if (urlString.indexOf("test2.html") !== -1) + userScripts = [ appendDocumentTitleScript ]; + else + userScripts = []; + } + } + + TestCase { + name: "WebEngineViewUserScripts" + + function init() { + webEngineView.url = ""; + webEngineView.userScripts = []; + } + + function test_oneScript() { + webEngineView.url = Qt.resolvedUrl("test1.html"); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "Test page 1"); + + webEngineView.userScripts = [ changeDocumentTitleScript ]; + compare(webEngineView.title, "Test page 1"); + + webEngineView.reload(); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "New title"); + + webEngineView.url = Qt.resolvedUrl("test2.html"); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "New title"); + + webEngineView.userScripts = []; + compare(webEngineView.title, "New title"); + + webEngineView.reload(); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "Test page with huge link area"); + } + + function test_twoScripts() { + webEngineView.url = Qt.resolvedUrl("test1.html"); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "Test page 1"); + + webEngineView.userScripts = [ changeDocumentTitleScript, appendDocumentTitleScript ]; + + // Make sure the scripts are loaded in order. + appendDocumentTitleScript.injectionPoint = WebEngineScript.Deferred + webEngineView.reload(); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "New title with appendix"); + + appendDocumentTitleScript.injectionPoint = WebEngineScript.DocumentReady + changeDocumentTitleScript.injectionPoint = WebEngineScript.Deferred + webEngineView.reload(); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "New title"); + + // Make sure we can remove scripts from the preload list. + webEngineView.userScripts = [ appendDocumentTitleScript ]; + webEngineView.reload(); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "Test page 1 with appendix"); + + changeDocumentTitleScript.injectionPoint = WebEngineScript.DocumentReady + } + + function test_setUserScriptsConditionally() { + webEngineViewWithConditionalUserScripts.url = Qt.resolvedUrl("test1.html"); + webEngineViewWithConditionalUserScripts.waitForLoadSucceeded(); + compare(webEngineViewWithConditionalUserScripts.title, "New title"); + + webEngineViewWithConditionalUserScripts.url = Qt.resolvedUrl("test2.html"); + webEngineViewWithConditionalUserScripts.waitForLoadSucceeded(); + compare(webEngineViewWithConditionalUserScripts.title, "Test page with huge link area with appendix"); + + webEngineViewWithConditionalUserScripts.url = Qt.resolvedUrl("test3.html"); + webEngineViewWithConditionalUserScripts.waitForLoadSucceeded(); + compare(webEngineViewWithConditionalUserScripts.title, "Test page 3"); + } + + function test_bigScript() { + webEngineView.userScripts = [ bigUserScript ]; + webEngineView.url = Qt.resolvedUrl("test1.html"); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "Big user script changed title"); + } + } +} diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro index c2e915c35..a8a63fd5a 100644 --- a/tests/auto/quick/qmltests/qmltests.pro +++ b/tests/auto/quick/qmltests/qmltests.pro @@ -7,6 +7,9 @@ IMPORTPATH += $$PWD/data OTHER_FILES += \ $$PWD/data/TestWebEngineView.qml \ $$PWD/data/alert.html \ + $$PWD/data/append-document-title.js \ + $$PWD/data/big-user-script.js \ + $$PWD/data/change-document-title.js \ $$PWD/data/confirm.html \ $$PWD/data/favicon.html \ $$PWD/data/favicon.png \ @@ -36,6 +39,9 @@ OTHER_FILES += \ $$PWD/data/tst_properties.qml \ $$PWD/data/tst_runJavaScript.qml \ $$PWD/data/tst_titleChanged.qml \ + $$PWD/data/tst_unhandledKeyEventPropagation.qml \ + $$PWD/data/tst_userScripts.qml \ + $$PWD/data/tst_webchannel.qml \ $$PWD/data/tst_keyboardModifierMapping.qml \ $$PWD/mock-delegates/QtWebEngine/UIDelegates/AlertDialog.qml \ $$PWD/mock-delegates/QtWebEngine/UIDelegates/ConfirmDialog.qml \ @@ -46,7 +52,7 @@ OTHER_FILES += \ load(qt_build_paths) -DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD$${QMAKE_DIR_SEP}data\\\"\" +DEFINES += QUICK_TEST_SOURCE_DIR=\\\"$$re_escape($$PWD$${QMAKE_DIR_SEP}data)\\\" !isQMLTestSupportApiEnabled() { PLUGIN_EXTENSION = .so diff --git a/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp b/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp index 9901bcd76..00e1b1123 100644 --- a/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp +++ b/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp @@ -87,8 +87,6 @@ private Q_SLOTS: void setContent(); void setCacheLoadControlAttribute(); void setUrlWithPendingLoads(); - void setUrlWithFragment_data(); - void setUrlWithFragment(); void setUrlToEmpty(); void setUrlToInvalid(); void setUrlHistory(); @@ -1227,45 +1225,6 @@ void tst_QWebEngineFrame::setUrlWithPendingLoads() page.setUrl(QUrl("about:blank")); } -void tst_QWebEngineFrame::setUrlWithFragment_data() -{ - QTest::addColumn<QUrl>("previousUrl"); - QTest::newRow("empty") << QUrl(); - QTest::newRow("same URL no fragment") << QUrl("qrc:/test1.html"); - // See comments in setUrlSameUrl about using setUrl() with the same url(). - QTest::newRow("same URL with same fragment") << QUrl("qrc:/test1.html#"); - QTest::newRow("same URL with different fragment") << QUrl("qrc:/test1.html#anotherFragment"); - QTest::newRow("another URL") << QUrl("qrc:/test2.html"); -} - -// Based on bug report https://bugs.webkit.org/show_bug.cgi?id=32723 -void tst_QWebEngineFrame::setUrlWithFragment() -{ - QSKIP("FIXME: https://trello.com/c/3L7F8VZJ/217-take-care-about-the-in-page-navigations-in-the-tests"); - QFETCH(QUrl, previousUrl); - - QWebEnginePage page; - - if (!previousUrl.isEmpty()) { - page.load(previousUrl); - ::waitForSignal(&page, SIGNAL(loadFinished(bool))); - QCOMPARE(page.url(), previousUrl); - } - - QSignalSpy spy(&page, SIGNAL(urlChanged(QUrl))); - const QUrl url("qrc:/test1.html#"); - QVERIFY(!url.fragment().isNull()); - - page.setUrl(url); - ::waitForSignal(&page, SIGNAL(urlChanged(QUrl))); - - QCOMPARE(spy.count(), 1); - QVERIFY(!toPlainTextSync(&page).isEmpty()); - // Slight change: This information now comes from Chromium and the behavior of requestedUrl changed in this case. - // QCOMPARE(page.requestedUrl(), url); - QCOMPARE(page.url(), url); -} - void tst_QWebEngineFrame::setUrlToEmpty() { int expectedLoadFinishedCount = 0; diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 970ebf20a..9562871b3 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -1661,6 +1661,7 @@ void tst_QWebEnginePage::inputMethods_data() QTest::newRow("QGraphicsWebView") << "QGraphicsWebView"; } +#if defined(QWEBENGINEPAGE_INPUTMETHODQUERY) static Qt::InputMethodHints inputMethodHints(QObject* object) { if (QGraphicsObject* o = qobject_cast<QGraphicsObject*>(object)) @@ -1686,6 +1687,7 @@ static void clickOnPage(QWebEnginePage* page, const QPoint& position) QMouseEvent evrel(QEvent::MouseButtonRelease, position, Qt::LeftButton, Qt::NoButton, Qt::NoModifier); page->event(&evrel); } +#endif void tst_QWebEnginePage::inputMethods() { @@ -2827,6 +2829,7 @@ public: protected: virtual QString userAgentForUrl(const QUrl& url) const { + Q_UNUSED(url); return QString("My User Agent\nX-New-Http-Header: Oh Noes!"); } }; @@ -3178,6 +3181,7 @@ void tst_QWebEnginePage::findTextSuccessiveShouldCallAllCallbacks() QVERIFY(spy5.wasCalled()); } +#if defined(QWEBENGINEPAGE_SUPPORTEDCONTENTTYPES) static QString getMimeTypeForExtension(const QString &ext) { QMimeType mimeType = QMimeDatabase().mimeTypeForFile(QStringLiteral("filename.") + ext.toLower(), QMimeDatabase::MatchExtension); @@ -3186,6 +3190,7 @@ static QString getMimeTypeForExtension(const QString &ext) return QString(); } +#endif void tst_QWebEnginePage::supportedContentType() { diff --git a/tools/buildscripts/find-included-moc-files b/tools/buildscripts/find-included-moc-files index e55f3824c..c76360299 100755 --- a/tools/buildscripts/find-included-moc-files +++ b/tools/buildscripts/find-included-moc-files @@ -10,4 +10,4 @@ for f in filter(os.path.isfile, sys.argv[1:]): if m: includedMocs.add(m.group(1)) for moc in includedMocs: - print moc + print(moc) diff --git a/tools/buildscripts/find-mocables b/tools/buildscripts/find-mocables index 7c383cfec..6c709399c 100755 --- a/tools/buildscripts/find-mocables +++ b/tools/buildscripts/find-mocables @@ -23,4 +23,4 @@ for f in filter(os.path.isfile, sys.argv[1:]): if re.match(".*Q_OBJECT", line): mocables.add(f) for mocable in mocables: - print mocable + print(mocable) diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf index 2b42346f1..e1864f7b3 100644 --- a/tools/qmake/mkspecs/features/functions.prf +++ b/tools/qmake/mkspecs/features/functions.prf @@ -22,8 +22,8 @@ defineTest(isPlatformSupported) { } defineTest(isPythonVersionSupported) { - python_major_version = $$system('python -c "import sys; print sys.version_info.major"') - python_minor_version = $$system('python -c "import sys; print sys.version_info.minor"') + python_major_version = $$system('python -c "import sys; print(sys.version_info.major)"') + python_minor_version = $$system('python -c "import sys; print(sys.version_info.minor)"') lessThan(python_major_version, 3): greaterThan(python_major_version, 1): greaterThan(python_minor_version, 6): return(true) skipBuild("Using Python version "$$python_major_version"."$$python_minor_version", but Python version 2 (2.7 or later) is required to build Qt WebEngine.") return(false) @@ -73,7 +73,6 @@ defineReplace(getChromiumSrcDir) { defineReplace(extractCFlag) { CFLAGS = $$QMAKE_CC $$QMAKE_CFLAGS - !isEmpty(ANDROID_TARGET_CFLAGS): CFLAGS = $$ANDROID_TARGET_CFLAGS OPTION = $$find(CFLAGS, $$1) OPTION = $$split(OPTION, =) return ($$member(OPTION, 1)) diff --git a/tools/scripts/git_submodule.py b/tools/scripts/git_submodule.py index e5dd9c6cb..93afbacd6 100644 --- a/tools/scripts/git_submodule.py +++ b/tools/scripts/git_submodule.py @@ -46,7 +46,7 @@ import subprocess import sys import version_resolver as resolver -extra_os = ['android', 'mac', 'win'] +extra_os = ['mac', 'win'] def subprocessCall(args): print args diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py index 4e5465a1e..bd2ec4e56 100755 --- a/tools/scripts/take_snapshot.py +++ b/tools/scripts/take_snapshot.py @@ -75,8 +75,7 @@ def isInChromiumBlacklist(file_path): if ( '_jni' in file_path or 'jni_' in file_path or 'testdata/' in file_path - or (file_path.startswith('third_party/android_tools') and - not 'android/cpufeatures' in file_path) + or file_path.startswith('third_party/android_tools') or '/tests/' in file_path or ('/test/' in file_path and not '/webrtc/test/testsupport/' in file_path and diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py index 9a667354e..419fb72d1 100644 --- a/tools/scripts/version_resolver.py +++ b/tools/scripts/version_resolver.py @@ -51,7 +51,7 @@ import json import urllib2 import git_submodule as GitSubmodule -chromium_version = '40.0.2214.28' +chromium_version = '40.0.2214.115' chromium_branch = '2214' ninja_version = 'v1.5.3' |