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

LibHTML: Add some convenient geometry getters on LayoutNode

Add x(), y(), size() and position() and use them around the codebase.
This commit is contained in:
Andreas Kling 2019-10-13 17:31:58 +02:00
parent aefc7f9b22
commit 3309bdf722
7 changed files with 26 additions and 22 deletions

View file

@ -51,10 +51,10 @@ void LayoutNode::render(RenderingContext& context)
#endif
Rect padded_rect;
padded_rect.set_x(rect().x() - box_model().padding().left.to_px());
padded_rect.set_width(rect().width() + box_model().padding().left.to_px() + box_model().padding().right.to_px());
padded_rect.set_y(rect().y() - box_model().padding().top.to_px());
padded_rect.set_height(rect().height() + box_model().padding().top.to_px() + box_model().padding().bottom.to_px());
padded_rect.set_x(x() - box_model().padding().left.to_px());
padded_rect.set_width(width() + box_model().padding().left.to_px() + box_model().padding().right.to_px());
padded_rect.set_y(y() - box_model().padding().top.to_px());
padded_rect.set_height(height() + box_model().padding().top.to_px() + box_model().padding().bottom.to_px());
auto bgcolor = style().property(CSS::PropertyID::BackgroundColor);
if (bgcolor.has_value() && bgcolor.value()->is_color()) {