diff options
-rw-r--r-- | configure.json | 7 | ||||
-rw-r--r-- | src/core/browser_message_filter_qt.cpp | 6 | ||||
-rw-r--r-- | src/core/browser_message_filter_qt.h | 3 | ||||
-rw-r--r-- | src/core/common/qt_messages.h | 3 | ||||
-rw-r--r-- | src/core/content_browser_client_qt.cpp | 2 | ||||
-rw-r--r-- | src/core/content_client_qt.cpp | 4 | ||||
-rw-r--r-- | src/core/renderer/content_renderer_client_qt.cpp | 8 | ||||
-rw-r--r-- | src/core/url_request_context_getter_qt.cpp | 5 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/data/test-iframe.html | 9 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/data/test2.html | 3 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_linkHovered.qml | 8 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_navigationRequested.qml | 10 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/qmltests.pro | 1 | ||||
-rw-r--r-- | tools/qmake/mkspecs/features/configure.prf | 14 |
14 files changed, 54 insertions, 29 deletions
diff --git a/configure.json b/configure.json index ad9fd117c..62b56bbb1 100644 --- a/configure.json +++ b/configure.json @@ -10,6 +10,7 @@ "options": { "alsa": "boolean", "embedded": "boolean", + "optimize-for-size": { "type": "boolean", "name": "optimize_size" }, "ffmpeg": { "type": "enum", "name": "system-ffmpeg", "values": { "system": "yes", "qt": "no" } }, "opus": { "type": "enum", "name": "system-opus", "values": { "system": "yes", "qt": "no" } }, "webp": { "type": "enum", "name": "system-webp", "values": { "system": "yes", "qt": "no" } }, @@ -79,6 +80,11 @@ "purpose": "Enables the embedded build configuration", "output": [ "privateFeature" ] }, + "optimize_size": { + "label": "Optimize for size", + "autoDetect": "tests.embedded", + "output": [ "privateFeature" ] + }, "alsa": { "label": "ALSA", "condition": "config.unix && libs.alsa", @@ -156,6 +162,7 @@ "section": "Qt WebEngine", "entries": [ "embedded", + "optimize_size", "pepper-plugins", "printing-and-pdf", "proprietary-codecs", diff --git a/src/core/browser_message_filter_qt.cpp b/src/core/browser_message_filter_qt.cpp index 7551e5616..446dcb38b 100644 --- a/src/core/browser_message_filter_qt.cpp +++ b/src/core/browser_message_filter_qt.cpp @@ -58,7 +58,7 @@ BrowserMessageFilterQt::BrowserMessageFilterQt(int /*render_process_id*/) bool BrowserMessageFilterQt::OnMessageReceived(const IPC::Message& message) { IPC_BEGIN_MESSAGE_MAP(BrowserMessageFilterQt, message) -#if defined(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_PEPPER_CDMS) IPC_MESSAGE_HANDLER( QtWebEngineHostMsg_IsInternalPluginAvailableForMimeType, OnIsInternalPluginAvailableForMimeType) @@ -68,7 +68,7 @@ bool BrowserMessageFilterQt::OnMessageReceived(const IPC::Message& message) return true; } -#if defined(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_PEPPER_CDMS) void BrowserMessageFilterQt::OnIsInternalPluginAvailableForMimeType( const std::string& mime_type, bool* is_available, std::vector<base::string16>* additional_param_names, @@ -93,6 +93,6 @@ void BrowserMessageFilterQt::OnIsInternalPluginAvailableForMimeType( *is_available = false; } -#endif // defined(ENABLE_PEPPER_CDMS) +#endif // BUILDFLAG(ENABLE_PEPPER_CDMS) } // namespace QtWebEngineCore diff --git a/src/core/browser_message_filter_qt.h b/src/core/browser_message_filter_qt.h index 75ca9fd84..fe4897ece 100644 --- a/src/core/browser_message_filter_qt.h +++ b/src/core/browser_message_filter_qt.h @@ -41,6 +41,7 @@ #define BROWSER_MESSAGE_FILTER_QT_H #include "content/public/browser/browser_message_filter.h" +#include "ppapi/features/features.h" #include <QtGlobal> @@ -53,7 +54,7 @@ public: private: bool OnMessageReceived(const IPC::Message& message) Q_DECL_OVERRIDE; -#if defined(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_PEPPER_CDMS) // Returns whether any internal plugin supporting |mime_type| is registered // and enabled. Does not determine whether the plugin can actually be // instantiated (e.g. whether it has all its dependencies). diff --git a/src/core/common/qt_messages.h b/src/core/common/qt_messages.h index 2c971aab2..d998db20e 100644 --- a/src/core/common/qt_messages.h +++ b/src/core/common/qt_messages.h @@ -6,6 +6,7 @@ #include "content/public/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" +#include "ppapi/features/features.h" #include "user_script_data.h" @@ -72,7 +73,7 @@ IPC_MESSAGE_ROUTED1(WebChannelIPCTransportHost_SendMessage, std::vector<char> /* // Misc messages // These are messages sent from the renderer to the browser process. -#if defined(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_PEPPER_CDMS) // Returns whether any internal plugin supporting |mime_type| is registered and // enabled. Does not determine whether the plugin can actually be instantiated // (e.g. whether it has all its dependencies). diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index b45463d73..b30c4dfa7 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -412,7 +412,7 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost* const int id = host->GetID(); content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme(id, url::kFileScheme); static_cast<BrowserContextQt*>(host->GetBrowserContext())->m_adapter->userResourceController()->renderProcessStartedWithHost(host); -#if defined(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_PEPPER_CDMS) host->AddFilter(new BrowserMessageFilterQt(id)); #endif #if BUILDFLAG(ENABLE_SPELLCHECK) diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index 5d51f65aa..b10a02fbd 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -193,7 +193,7 @@ void AddPepperFlashFromCommandLine(std::vector<content::PepperPluginInfo>* plugi void AddPepperWidevine(std::vector<content::PepperPluginInfo>* plugins) { -#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && !defined(WIDEVINE_CDM_IS_COMPONENT) +#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS) && !defined(WIDEVINE_CDM_IS_COMPONENT) QStringList pluginPaths; const base::CommandLine::StringType widevine_argument = base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(switches::kPpapiWidevinePath); if (!widevine_argument.empty()) @@ -263,7 +263,7 @@ void AddPepperWidevine(std::vector<content::PepperPluginInfo>* plugins) plugins->push_back(widevine_cdm); } } -#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && +#endif // defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS) && // !defined(WIDEVINE_CDM_IS_COMPONENT) } diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 93badf853..a2c2a722e 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -222,7 +222,7 @@ bool ContentRendererClientQt::IsLinkVisited(unsigned long long linkHash) // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#if defined(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_PEPPER_CDMS) static const char kExternalClearKeyPepperType[] = "application/x-ppapi-clearkey-cdm"; static bool IsPepperCdmAvailable(const std::string& pepper_type, @@ -400,17 +400,17 @@ static void AddPepperBasedWidevine(std::vector<std::unique_ptr<media::KeySystemP media::EmeFeatureSupport::NOT_SUPPORTED)); // Distinctive identifier. } #endif // defined(WIDEVINE_CDM_AVAILABLE) -#endif // defined(ENABLE_PEPPER_CDMS) +#endif // BUILDFLAG(ENABLE_PEPPER_CDMS) void ContentRendererClientQt::AddSupportedKeySystems(std::vector<std::unique_ptr<media::KeySystemProperties>> *key_systems) { -#if defined(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_PEPPER_CDMS) AddExternalClearKey(key_systems); #if defined(WIDEVINE_CDM_AVAILABLE) AddPepperBasedWidevine(key_systems); #endif // defined(WIDEVINE_CDM_AVAILABLE) -#endif // defined(ENABLE_PEPPER_CDMS) +#endif // BUILDFLAG(ENABLE_PEPPER_CDMS) } } // namespace diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index 6422a0228..e6314039a 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -537,13 +537,16 @@ void URLRequestContextGetterQt::generateJobFactory() std::unique_ptr<net::URLRequestJobFactoryImpl> jobFactory(new net::URLRequestJobFactoryImpl()); { - // Chromium has transferred a few protocol handlers to us, only pick blob: and chrome: and ignore the rest. + // Chromium has transferred a few protocol handlers to us, only pick blob:, chrome: and filesystem:. content::ProtocolHandlerMap::iterator it = m_protocolHandlers.find(url::kBlobScheme); Q_ASSERT(it != m_protocolHandlers.end()); jobFactory->SetProtocolHandler(it->first, std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>(it->second.release())); it = m_protocolHandlers.find(content::kChromeUIScheme); Q_ASSERT(it != m_protocolHandlers.end()); jobFactory->SetProtocolHandler(it->first, std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>(it->second.release())); + it = m_protocolHandlers.find(url::kFileSystemScheme); + Q_ASSERT(it != m_protocolHandlers.end()); + jobFactory->SetProtocolHandler(it->first, std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>(it->second.release())); m_protocolHandlers.clear(); } diff --git a/tests/auto/quick/qmltests/data/test-iframe.html b/tests/auto/quick/qmltests/data/test-iframe.html new file mode 100644 index 000000000..710c4539a --- /dev/null +++ b/tests/auto/quick/qmltests/data/test-iframe.html @@ -0,0 +1,9 @@ +<html> +<head><title>Test page with huge link area and iframe</title></head> +<body> +<a title="A title" href="test1.html"><img width=200 height=200></a> +<div> + <iframe src="test1.html"></iframe> +</div> +</body> +</html> diff --git a/tests/auto/quick/qmltests/data/test2.html b/tests/auto/quick/qmltests/data/test2.html index 8e20d7e9e..629c2a063 100644 --- a/tests/auto/quick/qmltests/data/test2.html +++ b/tests/auto/quick/qmltests/data/test2.html @@ -2,8 +2,5 @@ <head><title>Test page with huge link area</title></head> <body> <a title="A title" href="test1.html"><img width=200 height=200></a> -<div> - <iframe src="test1.html"></iframe> -</div> </body> </html> diff --git a/tests/auto/quick/qmltests/data/tst_linkHovered.qml b/tests/auto/quick/qmltests/data/tst_linkHovered.qml index 636d14335..d632452fe 100644 --- a/tests/auto/quick/qmltests/data/tst_linkHovered.qml +++ b/tests/auto/quick/qmltests/data/tst_linkHovered.qml @@ -90,11 +90,11 @@ TestWebEngineView { loadVisuallyCommittedSpy.wait(); mouseMove(webEngineView, 100, 100) - linkHoveredSpy.wait(10000); + linkHoveredSpy.wait(12000); compare(linkHoveredSpy.count, 2); compare(webEngineView.lastUrl, Qt.resolvedUrl("test1.html")) mouseMove(webEngineView, 100, 300) - linkHoveredSpy.wait(10000); + linkHoveredSpy.wait(12000); compare(linkHoveredSpy.count, 3); compare(webEngineView.lastUrl, "") } @@ -115,14 +115,14 @@ TestWebEngineView { for (var i = 0; i < 100; i += 10) mouseMove(webEngineView, 100, 100 + i) - linkHoveredSpy.wait(10000); + linkHoveredSpy.wait(12000); compare(linkHoveredSpy.count, 2); compare(webEngineView.lastUrl, Qt.resolvedUrl("test1.html")) for (var i = 0; i < 100; i += 10) mouseMove(webEngineView, 100, 300 + i) - linkHoveredSpy.wait(10000); + linkHoveredSpy.wait(12000); compare(linkHoveredSpy.count, 3); compare(webEngineView.lastUrl, "") } diff --git a/tests/auto/quick/qmltests/data/tst_navigationRequested.qml b/tests/auto/quick/qmltests/data/tst_navigationRequested.qml index b1c94e601..96128574e 100644 --- a/tests/auto/quick/qmltests/data/tst_navigationRequested.qml +++ b/tests/auto/quick/qmltests/data/tst_navigationRequested.qml @@ -92,9 +92,9 @@ TestWebEngineView { function test_navigationRequested() { // Test if we get notified about main frame and iframe loads compare(navigationSpy.count, 0) - webEngineView.url = Qt.resolvedUrl("test2.html") + webEngineView.url = Qt.resolvedUrl("test-iframe.html") navigationSpy.wait() - compare(attributes.mainUrl, Qt.resolvedUrl("test2.html")) + compare(attributes.mainUrl, Qt.resolvedUrl("test-iframe.html")) navigationSpy.wait() compare(attributes.iframeUrl, Qt.resolvedUrl("test1.html")) compare(navigationSpy.count, 2) @@ -111,7 +111,7 @@ TestWebEngineView { function test_ignoreLinkClickedRequest() { // Test if we can ignore clicked link requests compare(navigationSpy.count, 0) - webEngineView.url = Qt.resolvedUrl("test2.html") + webEngineView.url = Qt.resolvedUrl("test-iframe.html") verify(webEngineView.waitForLoadSucceeded()) shouldIgnoreLinkClicks = true @@ -129,9 +129,9 @@ TestWebEngineView { function test_ignoreSubFrameRequest() { // Test if we can ignore sub frame requests shouldIgnoreSubFrameRequests = true - webEngineView.url = Qt.resolvedUrl("test2.html") + webEngineView.url = Qt.resolvedUrl("test-iframe.html") tryCompare(navigationSpy, "count", 2) - compare(attributes.mainUrl, Qt.resolvedUrl("test2.html")) + compare(attributes.mainUrl, Qt.resolvedUrl("test-iframe.html")) compare(attributes.iframeUrl, Qt.resolvedUrl("test1.html")) // We ignored the sub frame request, so // the main frame load should still succeed. diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro index 60c11addc..40fba4512 100644 --- a/tests/auto/quick/qmltests/qmltests.pro +++ b/tests/auto/quick/qmltests/qmltests.pro @@ -38,6 +38,7 @@ OTHER_FILES += \ $$PWD/data/test2.html \ $$PWD/data/test3.html \ $$PWD/data/test4.html \ + $$PWD/data/test-iframe.html \ $$PWD/data/keyboardModifierMapping.html \ $$PWD/data/keyboardEvents.html \ $$PWD/data/titleupdate.js \ diff --git a/tools/qmake/mkspecs/features/configure.prf b/tools/qmake/mkspecs/features/configure.prf index 768b86a30..6e61f2206 100644 --- a/tools/qmake/mkspecs/features/configure.prf +++ b/tools/qmake/mkspecs/features/configure.prf @@ -30,6 +30,7 @@ defineTest(runConfigure) { qtConfig(spellchecker): WEBENGINE_CONFIG += use_spellchecker qtConfig(webrtc): WEBENGINE_CONFIG += use_webrtc qtConfig(embedded): WEBENGINE_CONFIG += embedded_build + qtConfig(optimize_size): WEBENGINE_CONFIG += reduce_binary_size qtConfig(system-webp): WEBENGINE_CONFIG += use_system_libwebp else: WEBENGINE_CONFIG += use_bundled_libwebp qtConfig(system-opus): WEBENGINE_CONFIG += use_system_opus @@ -37,7 +38,7 @@ defineTest(runConfigure) { qtConfig(system-ffmpeg): WEBENGINE_CONFIG += use_system_ffmpeg else: WEBENGINE_CONFIG += use_bundled_ffmpeg } else { - cross_compile: WEBENGINE_CONFIG += embedded_build + cross_compile: WEBENGINE_CONFIG += embedded_build reduce_binary_size } isQtMinimum(5, 9) { qtConfig(appstore-compliant): WEBENGINE_CONFIG += use_appstore_compliant_code @@ -70,7 +71,14 @@ defineTest(runConfigure) { packagesExist(opus): WEBENGINE_CONFIG += use_system_opus else: log("System opus not found. Using Chromium's copy.$${EOL}") } - packagesExist(libxml-2.0,libxslt): WEBENGINE_CONFIG += use_system_libxslt use_system_libxml2 + packagesExist(libxml-2.0,libxslt) { + PKGCONFIG_LIBS_STATIC = $$system($$PKG_CONFIG --libs --static $$PKGCONFIG_LIB) + contains(PKGCONFIG_LIBS_STATIC, icuuc) { + WEBENGINE_CONFIG += use_system_libxslt use_system_libxml2 + } else { + log("System libxml2 or libxslt not configured with ICU. Using Chromium's copies.$${EOL}") + } + } else: log("System libxml2 or libxslt not found. Using Chromium's copies.$${EOL}") for(package, $$list("libevent jsoncpp protobuf")) { packagesExist($$package): WEBENGINE_CONFIG += use_system_$$package @@ -105,8 +113,6 @@ defineTest(runConfigure) { !contains(WEBENGINE_CONFIG, embedded_build) { packagesExist(nss): WEBENGINE_CONFIG += use_nss else: log("System NSS not found, BoringSSL will be used.$${EOL}") - } else { - WEBENGINE_CONFIG *= reduce_binary_size } } |