mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibWeb/CSS: Maintain original form of media-feature ranges
Previously, for `foo < 30px` ranges, we'd flip them and store them as `30px > foo` instead. That worked fine, but means the serialization is wrong. So instead, keep them in their original form. I experimented with giving Range two optional sub-structs instead of 4 optional members, thinking it would be smaller - but it's actually larger, because the two Optional<Comparison>s fit snugly together. So, the slightly-goofy all-Optionals remains. This gets us 2 WPT passes that I'm aware of.
This commit is contained in:
parent
9b8dc6b8d0
commit
9fe8445946
Notes:
github-actions[bot]
2025-05-23 09:19:11 +00:00
Author: https://github.com/AtkinsSJ
Commit: 9fe8445946
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4817
5 changed files with 28 additions and 32 deletions
|
@ -132,7 +132,6 @@ public:
|
|||
return adopt_own(*new MediaFeature(Type::MaxValue, id, move(value)));
|
||||
}
|
||||
|
||||
// Corresponds to `<mf-range>` grammar, with a single comparison
|
||||
static NonnullOwnPtr<MediaFeature> half_range(MediaFeatureValue value, Comparison comparison, MediaFeatureID id)
|
||||
{
|
||||
return adopt_own(*new MediaFeature(Type::Range, id,
|
||||
|
@ -141,6 +140,14 @@ public:
|
|||
.left_comparison = comparison,
|
||||
}));
|
||||
}
|
||||
static NonnullOwnPtr<MediaFeature> half_range(MediaFeatureID id, Comparison comparison, MediaFeatureValue value)
|
||||
{
|
||||
return adopt_own(*new MediaFeature(Type::Range, id,
|
||||
Range {
|
||||
.right_comparison = comparison,
|
||||
.right_value = move(value),
|
||||
}));
|
||||
}
|
||||
|
||||
// Corresponds to `<mf-range>` grammar, with two comparisons
|
||||
static NonnullOwnPtr<MediaFeature> range(MediaFeatureValue left_value, Comparison left_comparison, MediaFeatureID id, Comparison right_comparison, MediaFeatureValue right_value)
|
||||
|
@ -168,8 +175,8 @@ private:
|
|||
};
|
||||
|
||||
struct Range {
|
||||
MediaFeatureValue left_value;
|
||||
Comparison left_comparison;
|
||||
Optional<MediaFeatureValue> left_value {};
|
||||
Optional<Comparison> left_comparison {};
|
||||
Optional<Comparison> right_comparison {};
|
||||
Optional<MediaFeatureValue> right_value {};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue