1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:48:12 +00:00

LibHTML: Use an enum for CSS property ID's

Instead of using string everywhere, have the CSS parser produce enum
values, since they are a lot nicer to work with.

In the future we should generate most of this code based on a list of
supported CSS properties.
This commit is contained in:
Andreas Kling 2019-10-08 15:34:19 +02:00
parent 19dbfc3153
commit 31ac19543a
18 changed files with 207 additions and 94 deletions

View file

@ -40,7 +40,7 @@ void LayoutImage::render(RenderingContext& context)
auto alt = node().alt();
if (alt.is_empty())
alt = node().src();
context.painter().draw_text(rect(), alt, TextAlignment::Center, style().color_or_fallback("color", document(), Color::Black), TextElision::Right);
context.painter().draw_text(rect(), alt, TextAlignment::Center, style().color_or_fallback(CSS::PropertyID::Color, document(), Color::Black), TextElision::Right);
} else {
context.painter().draw_scaled_bitmap(rect(), *node().bitmap(), node().bitmap()->rect());
}