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
This commit is contained in:
Steve Lamerton
2011-07-04 18:27:14 +00:00
parent c36818c8e3
commit 113e0a926f
3 changed files with 11 additions and 5 deletions

View File

@@ -148,7 +148,8 @@ public:
will be generated per frame. will be generated per frame.
@event{EVT_WEB_VIEW_LOADED(id, func)} @event{EVT_WEB_VIEW_LOADED(id, func)}
Process a @c wxEVT_COMMAND_WEB_VIEW_LOADED event generated when the document 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)} @event{EVT_WEB_VIEW_ERRROR(id, func)}
Process a @c wxEVT_COMMAND_WEB_VIEW_ERROR event generated when a navigation Process a @c wxEVT_COMMAND_WEB_VIEW_ERROR event generated when a navigation
error occurs. error occurs.
@@ -458,7 +459,8 @@ public:
will be generated per frame. will be generated per frame.
@event{EVT_WEB_VIEW_LOADED(id, func)} @event{EVT_WEB_VIEW_LOADED(id, func)}
Process a @c wxEVT_COMMAND_WEB_VIEW_LOADED event generated when the document 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)} @event{EVT_WEB_VIEW_ERRROR(id, func)}
Process a @c wxEVT_COMMAND_WEB_VIEW_ERROR event generated when a navigation Process a @c wxEVT_COMMAND_WEB_VIEW_ERROR event generated when a navigation
error occurs. error occurs.

View File

@@ -461,7 +461,9 @@ void WebFrame::OnNavigationComplete(wxWebNavigationEvent& evt)
*/ */
void WebFrame::OnDocumentLoaded(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(); UpdateState();
} }

View File

@@ -650,8 +650,10 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
break; break;
wxString url = evt[1].GetString(); 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 //If we are not at the end of the list, then erase everything
//between us and the end before adding the new page //between us and the end before adding the new page