From a6a8cf1cb1515ec19c5216f76e887c5eef84aef3 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 29 Apr 2016 17:10:17 +0200 Subject: Reset the selected text of a page when setHtml is called. When text is selected inside a QWebEngineView, the selection is stored in a RenderWidgetHostViewBase instance. When QWebEngineView::setHtml is called, the stored selection is not cleared, and thus requesting for the selected text will return stale data that is not present in the page anymore. Fix consists in calling WebContentsImpl::Unselect() after the new html is loaded and focused in WebContentsAdapter::setContent(). Change-Id: Idd0f3187f324863b9a805af6a288dccfcbd5566f Task-number: QTBUG-53033 Reviewed-by: Allan Sandfeld Jensen --- src/core/web_contents_adapter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 0c1dd0cc8..30c589c56 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -488,6 +488,7 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE; d->webContents->GetController().LoadURLWithParams(params); d->webContents->Focus(); + d->webContents->Unselect(); } QUrl WebContentsAdapter::activeUrl() const -- cgit v1.2.3