LibWeb: Distinguish between integer and float in NumericStyleValue

We have this information when parsing, and some properties specifically
only allow integers, so it makes sense to keep that around.
This commit is contained in:
Sam Atkins 2021-10-19 16:43:56 +01:00 committed by Andreas Kling
commit 78e57096e2
Notes: sideshowbarker 2024-07-18 02:09:44 +09:00
7 changed files with 55 additions and 30 deletions

View file

@ -301,22 +301,22 @@ RefPtr<CSS::StyleValue> Window::query_media_feature(FlyString const& name) const
return CSS::IdentifierStyleValue::create(CSS::ValueID::Fine);
// FIXME: aspect-ratio
if (name.equals_ignoring_case("color"sv))
return CSS::NumericStyleValue::create(32);
return CSS::NumericStyleValue::create_integer(32);
if (name.equals_ignoring_case("color-gamut"sv))
return CSS::IdentifierStyleValue::create(CSS::ValueID::Srgb);
if (name.equals_ignoring_case("color-index"sv))
return CSS::NumericStyleValue::create(0);
return CSS::NumericStyleValue::create_integer(0);
// FIXME: device-aspect-ratio
// FIXME: device-height
// FIXME: device-width
if (name.equals_ignoring_case("grid"sv))
return CSS::NumericStyleValue::create(0);
return CSS::NumericStyleValue::create_integer(0);
if (name.equals_ignoring_case("height"sv))
return CSS::LengthStyleValue::create(CSS::Length::make_px(inner_height()));
if (name.equals_ignoring_case("hover"sv))
return CSS::IdentifierStyleValue::create(CSS::ValueID::Hover);
if (name.equals_ignoring_case("monochrome"sv))
return CSS::NumericStyleValue::create(0);
return CSS::NumericStyleValue::create_integer(0);
if (name.equals_ignoring_case("hover"sv))
return CSS::IdentifierStyleValue::create(inner_height() >= inner_width() ? CSS::ValueID::Portrait : CSS::ValueID::Landscape);
if (name.equals_ignoring_case("overflow-block"sv))