summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
m---------src/3rdparty0
-rw-r--r--src/core/web_contents_adapter.cpp3
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp31
3 files changed, 16 insertions, 18 deletions
diff --git a/src/3rdparty b/src/3rdparty
-Subproject d0dbe5636cb9d424db0c7ee7850c97d57815013
+Subproject 79930a541473b2e0f950d040c16ab6f22e4aeef
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index c450768fa..709efe9b3 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -782,6 +782,9 @@ void WebContentsAdapter::stopFinding()
{
Q_D(WebContentsAdapter);
d->webContentsDelegate->setLastSearchedString(QString());
+ // Clear any previous selection,
+ // but keep the renderer blue rectangle selection just like Chromium does.
+ d->webContents->Unselect();
d->webContents->StopFinding(content::STOP_FIND_ACTION_KEEP_SELECTION);
}
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 4cff50d3b..ab6db5e2c 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -2970,31 +2970,26 @@ void tst_QWebEnginePage::findText()
QSignalSpy loadSpy(m_page, SIGNAL(loadFinished(bool)));
m_page->setHtml(QString("<html><head></head><body><div>foo bar</div></body></html>"));
QTRY_COMPARE(loadSpy.count(), 1);
+
+ // Select whole page contents.
m_page->triggerAction(QWebEnginePage::SelectAll);
QTRY_COMPARE(m_page->hasSelection(), true);
-#if defined(QWEBENGINEPAGE_SELECTEDHTML)
- QVERIFY(!m_page->selectedHtml().isEmpty());
-#endif
+
+ // Invoke a stopFinding() operation, which should clear the currently selected text.
m_page->findText("");
- QEXPECT_FAIL("", "Unsupported: findText only highlights and doesn't update the selection.", Continue);
- QVERIFY(m_page->selectedText().isEmpty());
-#if defined(QWEBENGINEPAGE_SELECTEDHTML)
- QVERIFY(m_page->selectedHtml().isEmpty());
-#endif
+ QTRY_VERIFY(m_page->selectedText().isEmpty());
+
QStringList words = (QStringList() << "foo" << "bar");
foreach (QString subString, words) {
+ // Invoke a find operation, which should clear the currently selected text, should
+ // highlight all the found ocurrences, but should not update the selected text to the
+ // searched for string.
m_page->findText(subString);
- QEXPECT_FAIL("", "Unsupported: findText only highlights and doesn't update the selection.", Continue);
- QCOMPARE(m_page->selectedText(), subString);
-#if defined(QWEBENGINEPAGE_SELECTEDHTML)
- QVERIFY(m_page->selectedHtml().contains(subString));
-#endif
+ QTRY_VERIFY(m_page->selectedText().isEmpty());
+
+ // Search highlights should be cleared, selected text should still be empty.
m_page->findText("");
- QEXPECT_FAIL("", "Unsupported: findText only highlights and doesn't update the selection.", Continue);
- QVERIFY(m_page->selectedText().isEmpty());
-#if defined(QWEBENGINEPAGE_SELECTEDHTML)
- QVERIFY(m_page->selectedHtml().isEmpty());
-#endif
+ QTRY_VERIFY(m_page->selectedText().isEmpty());
}
}