@@ -3110,6 +3110,70 @@ bool ComputedCSSStyle::SetTextDecorationColor(const tasm::CSSValue& value,
31103110 return old_value_color != text_attributes_->decoration_color ;
31113111}
31123112
3113+ bool ComputedCSSStyle::SetTextDecorationThickness (const tasm::CSSValue& value,
3114+ const bool reset) {
3115+ PrepareOptionalForTextAttributes ();
3116+ auto old_value = text_attributes_->text_decoration_thickness ;
3117+ if (reset) {
3118+ text_attributes_->text_decoration_thickness .reset ();
3119+ } else {
3120+ float thickness = 0 .f ;
3121+ CSS_HANDLER_FAIL_IF_NOT (
3122+ CalculateCSSValueToFloat (value, thickness, length_context_,
3123+ parser_configs_, true ) &&
3124+ thickness >= 0 .f ,
3125+ parser_configs_.enable_css_strict_mode , tasm::TYPE_ERROR ,
3126+ tasm::CSSProperty::GetPropertyName (
3127+ tasm::kPropertyIDTextDecorationThickness )
3128+ .c_str ())
3129+ text_attributes_->text_decoration_thickness = thickness;
3130+ }
3131+ return old_value != text_attributes_->text_decoration_thickness ;
3132+ }
3133+
3134+ bool ComputedCSSStyle::SetXTextDecorationWidth (const tasm::CSSValue& value,
3135+ const bool reset) {
3136+ PrepareOptionalForTextAttributes ();
3137+ auto old_value = text_attributes_->text_decoration_width ;
3138+ if (reset) {
3139+ text_attributes_->text_decoration_width .reset ();
3140+ } else {
3141+ float width = 0 .f ;
3142+ CSS_HANDLER_FAIL_IF_NOT (
3143+ CalculateCSSValueToFloat (value, width, length_context_, parser_configs_,
3144+ true ) &&
3145+ width >= 0 .f ,
3146+ parser_configs_.enable_css_strict_mode , tasm::TYPE_ERROR ,
3147+ tasm::CSSProperty::GetPropertyName (
3148+ tasm::kPropertyIDXTextDecorationWidth )
3149+ .c_str ())
3150+
3151+ text_attributes_->text_decoration_width = width;
3152+ }
3153+ return old_value != text_attributes_->text_decoration_width ;
3154+ }
3155+
3156+ bool ComputedCSSStyle::SetXTextDecorationGap (const tasm::CSSValue& value,
3157+ const bool reset) {
3158+ PrepareOptionalForTextAttributes ();
3159+ auto old_value = text_attributes_->text_decoration_gap ;
3160+ if (reset) {
3161+ text_attributes_->text_decoration_gap .reset ();
3162+ } else {
3163+ float gap = 0 .f ;
3164+ CSS_HANDLER_FAIL_IF_NOT (
3165+ CalculateCSSValueToFloat (value, gap, length_context_, parser_configs_,
3166+ true ) &&
3167+ gap >= 0 .f ,
3168+ parser_configs_.enable_css_strict_mode , tasm::TYPE_ERROR ,
3169+ tasm::CSSProperty::GetPropertyName (tasm::kPropertyIDXTextDecorationGap )
3170+ .c_str ())
3171+
3172+ text_attributes_->text_decoration_gap = gap;
3173+ }
3174+ return old_value != text_attributes_->text_decoration_gap ;
3175+ }
3176+
31133177bool ComputedCSSStyle::SetZIndex (const tasm::CSSValue& value,
31143178 const bool reset) {
31153179 // If not enable z-index, return false default.
@@ -4348,6 +4412,28 @@ lepus_value ComputedCSSStyle::TextDecorationToLepus() {
43484412 }
43494413}
43504414
4415+ lepus_value ComputedCSSStyle::TextDecorationThicknessToLepus () {
4416+ if (text_attributes_ &&
4417+ text_attributes_->text_decoration_thickness .has_value ()) {
4418+ return lepus_value (*text_attributes_->text_decoration_thickness );
4419+ }
4420+ return lepus_value ();
4421+ }
4422+
4423+ lepus_value ComputedCSSStyle::XTextDecorationWidthToLepus () {
4424+ if (text_attributes_ && text_attributes_->text_decoration_width .has_value ()) {
4425+ return lepus_value (*text_attributes_->text_decoration_width );
4426+ }
4427+ return lepus_value ();
4428+ }
4429+
4430+ lepus_value ComputedCSSStyle::XTextDecorationGapToLepus () {
4431+ if (text_attributes_ && text_attributes_->text_decoration_gap .has_value ()) {
4432+ return lepus_value (*text_attributes_->text_decoration_gap );
4433+ }
4434+ return lepus_value ();
4435+ }
4436+
43514437lepus_value ComputedCSSStyle::TextDecorationColorToLepus () {
43524438 if (text_attributes_) {
43534439 return lepus_value (text_attributes_->decoration_color .has_value ()
@@ -4948,6 +5034,27 @@ void ComputedCSSStyle::InheritNormalPropertiesFrom(
49485034 from.text_attributes_ ->text_decoration_color );
49495035 }
49505036 break ;
5037+ case tasm::kPropertyIDTextDecorationThickness :
5038+ if (from.text_attributes_ .has_value ()) {
5039+ auto * attrs = ensure_text_attrs (from.text_attributes_ ->font_size );
5040+ copy_flex_optional (attrs->text_decoration_thickness ,
5041+ from.text_attributes_ ->text_decoration_thickness );
5042+ }
5043+ break ;
5044+ case tasm::kPropertyIDXTextDecorationWidth :
5045+ if (from.text_attributes_ .has_value ()) {
5046+ auto * attrs = ensure_text_attrs (from.text_attributes_ ->font_size );
5047+ copy_flex_optional (attrs->text_decoration_width ,
5048+ from.text_attributes_ ->text_decoration_width );
5049+ }
5050+ break ;
5051+ case tasm::kPropertyIDXTextDecorationGap :
5052+ if (from.text_attributes_ .has_value ()) {
5053+ auto * attrs = ensure_text_attrs (from.text_attributes_ ->font_size );
5054+ copy_flex_optional (attrs->text_decoration_gap ,
5055+ from.text_attributes_ ->text_decoration_gap );
5056+ }
5057+ break ;
49515058 case tasm::kPropertyIDTextShadow :
49525059 if (from.text_attributes_ .has_value ()) {
49535060 auto * attrs = ensure_text_attrs (from.text_attributes_ ->font_size );
@@ -5312,6 +5419,15 @@ bool ComputedCSSStyle::HasNonDefaultInheritedResolvedValue(
53125419 return text_attributes_.has_value () &&
53135420 text_attributes_->decoration_color .value_or (
53145421 DefaultColor::DEFAULT_COLOR ) != DefaultColor::DEFAULT_COLOR ;
5422+ case tasm::kPropertyIDTextDecorationThickness :
5423+ return text_attributes_.has_value () &&
5424+ text_attributes_->text_decoration_thickness .has_value ();
5425+ case tasm::kPropertyIDXTextDecorationWidth :
5426+ return text_attributes_.has_value () &&
5427+ text_attributes_->text_decoration_width .has_value ();
5428+ case tasm::kPropertyIDXTextDecorationGap :
5429+ return text_attributes_.has_value () &&
5430+ text_attributes_->text_decoration_gap .has_value ();
53155431 case tasm::kPropertyIDCaretColor :
53165432 return !caret_color_.empty ();
53175433 case tasm::kPropertyIDTextIndent :
0 commit comments