summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-02-06 08:36:01 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2018-02-06 08:36:01 +0000
commitfc37a3964db412d110e7513534b6178e154044c4 (patch)
tree911d1fa23aa8edc4d77a2b2655d3653b56338728 /src
parentf52737f60e505101d2364cd6f3713ea8303f30f0 (diff)
parent092842b5e00662ae9888a19326a9fe4cf140f4da (diff)
Merge "Merge remote-tracking branch 'origin/5.10' into dev" into refs/staging/dev
Diffstat (limited to 'src')
-rw-r--r--src/core/config/common.pri13
-rw-r--r--src/core/config/linux.pri9
-rw-r--r--src/core/gl_surface_qt.cpp2
-rw-r--r--src/core/print_view_manager_qt.cpp40
-rw-r--r--src/core/render_widget_host_view_qt.cpp3
-rw-r--r--src/core/web_contents_adapter.cpp2
-rw-r--r--src/core/web_contents_delegate_qt.cpp7
-rw-r--r--src/core/web_contents_delegate_qt.h2
-rw-r--r--src/webengine/api/qquickwebenginetestsupport.cpp16
-rw-r--r--src/webengine/api/qquickwebengineview.cpp36
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp17
11 files changed, 94 insertions, 53 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 &params)
{
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; }
diff --git a/src/webengine/api/qquickwebenginetestsupport.cpp b/src/webengine/api/qquickwebenginetestsupport.cpp
index b3290d3cc..b7b863125 100644
--- a/src/webengine/api/qquickwebenginetestsupport.cpp
+++ b/src/webengine/api/qquickwebenginetestsupport.cpp
@@ -42,6 +42,7 @@
#include "qquickwebengineloadrequest_p.h"
#include <QQuickWindow>
#include <QtTest/qtest.h>
+#include <QtCore/QTimer>
QT_BEGIN_NAMESPACE
@@ -56,19 +57,20 @@ QQuickWebEngineErrorPage::QQuickWebEngineErrorPage()
void QQuickWebEngineErrorPage::loadFinished(bool success, const QUrl &url)
{
Q_UNUSED(success);
-
- QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadSucceededStatus);
- Q_EMIT loadingChanged(&loadRequest);
- return;
+ QTimer::singleShot(0, this, [this, url]() {
+ QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadSucceededStatus);
+ emit loadingChanged(&loadRequest);
+ });
}
void QQuickWebEngineErrorPage::loadStarted(const QUrl &provisionalUrl)
{
- QQuickWebEngineLoadRequest loadRequest(provisionalUrl, QQuickWebEngineView::LoadStartedStatus);
- Q_EMIT loadingChanged(&loadRequest);
+ QTimer::singleShot(0, this, [this, provisionalUrl]() {
+ QQuickWebEngineLoadRequest loadRequest(provisionalUrl, QQuickWebEngineView::LoadStartedStatus);
+ emit loadingChanged(&loadRequest);
+ });
}
-
QQuickWebEngineTestInputContext::QQuickWebEngineTestInputContext()
: m_visible(false)
{
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 19e85315b..492becaa3 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -331,14 +331,14 @@ void QQuickWebEngineViewPrivate::iconChanged(const QUrl &url)
iconUrl = faviconProvider->attach(q, url);
m_history->reset();
- Q_EMIT q->iconChanged();
+ QTimer::singleShot(0, q, &QQuickWebEngineView::iconChanged);
}
void QQuickWebEngineViewPrivate::loadProgressChanged(int progress)
{
Q_Q(QQuickWebEngineView);
loadProgress = progress;
- Q_EMIT q->loadProgressChanged();
+ QTimer::singleShot(0, q, &QQuickWebEngineView::loadProgressChanged);
}
void QQuickWebEngineViewPrivate::didUpdateTargetURL(const QUrl &hoveredUrl)
@@ -384,12 +384,10 @@ void QQuickWebEngineViewPrivate::loadStarted(const QUrl &provisionalUrl, bool is
m_history->reset();
m_certificateErrorControllers.clear();
- QPointer<QQuickWebEngineView> pq(q);
- QTimer::singleShot(0, [=]()
- {
+ QTimer::singleShot(0, q, [q, provisionalUrl]() {
QQuickWebEngineLoadRequest loadRequest(provisionalUrl, QQuickWebEngineView::LoadStartedStatus);
- if (pq)
- pq->loadingChanged(&loadRequest);
+
+ emit q->loadingChanged(&loadRequest);
});
}
@@ -425,25 +423,27 @@ void QQuickWebEngineViewPrivate::loadFinished(bool success, const QUrl &url, boo
isLoading = false;
m_history->reset();
if (errorCode == WebEngineError::UserAbortedError) {
- QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadStoppedStatus);
- Q_EMIT q->loadingChanged(&loadRequest);
+ QTimer::singleShot(0, q, [q, url]() {
+ QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadStoppedStatus);
+ emit q->loadingChanged(&loadRequest);
+ });
return;
}
if (success) {
explicitUrl = QUrl();
- QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadSucceededStatus);
- Q_EMIT q->loadingChanged(&loadRequest);
+ QTimer::singleShot(0, q, [q, url]() {
+ QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadSucceededStatus);
+ emit q->loadingChanged(&loadRequest);
+ });
return;
}
Q_ASSERT(errorCode);
- QQuickWebEngineLoadRequest loadRequest(
- url,
- QQuickWebEngineView::LoadFailedStatus,
- errorDescription,
- errorCode,
- static_cast<QQuickWebEngineView::ErrorDomain>(WebEngineError::toQtErrorDomain(errorCode)));
- Q_EMIT q->loadingChanged(&loadRequest);
+ QQuickWebEngineView::ErrorDomain errorDomain = static_cast<QQuickWebEngineView::ErrorDomain>(WebEngineError::toQtErrorDomain(errorCode));
+ QTimer::singleShot(0, q, [q, url, errorDescription, errorCode, errorDomain]() {
+ QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadFailedStatus,errorDescription, errorCode, errorDomain);
+ emit q->loadingChanged(&loadRequest);
+ });
return;
}
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index ddd016329..88ad7e447 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -107,8 +107,8 @@ static bool printPdfDataOnPrinter(const QByteArray& data, QPrinter& printer)
return false;
}
- QRect printerPageRect = printer.pageRect();
- PdfiumDocumentWrapperQt pdfiumWrapper(data.constData(), data.size(), printerPageRect.size());
+ QSize pageSize = printer.pageRect().size();
+ PdfiumDocumentWrapperQt pdfiumWrapper(data.constData(), data.size(), pageSize);
int toPage = printer.toPage();
int fromPage = printer.fromPage();
@@ -156,7 +156,8 @@ static bool printPdfDataOnPrinter(const QByteArray& data, QPrinter& printer)
if (currentImage.isNull())
return false;
- painter.drawImage(printerPageRect, currentImage, currentImage.rect());
+ // Painting operations are automatically clipped to the bounds of the drawable part of the page.
+ painter.drawImage(QRect(0, 0, pageSize.width(), pageSize.height()), currentImage, currentImage.rect());
if (printedPages < pageCopies - 1)
printer.newPage();
}
@@ -328,7 +329,7 @@ void QWebEnginePagePrivate::loadStarted(const QUrl &provisionalUrl, bool isError
return;
isLoading = true;
- Q_EMIT q->loadStarted();
+ QTimer::singleShot(0, q, &QWebEnginePage::loadStarted);
updateNavigationActions();
}
@@ -346,7 +347,9 @@ void QWebEnginePagePrivate::loadFinished(bool success, const QUrl &url, bool isE
if (isErrorPage) {
Q_ASSERT(settings->testAttribute(QWebEngineSettings::ErrorPageEnabled));
- Q_EMIT q->loadFinished(false);
+ QTimer::singleShot(0, q, [q](){
+ emit q->loadFinished(false);
+ });
return;
}
@@ -356,7 +359,9 @@ void QWebEnginePagePrivate::loadFinished(bool success, const QUrl &url, bool isE
// Delay notifying failure until the error-page is done loading.
// Error-pages are not loaded on failures due to abort.
if (success || errorCode == -3 /* ERR_ABORTED*/ || !settings->testAttribute(QWebEngineSettings::ErrorPageEnabled)) {
- Q_EMIT q->loadFinished(success);
+ QTimer::singleShot(0, q, [q, success](){
+ emit q->loadFinished(success);
+ });
}
updateNavigationActions();
}