X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/03a187ccae181e3736ec206d6d716846bfcb2007..1827c0f538a8dd657d2e513173fbe3794f56eb1e:/src/html/htmlwin.cpp diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index 058804ae6d..636a07610f 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -247,7 +247,7 @@ bool wxHtmlWindowMouseHelper::OnCellClicked(wxHtmlCell *cell, { // if the event wasn't handled, do the default processing here: - wxASSERT_MSG( cell, _T("can't be called with NULL cell") ); + wxASSERT_MSG( cell, wxT("can't be called with NULL cell") ); cell->ProcessMouseClick(m_interface, ev.GetPoint(), ev.GetMouseEvent()); } @@ -338,8 +338,9 @@ bool wxHtmlWindow::Create(wxWindow *parent, wxWindowID id, // at all so disable it to avoid executing any user-defined handlers twice // (and to avoid processing unnecessary event if no handlers are defined). SetBackgroundStyle(wxBG_STYLE_PAINT); - SetPage(wxT("")); + + SetInitialSize(size); return true; } @@ -470,6 +471,9 @@ bool wxHtmlWindow::DoSetPage(const wxString& source) if (m_Cell) { delete m_Cell; + // notice that it's important to set m_Cell to NULL here before calling + // Parse() below, even if it will be overwritten by its return value: + // without this we may crash if it's used from inside Parse() m_Cell = NULL; } m_Cell = (wxHtmlContainerCell*) m_Parser->Parse(newsrc); @@ -653,6 +657,16 @@ bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor) } else { + // Go to next visible cell in current container, if it exists. This + // yields a bit better (even though still imperfect) results in that + // there's better chance of using a suitable cell for upper Y + // coordinate value. See bug #11406 for additional discussion. + const wxHtmlCell *c_save = c; + while ( c && c->IsFormattingCell() ) + c = c->GetNext(); + if ( !c ) + c = c_save; + int y; for (y = 0; c != NULL; c = c->GetParent()) y += c->GetPosY(); @@ -964,7 +978,7 @@ bool wxHtmlWindow::CopySelection(ClipboardType t) const wxString txt(SelectionToText()); wxTheClipboard->SetData(new wxTextDataObject(txt)); wxTheClipboard->Close(); - wxLogTrace(_T("wxhtmlselection"), + wxLogTrace(wxT("wxhtmlselection"), _("Copied to clipboard:\"%s\""), txt.c_str()); return true; @@ -1403,7 +1417,7 @@ void wxHtmlWindow::OnMouseLeave(wxMouseEvent& event) // but seems to happen sometimes under wxMSW - maybe it's a bug // there but for now just ignore it - //wxFAIL_MSG( _T("can't understand where has mouse gone") ); + //wxFAIL_MSG( wxT("can't understand where has mouse gone") ); return; }