mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-17 13:39:25 +00:00
LibWeb: Parse and compute text-underline-offset
property
This commit is contained in:
parent
f9305e7e67
commit
858450922b
Notes:
github-actions[bot]
2025-09-12 06:08:23 +00:00
Author: https://github.com/Calme1709
Commit: 858450922b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6166
Reviewed-by: https://github.com/tcl3 ✅
17 changed files with 771 additions and 4 deletions
|
@ -3153,6 +3153,8 @@ NonnullRefPtr<StyleValue const> StyleComputer::compute_value_of_property(Propert
|
|||
case PropertyID::StopOpacity:
|
||||
case PropertyID::StrokeOpacity:
|
||||
return compute_opacity(specified_value, computation_context);
|
||||
case PropertyID::TextUnderlineOffset:
|
||||
return compute_text_underline_offset(specified_value, computation_context);
|
||||
default:
|
||||
// FIXME: We should replace this with a VERIFY_NOT_REACHED() once all properties have their own handling.
|
||||
return specified_value;
|
||||
|
@ -3208,6 +3210,24 @@ NonnullRefPtr<StyleValue const> StyleComputer::compute_opacity(NonnullRefPtr<Sty
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
NonnullRefPtr<StyleValue const> StyleComputer::compute_text_underline_offset(NonnullRefPtr<StyleValue const> const& specified_value, PropertyValueComputationContext const& computation_context)
|
||||
{
|
||||
// https://drafts.csswg.org/css-text-decor-4/#underline-offset
|
||||
// as specified, with <length-percentage> values computed
|
||||
|
||||
// auto
|
||||
// <percentage>
|
||||
if (specified_value->to_keyword() == Keyword::Auto || specified_value->is_percentage())
|
||||
return specified_value;
|
||||
|
||||
// <length>
|
||||
// NOTE: We also support calc()'d <length-percentage>
|
||||
if (specified_value->is_calculated() || specified_value->is_length())
|
||||
return specified_value->absolutized(computation_context.length_resolution_context.viewport_rect, computation_context.length_resolution_context.font_metrics, computation_context.length_resolution_context.root_font_metrics);
|
||||
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void StyleComputer::compute_math_depth(ComputedProperties& style, Optional<DOM::AbstractElement> element) const
|
||||
{
|
||||
// https://w3c.github.io/mathml-core/#propdef-math-depth
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue