mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb: Add OpacityValueStyleValue
This allows us to avoid the ugly hack in `property_accepted_type_ranges()`. This also updates the `ValueType` to be `opacity-value` rather than `opacity` to match the spec.
This commit is contained in:
Notes:
github-actions[bot]
2026-04-22 13:26:11 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/8a7332b7b90 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8959 Reviewed-by: https://github.com/AtkinsSJ ✅
@@ -235,7 +235,7 @@ enum class PropertyID : @property_id_underlying_type@ {
|
||||
generator.set("first_inherited_property_id", title_casify(inherited_longhand_property_ids.first()));
|
||||
generator.set("last_inherited_property_id", title_casify(inherited_longhand_property_ids.last()));
|
||||
|
||||
// FIXME: property_accepts_{number,percentage}() has a different range from accepted_type_ranges() despite the names sounding similar.
|
||||
// FIXME: property_accepts_{number,percentage}() and property_accepted_type_ranges provide the same data, we should consolidate them.
|
||||
generator.append(R"~~~(
|
||||
};
|
||||
|
||||
@@ -999,13 +999,6 @@ AcceptedTypeRangeMap property_accepted_type_ranges(PropertyID property_id)
|
||||
for (auto& type : valid_types.values()) {
|
||||
VERIFY(type.is_string());
|
||||
|
||||
// Opacity values should have their calculated and interpolated values clamped to [0,1] which is
|
||||
// different from the range of allowed values [-∞,∞].
|
||||
if (type.as_string() == "opacity"sv) {
|
||||
ranges_builder.append("{ ValueType::Number, { 0, 1 } }, { ValueType::Percentage, { 0, 100 } }"sv);
|
||||
continue;
|
||||
}
|
||||
|
||||
Vector<String> type_parts = MUST(type.as_string().split(' '));
|
||||
|
||||
if (type_parts.size() < 2)
|
||||
|
||||
Reference in New Issue
Block a user