summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/web_contents_adapter.cpp7
-rw-r--r--src/core/web_contents_delegate_qt.cpp3
-rw-r--r--src/core/web_contents_delegate_qt.h3
3 files changed, 9 insertions, 4 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index ffb31ce8a..8b0aafe21 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -300,7 +300,6 @@ public:
scoped_ptr<QtRenderViewObserverHost> renderViewObserverHost;
WebContentsAdapterClient *adapterClient;
quint64 lastRequestId;
- QString lastSearchedString;
};
WebContentsAdapterPrivate::WebContentsAdapterPrivate()
@@ -650,8 +649,8 @@ quint64 WebContentsAdapter::findText(const QString &subString, bool caseSensitiv
blink::WebFindOptions options;
options.forward = !findBackward;
options.matchCase = caseSensitively;
- options.findNext = subString == d->lastSearchedString;
- d->lastSearchedString = subString;
+ options.findNext = subString == d->webContentsDelegate->lastSearchedString();
+ d->webContentsDelegate->setLastSearchedString(subString);
// Find already allows a request ID as input, but only as an int.
// Use the same counter but mod it to MAX_INT, this keeps the same likeliness of request ID clashing.
@@ -663,7 +662,7 @@ quint64 WebContentsAdapter::findText(const QString &subString, bool caseSensitiv
void WebContentsAdapter::stopFinding()
{
Q_D(WebContentsAdapter);
- d->lastSearchedString = QString();
+ d->webContentsDelegate->setLastSearchedString(QString());
d->webContents->GetRenderViewHost()->StopFinding(content::STOP_FIND_ACTION_KEEP_SELECTION);
}
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index 606d62d98..b003a63a7 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -142,6 +142,9 @@ void WebContentsDelegateQt::DidStartProvisionalLoadForFrame(int64, int64, bool i
void WebContentsDelegateQt::DidCommitProvisionalLoadForFrame(int64 frame_id, const base::string16& frame_unique_name, bool is_main_frame, const GURL& url, content::PageTransition transition_type, content::RenderViewHost* render_view_host)
{
+ // Make sure that we don't set the findNext WebFindOptions on a new frame.
+ m_lastSearchedString = QString();
+
// This is currently used for canGoBack/Forward values, which is flattened across frames. For other purposes we might have to pass is_main_frame.
m_viewClient->loadCommitted();
}
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index 4b33fb993..33f06bf8d 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -62,6 +62,8 @@ class WebContentsDelegateQt : public content::WebContentsDelegate
{
public:
WebContentsDelegateQt(content::WebContents*, WebContentsAdapterClient *adapterClient);
+ QString lastSearchedString() const { return m_lastSearchedString; }
+ void setLastSearchedString(const QString &s) { m_lastSearchedString = s; }
virtual content::WebContents *OpenURLFromTab(content::WebContents *source, const content::OpenURLParams &params) Q_DECL_OVERRIDE;
virtual void NavigationStateChanged(const content::WebContents* source, unsigned changed_flags) Q_DECL_OVERRIDE;
@@ -85,6 +87,7 @@ public:
private:
WebContentsAdapterClient *m_viewClient;
+ QString m_lastSearchedString;
};
#endif // WEB_CONTENTS_DELEGATE_QT_H