From: Steve Lamerton Date: Mon, 4 Jul 2011 18:27:14 +0000 (+0000) Subject: Filter out subframes from the ie backend history and the sample. Also document that... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/113e0a926f3bc7994ca911d238da35c9be798232 Filter out subframes from the ie backend history and the sample. Also document that many wxEVT_COMMAND_WEB_VIEW_LOADED events may be sent, one for each frame. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68155 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/interface/wx/webview.h b/interface/wx/webview.h index 2ce2f28cf9..455ce7db72 100644 --- a/interface/wx/webview.h +++ b/interface/wx/webview.h @@ -148,7 +148,8 @@ public: will be generated per frame. @event{EVT_WEB_VIEW_LOADED(id, func)} Process a @c wxEVT_COMMAND_WEB_VIEW_LOADED event generated when the document - is fully loaded and displayed. + is fully loaded and displayed. Note that if the displayed HTML document has + several frames, one such event will be generated per frame. @event{EVT_WEB_VIEW_ERRROR(id, func)} Process a @c wxEVT_COMMAND_WEB_VIEW_ERROR event generated when a navigation error occurs. @@ -458,7 +459,8 @@ public: will be generated per frame. @event{EVT_WEB_VIEW_LOADED(id, func)} Process a @c wxEVT_COMMAND_WEB_VIEW_LOADED event generated when the document - is fully loaded and displayed. + is fully loaded and displayed. Note that if the displayed HTML document has + several frames, one such event will be generated per frame. @event{EVT_WEB_VIEW_ERRROR(id, func)} Process a @c wxEVT_COMMAND_WEB_VIEW_ERROR event generated when a navigation error occurs. diff --git a/samples/web/web.cpp b/samples/web/web.cpp index 4e99892b4c..1130e5aff4 100644 --- a/samples/web/web.cpp +++ b/samples/web/web.cpp @@ -461,7 +461,9 @@ void WebFrame::OnNavigationComplete(wxWebNavigationEvent& evt) */ void WebFrame::OnDocumentLoaded(wxWebNavigationEvent& evt) { - wxLogMessage("%s", "Document loaded; url='" + evt.GetHref() + "'"); + //Only notify if the document is the main frame, not a subframe + if(evt.GetHref() == m_browser->GetCurrentURL()) + wxLogMessage("%s", "Document loaded; url='" + evt.GetHref() + "'"); UpdateState(); } diff --git a/src/msw/webview_ie.cpp b/src/msw/webview_ie.cpp index 398b4af75c..18f56588e2 100644 --- a/src/msw/webview_ie.cpp +++ b/src/msw/webview_ie.cpp @@ -650,8 +650,10 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt) break; wxString url = evt[1].GetString(); - //As we are complete we also add to the history list - if(m_historyEnabled && !m_historyLoadingFromList) + + //As we are complete we also add to the history list, but not if the + //page is not the main page, ie it is a subframe + if(m_historyEnabled && !m_historyLoadingFromList && url == GetCurrentURL()) { //If we are not at the end of the list, then erase everything //between us and the end before adding the new page