summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-11-04 14:24:03 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-11-04 14:24:03 +0100
commit14430b465d39a602d917f2a701218ed56360dc4e (patch)
treea05f4aadf195a3f78843fe9709e237ed06d98994 /src
parent10cd4401b9e4e9fde2a8e17c70a0d11d2dfc306f (diff)
parent215fe3b16d35f3a597658fd378d35bdb56116267 (diff)
Merge branch '5.5' into 5.6
Diffstat (limited to 'src')
-rw-r--r--src/core/gl_context_qt.cpp8
-rw-r--r--src/webengine/api/qquickwebengineview.cpp14
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp3
3 files changed, 21 insertions, 4 deletions
diff --git a/src/core/gl_context_qt.cpp b/src/core/gl_context_qt.cpp
index b350c3c5b..3c3b8225d 100644
--- a/src/core/gl_context_qt.cpp
+++ b/src/core/gl_context_qt.cpp
@@ -146,10 +146,14 @@ scoped_refptr<GLContext> GLContext::CreateGLContext(GLShareGroup* share_group, G
{
#if defined(OS_WIN)
scoped_refptr<GLContext> context;
- if (GetGLImplementation() == kGLImplementationDesktopGL)
+ if (GetGLImplementation() == kGLImplementationDesktopGL) {
context = new GLContextWGL(share_group);
- else
+ if (!context->Initialize(compatible_surface, gpu_preference))
+ return nullptr;
+ return context;
+ } else {
context = new GLContextEGL(share_group);
+ }
#else
scoped_refptr<GLContext> context = new GLContextEGL(share_group);
#endif
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 52245e147..29f819eb3 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -653,11 +653,25 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent
}
Q_Q(QQuickWebEngineView);
+
+ // memorize what webChannel we had for the previous adapter
+ QQmlWebChannel *qmlWebChannel = NULL;
+ if (adapter)
+ qmlWebChannel = qobject_cast<QQmlWebChannel *>(adapter->webChannel());
+
// This throws away the WebContentsAdapter that has been used until now.
// All its states, particularly the loading URL, are replaced by the adopted WebContentsAdapter.
adapter = webContents;
adapter->initialize(this);
+ // associate the webChannel with the new adapter
+ if (qmlWebChannel)
+ adapter->setWebChannel(qmlWebChannel);
+
+ // re-bind the userscrips to the new adapter
+ Q_FOREACH (QQuickWebEngineScript *script, m_userScripts)
+ script->d_func()->bind(browserContextAdapter()->userScriptController(), adapter.data());
+
// Emit signals for values that might be different from the previous WebContentsAdapter.
emit q->titleChanged();
emit q->urlChanged();
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 93e229db8..acce76910 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -861,7 +861,7 @@ bool QWebEnginePage::event(QEvent *e)
bool QWebEnginePagePrivate::contextMenuRequested(const WebEngineContextMenuData &data)
{
- if (!view)
+ if (!view || !view->d_func()->m_pendingContextMenuEvent)
return false;
m_menuData = WebEngineContextMenuData();
@@ -887,7 +887,6 @@ bool QWebEnginePagePrivate::contextMenuRequested(const WebEngineContextMenuData
return false;
break;
}
- Q_ASSERT(view->d_func()->m_pendingContextMenuEvent);
view->d_func()->m_pendingContextMenuEvent = false;
return true;
}