diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 99cc94033bf..66606530fc9 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -2610,6 +2610,9 @@ fn static_assert() { if v.contains(longhands::text_decoration_line::BLINK) { bits |= structs::NS_STYLE_TEXT_DECORATION_LINE_BLINK as u8; } + if v.contains(longhands::text_decoration_line::COLOR_OVERRIDE) { + bits |= structs::NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL as u8; + } self.gecko.mTextDecorationLine = bits; } diff --git a/components/style/properties/longhand/text.mako.rs b/components/style/properties/longhand/text.mako.rs index abc5bc05f27..cfd4b26fa3c 100644 --- a/components/style/properties/longhand/text.mako.rs +++ b/components/style/properties/longhand/text.mako.rs @@ -122,6 +122,16 @@ ${helpers.single_keyword("unicode-bidi", const UNDERLINE = 0x02, const LINE_THROUGH = 0x04, const BLINK = 0x08, + % if product == "gecko": + /// Only set by presentation attributes + /// + /// Setting this will mean that text-decorations use the color + /// specified by `color` in quirks mode. + /// + /// For example, this gives text + /// a red text decoration + const COLOR_OVERRIDE = 0x10, + % endif } } diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index c2d0a742ef5..1b71829b54a 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -1062,8 +1062,8 @@ pub extern "C" fn Servo_DeclarationBlock_SetPixelValue(declarations: value: f32) { use style::properties::{DeclaredValue, PropertyDeclaration, LonghandId}; use style::properties::longhands::border_spacing::SpecifiedValue as BorderSpacing; - use style::values::specified::length::NoCalcLength; use style::values::specified::BorderWidth; + use style::values::specified::length::NoCalcLength; let declarations = RwLock::::as_arc(&declarations); let long = get_longhand_from_id!(property); @@ -1206,9 +1206,16 @@ pub extern "C" fn Servo_DeclarationBlock_SetFontFamily(declarations: } #[no_mangle] -pub extern "C" fn Servo_DeclarationBlock_SetTextDecorationColorOverride(_: - RawServoDeclarationBlockBorrowed) { - error!("stylo: Don't know how to handle quirks-mode text-decoration color overrides"); +pub extern "C" fn Servo_DeclarationBlock_SetTextDecorationColorOverride(declarations: + RawServoDeclarationBlockBorrowed) { + use style::properties::{DeclaredValue, PropertyDeclaration}; + use style::properties::longhands::text_decoration_line; + + let declarations = RwLock::::as_arc(&declarations); + let mut decoration = text_decoration_line::computed_value::none; + decoration |= text_decoration_line::COLOR_OVERRIDE; + let decl = PropertyDeclaration::TextDecorationLine(DeclaredValue::Value(decoration)); + declarations.write().declarations.push((decl, Default::default())); } #[no_mangle]