summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-05-26 13:58:50 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-28 10:07:32 +0200
commit3c181552ac5983f93ba0562063897be7772a570b (patch)
tree39433c520cfa7edb1940743f0ff3dff589714fcd /src
parent622f613bc4d41f9d3784fc0249e71ce0d3102a97 (diff)
Fix "findNext" after having navigated to a new page
The findNext flag tells the frame to search starting from the current selection, but the code assumes that the flag won't be used when there isn't any find selection (like when the Frame changed). Make sure that we won't use that flag after we received a load committed signal. Change-Id: I10f0f84226232d150f19fd644d7afe78bc425f74 Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Diffstat (limited to 'src')
-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