Fix wxMarkupParserAttr's unwinding of colors
Fix the logic for restoring previous span's colors to account for the possibility of spans that don't change the color, such as in "<i><span color='red'>...</span></i>foo". Previously, "foo" would always be rendered black, because unwinding the attributes stack would encounter an invalid color (which has r=g=b=0) and set it, disregarding and preexisting attributes. Because there's code in there that checks whether the attributes are valid, we need to keep track of both the actually specified attributes and the currently effective ones, and use the latter for restoration.
This commit is contained in:
committed by
Václav Slavík
parent
d9df970573
commit
7546989c44
@@ -156,11 +156,11 @@ public:
|
||||
|
||||
// ...but we only need to restore the colours if we had changed them.
|
||||
if ( attr.foreground.IsOk() )
|
||||
m_dc.SetTextForeground(GetAttr().foreground);
|
||||
m_dc.SetTextForeground(GetAttr().effectiveForeground);
|
||||
|
||||
if ( attr.background.IsOk() )
|
||||
{
|
||||
wxColour background = GetAttr().background;
|
||||
wxColour background = GetAttr().effectiveBackground;
|
||||
if ( !background.IsOk() )
|
||||
{
|
||||
// Invalid background colour indicates that the background
|
||||
|
Reference in New Issue
Block a user