mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
LibHTML: Render a background-color behind line box fragments if needed
This commit is contained in:
parent
5a04472470
commit
9a6388f718
Notes:
sideshowbarker
2024-07-19 11:08:18 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/9a6388f7184
1 changed files with 4 additions and 0 deletions
|
@ -52,6 +52,10 @@ void LayoutText::render_fragment(RenderingContext& context, const LineBoxFragmen
|
|||
if (is_underline)
|
||||
painter.draw_line(enclosing_int_rect(fragment.rect()).bottom_left().translated(0, -1), enclosing_int_rect(fragment.rect()).bottom_right().translated(0, -1), color);
|
||||
|
||||
auto background_color = style().property(CSS::PropertyID::BackgroundColor);
|
||||
if (background_color.has_value() && background_color.value()->is_color())
|
||||
painter.fill_rect(enclosing_int_rect(fragment.rect()), background_color.value()->to_color(document()));
|
||||
|
||||
painter.draw_text(enclosing_int_rect(fragment.rect()), m_text_for_rendering.substring_view(fragment.start(), fragment.length()), TextAlignment::TopLeft, color);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue