diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-02-01 13:48:44 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-02-02 14:30:46 +0100 |
commit | 092842b5e00662ae9888a19326a9fe4cf140f4da (patch) | |
tree | 1ebf6cf6adacf07425ea92f3d62588e01269975b /src/core | |
parent | c8bb939e7e45214f17daf8f576582e5bff2527ea (diff) | |
parent | 7644564d754bbee640a091950b77e23586c2d283 (diff) |
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
src/core/download_manager_delegate_qt.cpp
src/core/download_manager_delegate_qt.h
src/core/render_widget_host_view_qt.cpp
src/core/web_contents_adapter.cpp
src/webengine/api/qquickwebengineview.cpp
tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp
Change-Id: I2308414ce257ae5bb0fc9f6493aa111a267ff39b
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/config/common.pri | 13 | ||||
-rw-r--r-- | src/core/config/linux.pri | 9 | ||||
-rw-r--r-- | src/core/gl_surface_qt.cpp | 2 | ||||
-rw-r--r-- | src/core/print_view_manager_qt.cpp | 40 | ||||
-rw-r--r-- | src/core/render_widget_host_view_qt.cpp | 3 | ||||
-rw-r--r-- | src/core/web_contents_adapter.cpp | 2 | ||||
-rw-r--r-- | src/core/web_contents_delegate_qt.cpp | 7 | ||||
-rw-r--r-- | src/core/web_contents_delegate_qt.h | 2 |
8 files changed, 56 insertions, 22 deletions
diff --git a/src/core/config/common.pri b/src/core/config/common.pri index 60aba490c..ab2a60978 100644 --- a/src/core/config/common.pri +++ b/src/core/config/common.pri @@ -47,7 +47,11 @@ qtConfig(webengine-webrtc) { qtConfig(webengine-proprietary-codecs): gn_args += proprietary_codecs=true ffmpeg_branding=\"Chrome\" -!precompile_header: gn_args += disable_precompiled_headers=true +precompile_header { + gn_args += enable_precompiled_headers=true +} else { + gn_args += enable_precompiled_headers=false +} CONFIG(release, debug|release) { force_debug_info { @@ -80,3 +84,10 @@ optimize_size: gn_args += optimize_for_size=true # rtti, linking would fail at build time. sanitize_undefined: gn_args += is_ubsan=true use_rtti=true } + +qtConfig(webengine-v8-snapshot) { + gn_args += v8_use_snapshot=true +} else { + gn_args += v8_use_snapshot=false +} + diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index cdb723b79..f4a95a03c 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -110,7 +110,14 @@ host_build { PKGCONFIG = $$first($$list($$pkgConfigExecutable())) gn_args += pkg_config=\"$$PKGCONFIG\" PKG_CONFIG_HOST = $$(GN_PKG_CONFIG_HOST) - isEmpty(PKG_CONFIG_HOST): PKG_CONFIG_HOST = pkg-config + pkgConfigLibDir = $$(PKG_CONFIG_LIBDIR) + pkgConfigSysrootDir = $$(PKG_CONFIG_SYSROOT_DIR) + isEmpty(PKG_CONFIG_HOST): PKG_CONFIG_HOST = $$QMAKE_PKG_CONFIG_HOST + cross_compile { + !isEmpty(pkgConfigLibDir)|!isEmpty(pkgConfigSysrootDir) { + PKG_CONFIG_HOST = $$pkgConfigHostExecutable() + } + } gn_args += host_pkg_config=\"$$PKG_CONFIG_HOST\" } diff --git a/src/core/gl_surface_qt.cpp b/src/core/gl_surface_qt.cpp index e9491eaba..941fbd211 100644 --- a/src/core/gl_surface_qt.cpp +++ b/src/core/gl_surface_qt.cpp @@ -290,7 +290,7 @@ bool GLSurfaceQtGLX::Initialize(GLSurfaceFormat format) GLX_PBUFFER_HEIGHT, m_size.height(), GLX_LARGEST_PBUFFER, False, GLX_PRESERVED_CONTENTS, False, - GLX_NONE + 0 }; m_surfaceBuffer = glXCreatePbuffer(display, static_cast<GLXFBConfig>(g_config), pbuffer_attributes); diff --git a/src/core/print_view_manager_qt.cpp b/src/core/print_view_manager_qt.cpp index 5198985d7..fef2cf51a 100644 --- a/src/core/print_view_manager_qt.cpp +++ b/src/core/print_view_manager_qt.cpp @@ -154,27 +154,37 @@ static base::DictionaryValue *createPrintSettings() return printSettings; } -static base::DictionaryValue *createPrintSettingsFromQPageLayout(const QPageLayout &pageLayout) +static base::DictionaryValue *createPrintSettingsFromQPageLayout(const QPageLayout &pageLayout, bool printToPdf) { base::DictionaryValue *printSettings = createPrintSettings(); //Set page size attributes, chromium expects these in micrometers - QSizeF pageSizeInMilimeter = pageLayout.pageSize().size(QPageSize::Millimeter); + QRectF pageSizeInMillimeter = pageLayout.pageSize().rect(QPageSize::Millimeter); + if (!printToPdf) { + // QPrinter will extend this size with its margins + QMarginsF margins = pageLayout.margins(QPageLayout::Millimeter); + pageSizeInMillimeter = pageSizeInMillimeter.marginsRemoved(margins); + } std::unique_ptr<base::DictionaryValue> sizeDict(new base::DictionaryValue); - sizeDict->SetInteger(printing::kSettingMediaSizeWidthMicrons, pageSizeInMilimeter.width() * kMicronsToMillimeter); - sizeDict->SetInteger(printing::kSettingMediaSizeHeightMicrons, pageSizeInMilimeter.height() * kMicronsToMillimeter); + sizeDict->SetInteger(printing::kSettingMediaSizeWidthMicrons, pageSizeInMillimeter.width() * kMicronsToMillimeter); + sizeDict->SetInteger(printing::kSettingMediaSizeHeightMicrons, pageSizeInMillimeter.height() * kMicronsToMillimeter); printSettings->Set(printing::kSettingMediaSize, std::move(sizeDict)); - // Apply page margins - QMargins pageMarginsInPoints = pageLayout.marginsPoints(); - std::unique_ptr<base::DictionaryValue> marginsDict(new base::DictionaryValue); - marginsDict->SetInteger(printing::kSettingMarginTop, pageMarginsInPoints.top()); - marginsDict->SetInteger(printing::kSettingMarginBottom, pageMarginsInPoints.bottom()); - marginsDict->SetInteger(printing::kSettingMarginLeft, pageMarginsInPoints.left()); - marginsDict->SetInteger(printing::kSettingMarginRight, pageMarginsInPoints.right()); - - printSettings->Set(printing::kSettingMarginsCustom, std::move(marginsDict)); - printSettings->SetInteger(printing::kSettingMarginsType, printing::CUSTOM_MARGINS); + if (printToPdf) { + // Apply page margins when printing to PDF + QMargins pageMarginsInPoints = pageLayout.marginsPoints(); + std::unique_ptr<base::DictionaryValue> marginsDict(new base::DictionaryValue); + marginsDict->SetInteger(printing::kSettingMarginTop, pageMarginsInPoints.top()); + marginsDict->SetInteger(printing::kSettingMarginBottom, pageMarginsInPoints.bottom()); + marginsDict->SetInteger(printing::kSettingMarginLeft, pageMarginsInPoints.left()); + marginsDict->SetInteger(printing::kSettingMarginRight, pageMarginsInPoints.right()); + + printSettings->Set(printing::kSettingMarginsCustom, std::move(marginsDict)); + printSettings->SetInteger(printing::kSettingMarginsType, printing::CUSTOM_MARGINS); + } else { + // QPrinter will handle margins + printSettings->SetInteger(printing::kSettingMarginsType, printing::NO_MARGINS); + } printSettings->SetBoolean(printing::kSettingLandscape, pageLayout.orientation() == QPageLayout::Landscape); @@ -244,7 +254,7 @@ bool PrintViewManagerQt::PrintToPDFInternal(const QPageLayout &pageLayout, bool if (!pageLayout.isValid()) return false; - m_printSettings.reset(createPrintSettingsFromQPageLayout(pageLayout)); + m_printSettings.reset(createPrintSettingsFromQPageLayout(pageLayout, !m_pdfOutputPath.empty())); m_printSettings->SetBoolean(printing::kSettingShouldPrintBackgrounds , web_contents()->GetRenderViewHost()->GetWebkitPreferences().should_print_backgrounds); m_printSettings->SetInteger(printing::kSettingColor, diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 8986a3495..4f6d6d0ea 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -1595,7 +1595,8 @@ void RenderWidgetHostViewQt::handlePointerEvent(T *event) if (webEvent.GetType() == blink::WebInputEvent::kMouseDown) { if (event->button() != m_clickHelper.lastPressButton || (event->timestamp() - m_clickHelper.lastPressTimestamp > static_cast<ulong>(qGuiApp->styleHints()->mouseDoubleClickInterval())) - || (event->pos() - m_clickHelper.lastPressPosition).manhattanLength() > qGuiApp->styleHints()->startDragDistance()) + || (event->pos() - m_clickHelper.lastPressPosition).manhattanLength() > qGuiApp->styleHints()->startDragDistance() + || m_clickHelper.clickCounter >= 3) m_clickHelper.clickCounter = 0; m_clickHelper.lastPressTimestamp = event->timestamp(); diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index f87cc115b..5b7e437bf 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -367,8 +367,6 @@ WebContentsAdapterPrivate::WebContentsAdapterPrivate() WebContentsAdapterPrivate::~WebContentsAdapterPrivate() { - // Destroy the WebContents first - webContents.reset(); } QSharedPointer<WebContentsAdapter> WebContentsAdapter::createFromSerializedNavigationHistory(QDataStream &input, WebContentsAdapterClient *adapterClient) diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 5364afa94..09cca943e 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -110,6 +110,13 @@ WebContentsDelegateQt::WebContentsDelegateQt(content::WebContents *webContents, Observe(webContents); } +WebContentsDelegateQt::~WebContentsDelegateQt() +{ + // The destruction of this object should take place before + // WebContents destruction since WebContentsAdapterClient + // might be already deleted. +} + content::WebContents *WebContentsDelegateQt::OpenURLFromTab(content::WebContents *source, const content::OpenURLParams ¶ms) { content::WebContents *target = source; diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 7e21e4b55..8a3331163 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -93,7 +93,7 @@ class WebContentsDelegateQt : public content::WebContentsDelegate { public: WebContentsDelegateQt(content::WebContents*, WebContentsAdapterClient *adapterClient); - ~WebContentsDelegateQt() { Q_ASSERT(m_loadingErrorFrameList.isEmpty()); } + ~WebContentsDelegateQt(); QString lastSearchedString() const { return m_lastSearchedString; } void setLastSearchedString(const QString &s) { m_lastSearchedString = s; } int lastReceivedFindReply() const { return m_lastReceivedFindReply; } |