Do not set broken colors.

This commit is contained in:
Martín Lucas Golini
2026-05-13 01:52:57 -03:00
parent ae0150ae75
commit 1b263a531b
4 changed files with 19 additions and 4 deletions

View File

@@ -324,9 +324,16 @@ bool UIRichText::applyProperty( const StyleSheetProperty& attribute ) {
case PropertyId::FontWeight:
setFontStyle( attribute.asFontStyle() );
break;
case PropertyId::Color:
case PropertyId::Color: {
Color color = attribute.asColor();
if ( color == Color::Transparent &&
attribute.getValue().find( "var(" ) != std::string::npos ) {
// Do not set unresolved colors
break;
}
setFontColor( attribute.asColor() );
break;
}
case PropertyId::BackgroundColor:
setBackgroundColor( attribute.asColor() );
setFontBackgroundColor( attribute.asColor() );

View File

@@ -108,9 +108,16 @@ bool UITextSpan::applyProperty( const StyleSheetProperty& attribute ) {
case PropertyId::Text:
setText( getTranslatorString( attribute.value() ) );
break;
case PropertyId::Color:
setFontColor( attribute.asColor() );
case PropertyId::Color: {
Color color = attribute.asColor();
if ( color == Color::Transparent &&
attribute.getValue().find( "var(" ) != std::string::npos ) {
// Do not set unresolved colors
break;
}
setFontColor( color );
break;
}
case PropertyId::BackgroundColor:
setFontBackgroundColor( attribute.asColor() );
break;

View File

@@ -148,6 +148,7 @@ void UIWidgetCreator::createBaseWidgetList() {
registeredWidget["kbd"] = [] { return UITextSpan::NewWithTag( "kbd" ); };
registeredWidget["sub"] = [] { return UITextSpan::NewWithTag( "sub" ); };
registeredWidget["sup"] = [] { return UITextSpan::NewWithTag( "sup" ); };
registeredWidget["time"] = [] { return UITextSpan::NewWithTag( "time" ); };
registeredWidget["u"] = UITextSpan::NewUnderline;
registeredWidget["ins"] = UITextSpan::NewUnderline;
registeredWidget["s"] = UITextSpan::NewStrikethrough;

View File

@@ -790,7 +790,7 @@ static ALfloat calculate_distance_attenuation(const ALCcontext *ctx, const ALsou
// error in it. In this case, there is no attenuation for that source."
FIXME("check divisions by zero");
const ALenum distance_model = ctx->source_distance_model ? src->distance_model : ctx->distance_model;
// const ALenum distance_model = ctx->source_distance_model ? src->distance_model : ctx->distance_model;
switch (ctx->distance_model) {
case AL_INVERSE_DISTANCE_CLAMPED:
distance = SDL_min(SDL_max(distance, src->reference_distance), src->max_distance);