From fdec963fe2048a70513440ee7da34d7d34bf73af Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 13 Jun 2019 15:39:54 +0200 Subject: Backport various minor fixes Needed when building against a newer qt. Change-Id: Id4b2db637c2d8acb6ddcd492f1c66e086e54262c Reviewed-by: Michal Klocek --- .../webenginewidgets/simplebrowser/webpage.cpp | 1 + src/core/delegated_frame_node.cpp | 25 ++++++++++++++++++---- src/core/render_widget_host_view_qt.cpp | 3 ++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/examples/webenginewidgets/simplebrowser/webpage.cpp b/examples/webenginewidgets/simplebrowser/webpage.cpp index 3b78b8618..903956419 100644 --- a/examples/webenginewidgets/simplebrowser/webpage.cpp +++ b/examples/webenginewidgets/simplebrowser/webpage.cpp @@ -56,6 +56,7 @@ #include "webview.h" #include #include +#include WebPage::WebPage(QWebEngineProfile *profile, QObject *parent) : QWebEnginePage(profile, parent) diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp index 8ed88ea5d..2d8d3df8c 100644 --- a/src/core/delegated_frame_node.cpp +++ b/src/core/delegated_frame_node.cpp @@ -120,6 +120,12 @@ #define GL_LINE_LOOP 0x0002 #endif +#ifndef QT_NO_OPENGL +QT_BEGIN_NAMESPACE +Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context(); +QT_END_NAMESPACE +#endif + namespace QtWebEngineCore { #ifndef QT_NO_OPENGL class MailboxTexture : public QSGTexture, protected QOpenGLFunctions { @@ -243,8 +249,14 @@ public: QSGNode *) override { QSGTextureNode *textureNode = static_cast(*m_nodeIterator++); - if (textureNode->texture() != texture) + if (textureNode->texture() != texture) { + // Chromium sometimes uses textures that doesn't completely fit + // in which case the geometry needs to be recalculated even if + // rect and src-rect matches. + if (textureNode->texture()->textureSize() != texture->textureSize()) + textureNode->markDirty(QSGImageNode::DirtyGeometry); textureNode->setTexture(texture); + } if (textureNode->textureCoordinatesTransform() != texCoordTransForm) textureNode->setTextureCoordinatesTransform(texCoordTransForm); if (textureNode->rect() != rect) @@ -258,15 +270,20 @@ public: QSGTexture::Filtering filtering, QSGNode *) override { QSGTextureNode *textureNode = static_cast(*m_nodeIterator++); - + if (textureNode->texture() != texture) { + // Chromium sometimes uses textures that doesn't completely fit + // in which case the geometry needs to be recalculated even if + // rect and src-rect matches. + if (textureNode->texture()->textureSize() != texture->textureSize()) + textureNode->markDirty(QSGImageNode::DirtyGeometry); + textureNode->setTexture(texture); + } if (textureNode->rect() != rect) textureNode->setRect(rect); if (textureNode->sourceRect() != sourceRect) textureNode->setSourceRect(sourceRect); if (textureNode->filtering() != filtering) textureNode->setFiltering(filtering); - if (textureNode->texture() != texture) - textureNode->setTexture(texture); } void setupSolidColorNode(const QRect &rect, const QColor &color, QSGNode *) override { diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index ef2834041..4b00fbc17 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -637,7 +637,8 @@ void RenderWidgetHostViewQt::Destroy() void RenderWidgetHostViewQt::SetTooltipText(const base::string16 &tooltip_text) { - m_adapterClient->setToolTip(toQt(tooltip_text)); + if (m_adapterClient) + m_adapterClient->setToolTip(toQt(tooltip_text)); } void RenderWidgetHostViewQt::CopyFromCompositingSurface(const gfx::Rect& src_subrect, const gfx::Size& dst_size, const content::ReadbackRequestCallback& callback, const SkColorType color_type) -- cgit v1.2.3