diff options
author | Alexandru Croitor <alexandru.croitor@theqtcompany.com> | 2016-04-29 17:10:17 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@theqtcompany.com> | 2016-05-03 08:07:43 +0000 |
commit | a6a8cf1cb1515ec19c5216f76e887c5eef84aef3 (patch) | |
tree | 85fdeafe8b1c147d32a4dcbc80c986f9c9fe3e3e /src/core | |
parent | bb494edf4bf3ccfcf7f0276554f45d18cdd3a5cb (diff) |
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 <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/web_contents_adapter.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
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 |