mirror of
https://github.com/RGBCube/serenity
synced 2025-05-23 18:55:08 +00:00
LibHTML: Respect the CSS "color" property for text
Also remove the color values from the ComputedStyle object and get them via StyleProperties instead. At the moment, we only handle colors that Color::from_string() parses.
This commit is contained in:
parent
b8cab2a934
commit
62cbaa74f3
7 changed files with 56 additions and 10 deletions
|
@ -227,6 +227,8 @@ void LayoutText::render(RenderingContext& context)
|
|||
auto& painter = context.painter();
|
||||
painter.set_font(*m_font);
|
||||
|
||||
auto color = style_properties().color_or_fallback("color", Color::Black);
|
||||
|
||||
for (auto& run : m_runs) {
|
||||
Rect rect {
|
||||
run.pos.x(),
|
||||
|
@ -234,6 +236,6 @@ void LayoutText::render(RenderingContext& context)
|
|||
m_font->width(run.text),
|
||||
m_font->glyph_height()
|
||||
};
|
||||
painter.draw_text(rect, run.text);
|
||||
painter.draw_text(rect, run.text, TextAlignment::TopLeft, color);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue