mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-04 02:08:53 +00:00
LibHTML: Include padding when rendering background colors
This commit is contained in:
parent
86b7dd6d5d
commit
7573e3c46d
Notes:
sideshowbarker
2024-07-19 11:51:45 +09:00
Author: https://github.com/awesomekling
Commit: 7573e3c46d
1 changed files with 10 additions and 2 deletions
|
@ -44,8 +44,16 @@ void LayoutNode::render(RenderingContext& context)
|
|||
#endif
|
||||
|
||||
auto bgcolor = style_properties().property("background-color");
|
||||
if (bgcolor.has_value() && bgcolor.value()->is_color())
|
||||
context.painter().fill_rect(rect(), bgcolor.value()->to_color());
|
||||
if (bgcolor.has_value() && bgcolor.value()->is_color()) {
|
||||
|
||||
Rect background_rect;
|
||||
background_rect.set_x(rect().x() - style().padding().left.to_px());
|
||||
background_rect.set_width(rect().width() + style().padding().left.to_px() + style().padding().right.to_px());
|
||||
background_rect.set_y(rect().y() - style().padding().top.to_px());
|
||||
background_rect.set_height(rect().height() + style().padding().top.to_px() + style().padding().bottom.to_px());
|
||||
|
||||
context.painter().fill_rect(background_rect, bgcolor.value()->to_color());
|
||||
}
|
||||
|
||||
// TODO: render our border
|
||||
for_each_child([&](auto& child) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue