diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-11-05 14:32:25 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2015-11-05 14:32:25 +0000 |
commit | 09018b99dce7a8ed43b0842055e8775d5021cf04 (patch) | |
tree | 8ab6f1b450eb63f981f9275c0f973695d5a3f7b7 | |
parent | a5e14c7abf8fddfbcbc3223e093f8acb50c459d5 (diff) | |
parent | 14430b465d39a602d917f2a701218ed56360dc4e (diff) |
Merge "Merge branch '5.5' into 5.6" into refs/staging/5.6
-rw-r--r-- | src/core/gl_context_qt.cpp | 8 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview.cpp | 14 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage.cpp | 3 |
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; } |