Fix regression with wxHTML table elements background handling.
Wrong background was used for the text inside HTML tables since r72589, fix this by setting the correct background before processing the table elements and restoring it after doing it. Closes #14909. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73283 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
dee05929ba
commit
ff8af61ce0
@ -106,6 +106,8 @@ public:
|
||||
void AddRow(const wxHtmlTag& tag);
|
||||
void AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag);
|
||||
|
||||
const wxColour& GetRowDefaultBackgroundColour() const { return m_rBkg; }
|
||||
|
||||
private:
|
||||
// Reallocates memory to given number of cols/rows
|
||||
// and changes m_NumCols/m_NumRows value to reflect this change
|
||||
@ -676,6 +678,37 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH")
|
||||
wxString m_tAlign, m_rAlign;
|
||||
wxHtmlContainerCell *m_enclosingContainer;
|
||||
|
||||
// Call ParseInner() preserving background colour and mode after any
|
||||
// changes done by it.
|
||||
void CallParseInnerWithBg(const wxHtmlTag& tag, const wxColour& colBg)
|
||||
{
|
||||
const wxColour oldbackclr = m_WParser->GetActualBackgroundColor();
|
||||
const int oldbackmode = m_WParser->GetActualBackgroundMode();
|
||||
if ( colBg.IsOk() )
|
||||
{
|
||||
m_WParser->SetActualBackgroundColor(colBg);
|
||||
m_WParser->SetActualBackgroundMode(wxBRUSHSTYLE_SOLID);
|
||||
m_WParser->GetContainer()->InsertCell(
|
||||
new wxHtmlColourCell(colBg, wxHTML_CLR_BACKGROUND)
|
||||
);
|
||||
}
|
||||
|
||||
ParseInner(tag);
|
||||
|
||||
if ( oldbackmode != m_WParser->GetActualBackgroundMode() ||
|
||||
oldbackclr != m_WParser->GetActualBackgroundColor() )
|
||||
{
|
||||
m_WParser->SetActualBackgroundMode(oldbackmode);
|
||||
m_WParser->SetActualBackgroundColor(oldbackclr);
|
||||
m_WParser->GetContainer()->InsertCell(
|
||||
new wxHtmlColourCell(oldbackclr,
|
||||
oldbackmode == wxBRUSHSTYLE_TRANSPARENT
|
||||
? wxHTML_CLR_TRANSPARENT_BACKGROUND
|
||||
: wxHTML_CLR_BACKGROUND)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
TAG_HANDLER_CONSTR(TABLE)
|
||||
{
|
||||
m_Table = NULL;
|
||||
@ -724,7 +757,7 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH")
|
||||
if (tag.HasParam(wxT("ALIGN")))
|
||||
m_tAlign = tag.GetParam(wxT("ALIGN"));
|
||||
|
||||
ParseInner(tag);
|
||||
CallParseInnerWithBg(tag, m_Table->GetBackgroundColour());
|
||||
|
||||
m_WParser->SetAlign(oldAlign);
|
||||
m_WParser->SetContainer(m_enclosingContainer);
|
||||
@ -787,7 +820,7 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH")
|
||||
new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
}
|
||||
|
||||
ParseInner(tag);
|
||||
CallParseInnerWithBg(tag, m_Table->GetRowDefaultBackgroundColour());
|
||||
|
||||
if ( isHeader )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user