+ else // someone has already erased the background, keep it
+ {
+ // preserve the existing background, otherwise we'd erase anything the
+ // user code had drawn in its EVT_ERASE_BACKGROUND handler when we do
+ // the Blit back below
+ dcm.Blit(0, rect.GetTop(),
+ sz.x, rect.GetBottom() - rect.GetTop() + 1,
+ &dc,
+ 0, rect.GetTop());
+ }
+
+ PrepareDC(dcm);
+ dcm.SetMapMode(wxMM_TEXT);
+ dcm.SetBackgroundMode(wxTRANSPARENT);
+
+ wxHtmlRenderingInfo rinfo;
+ wxDefaultHtmlRenderingStyle rstyle;
+ rinfo.SetSelection(m_selection);
+ rinfo.SetStyle(&rstyle);
+ m_Cell->Draw(dcm, 0, 0,
+ y * wxHTML_SCROLL_STEP + rect.GetTop(),
+ y * wxHTML_SCROLL_STEP + rect.GetBottom(),
+ rinfo);
+
+//#define DEBUG_HTML_SELECTION
+#ifdef DEBUG_HTML_SELECTION
+ {
+ int xc, yc, x, y;
+ wxGetMousePosition(&xc, &yc);
+ ScreenToClient(&xc, &yc);
+ CalcUnscrolledPosition(xc, yc, &x, &y);
+ wxHtmlCell *at = m_Cell->FindCellByPos(x, y);
+ wxHtmlCell *before =
+ m_Cell->FindCellByPos(x, y, wxHTML_FIND_NEAREST_BEFORE);
+ wxHtmlCell *after =
+ m_Cell->FindCellByPos(x, y, wxHTML_FIND_NEAREST_AFTER);
+
+ dcm.SetBrush(*wxTRANSPARENT_BRUSH);
+ dcm.SetPen(*wxBLACK_PEN);
+ if (at)
+ dcm.DrawRectangle(at->GetAbsPos(),
+ wxSize(at->GetWidth(),at->GetHeight()));
+ dcm.SetPen(*wxGREEN_PEN);
+ if (before)
+ dcm.DrawRectangle(before->GetAbsPos().x+1, before->GetAbsPos().y+1,
+ before->GetWidth()-2,before->GetHeight()-2);
+ dcm.SetPen(*wxRED_PEN);
+ if (after)
+ dcm.DrawRectangle(after->GetAbsPos().x+2, after->GetAbsPos().y+2,
+ after->GetWidth()-4,after->GetHeight()-4);
+ }
+#endif
+
+ dcm.SetDeviceOrigin(0,0);
+ dc.Blit(0, rect.GetTop(),
+ sz.x, rect.GetBottom() - rect.GetTop() + 1,
+ &dcm,
+ 0, rect.GetTop());