mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 10:37:17 +02:00
LibWeb: Parse text-underline-position property
This introduces the `TextUnderlinePositionStyleValue` class, it is possible to represent `text-underline-position` as a `StyleValueList` but would have required ugly workarounds for either serialization or in `ComputedProperties::text_underline_position`
This commit is contained in:
committed by
Tim Ledbetter
parent
a6812e1005
commit
b0e3af7d10
Notes:
github-actions[bot]
2025-09-15 14:25:30 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/b0e3af7d10e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6190 Reviewed-by: https://github.com/AtkinsSJ ✅
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2025, Callum Law <callumlaw1709@outlook.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/CSS/StyleValues/TextUnderlinePositionStyleValue.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
String TextUnderlinePositionStyleValue::to_string(SerializationMode) const
|
||||
{
|
||||
if (m_horizontal == TextUnderlinePositionHorizontal::Auto && m_vertical == TextUnderlinePositionVertical::Auto)
|
||||
return "auto"_string;
|
||||
|
||||
if (m_vertical == TextUnderlinePositionVertical::Auto)
|
||||
return MUST(String::from_utf8(CSS::to_string(m_horizontal)));
|
||||
|
||||
if (m_horizontal == TextUnderlinePositionHorizontal::Auto)
|
||||
return MUST(String::from_utf8(CSS::to_string(m_vertical)));
|
||||
|
||||
return MUST(String::formatted("{} {}", CSS::to_string(m_horizontal), CSS::to_string(m_vertical)));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user