mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-07-13 22:42:53 +03:00
Fix double background being rendered.
This commit is contained in:
@@ -377,7 +377,7 @@
|
||||
"working_dir": "${project_root}/bin"
|
||||
},
|
||||
{
|
||||
"args": "https://www.0xsid.com/blog/wont-download-your-app",
|
||||
"args": "-c system --hn-dark",
|
||||
"command": "${project_root}/bin/eepp-ui-html-debug",
|
||||
"name": "eepp-ui-html-debug",
|
||||
"working_dir": "${project_root}/bin"
|
||||
|
||||
@@ -45,6 +45,8 @@ class EE_API UITextSpan : public UIRichText {
|
||||
|
||||
virtual bool isInlineBlock() const;
|
||||
|
||||
virtual void onDisplayChange();
|
||||
|
||||
virtual void draw();
|
||||
|
||||
virtual bool applyProperty( const StyleSheetProperty& attribute );
|
||||
|
||||
@@ -432,8 +432,13 @@ bool UIRichText::applyProperty( const StyleSheetProperty& attribute ) {
|
||||
break;
|
||||
}
|
||||
case PropertyId::BackgroundColor:
|
||||
setBackgroundColor( attribute.asColor() );
|
||||
setFontBackgroundColor( attribute.asColor() );
|
||||
if ( isInline() ) {
|
||||
setBackgroundColor( Color::Transparent );
|
||||
setFontBackgroundColor( attribute.asColor() );
|
||||
} else {
|
||||
setFontBackgroundColor( Color::Transparent );
|
||||
setBackgroundColor( attribute.asColor() );
|
||||
}
|
||||
break;
|
||||
case PropertyId::TextShadowColor:
|
||||
setFontShadowColor( attribute.asColor() );
|
||||
|
||||
@@ -70,6 +70,24 @@ bool UITextSpan::isInlineBlock() const {
|
||||
return mDisplay == CSSDisplay::InlineBlock && getCSSFloat() == CSSFloat::None && !isOutOfFlow();
|
||||
}
|
||||
|
||||
void UITextSpan::onDisplayChange() {
|
||||
bool nowInline = isInline();
|
||||
if ( nowInline && getFontBackgroundColor() == Color::Transparent ) {
|
||||
const Color& widgetBg = getBackgroundColor();
|
||||
if ( widgetBg != Color::Transparent ) {
|
||||
setFontBackgroundColor( widgetBg );
|
||||
setBackgroundColor( Color::Transparent );
|
||||
}
|
||||
} else if ( !nowInline && getBackgroundColor() == Color::Transparent ) {
|
||||
const Color& fontBg = getFontBackgroundColor();
|
||||
if ( fontBg != Color::Transparent ) {
|
||||
setBackgroundColor( fontBg );
|
||||
setFontBackgroundColor( Color::Transparent );
|
||||
}
|
||||
}
|
||||
UIHTMLWidget::onDisplayChange();
|
||||
}
|
||||
|
||||
void UITextSpan::draw() {
|
||||
// When a UITextSpan is a flex item it is laid out independently by the
|
||||
// flex container (blockification per CSS Flexbox §4). In that case the
|
||||
@@ -100,7 +118,13 @@ bool UITextSpan::applyProperty( const StyleSheetProperty& attribute ) {
|
||||
break;
|
||||
}
|
||||
case PropertyId::BackgroundColor:
|
||||
setFontBackgroundColor( attribute.asColor() );
|
||||
if ( isInline() ) {
|
||||
setBackgroundColor( Color::Transparent );
|
||||
setFontBackgroundColor( attribute.asColor() );
|
||||
} else {
|
||||
setFontBackgroundColor( Color::Transparent );
|
||||
setBackgroundColor( attribute.asColor() );
|
||||
}
|
||||
break;
|
||||
case PropertyId::TextShadowColor:
|
||||
setFontShadowColor( attribute.asColor() );
|
||||
|
||||
Reference in New Issue
Block a user