mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-05 07:39:16 +00:00
LibWeb/CSS: Replace CSSUnitValue with DimensionStyleValue
CSSUnitValue is a typed-om type which we will implement separately in the future. However, it still seems useful to give our dimension values a base class. (Maybe they could be templated in the future?) So instead of deleting it entirely, rename it to DimensionStyleValue and make its API match our style better.
This commit is contained in:
parent
7157d19f56
commit
99bce9a94d
Notes:
github-actions[bot]
2025-08-08 14:20:30 +00:00
Author: https://github.com/AtkinsSJ
Commit: 99bce9a94d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5775
Reviewed-by: https://github.com/tcl3 ✅
17 changed files with 65 additions and 52 deletions
|
@ -133,13 +133,13 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue const>> Parser::parse_descriptor_v
|
|||
|
||||
// <length [0,∞]>{1,2}
|
||||
if (auto first_length = parse_length_value(tokens)) {
|
||||
if (first_length->is_length() && first_length->as_length().length().raw_value() < 0)
|
||||
if (first_length->is_length() && first_length->as_length().raw_value() < 0)
|
||||
return nullptr;
|
||||
|
||||
tokens.discard_whitespace();
|
||||
|
||||
if (auto second_length = parse_length_value(tokens)) {
|
||||
if (second_length->is_length() && second_length->as_length().length().raw_value() < 0)
|
||||
if (second_length->is_length() && second_length->as_length().raw_value() < 0)
|
||||
return nullptr;
|
||||
|
||||
return StyleValueList::create(StyleValueVector { first_length.release_nonnull(), second_length.release_nonnull() }, StyleValueList::Separator::Space);
|
||||
|
@ -186,7 +186,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue const>> Parser::parse_descriptor_v
|
|||
case DescriptorMetadata::ValueType::PositivePercentage: {
|
||||
if (auto percentage_value = parse_percentage_value(tokens)) {
|
||||
if (percentage_value->is_percentage()) {
|
||||
if (percentage_value->as_percentage().value() < 0)
|
||||
if (percentage_value->as_percentage().raw_value() < 0)
|
||||
return nullptr;
|
||||
return percentage_value.release_nonnull();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue