Add support for background-color style to span element in wxHTML.
Add code for setting/restoring background mode and use it to implement support for changing the text background colour. Closes #14443. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -34,6 +34,8 @@ TAG_HANDLER_BEGIN(SPAN, "SPAN" )
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
wxColour oldclr = m_WParser->GetActualColor();
|
||||
wxColour oldbackclr = m_WParser->GetActualBackgroundColor();
|
||||
int oldbackmode = m_WParser->GetActualBackgroundMode();
|
||||
int oldsize = m_WParser->GetFontSize();
|
||||
int oldbold = m_WParser->GetFontBold();
|
||||
int olditalic = m_WParser->GetFontItalic();
|
||||
@@ -56,6 +58,18 @@ TAG_HANDLER_BEGIN(SPAN, "SPAN" )
|
||||
}
|
||||
}
|
||||
|
||||
str = styleParams.GetParam(wxS("background-color"));
|
||||
if ( !str.empty() )
|
||||
{
|
||||
wxColour clr;
|
||||
if ( wxHtmlTag::ParseAsColour(str, &clr) )
|
||||
{
|
||||
m_WParser->SetActualBackgroundColor(clr);
|
||||
m_WParser->SetActualBackgroundMode(wxBRUSHSTYLE_SOLID);
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr, wxHTML_CLR_BACKGROUND));
|
||||
}
|
||||
}
|
||||
|
||||
str = styleParams.GetParam(wxS("font-size"));
|
||||
if ( !str.empty() )
|
||||
{
|
||||
@@ -151,6 +165,15 @@ TAG_HANDLER_BEGIN(SPAN, "SPAN" )
|
||||
new wxHtmlColourCell(oldclr));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user