1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:17:36 +00:00

LibWeb: Rename Layout::Box::size() to content_size()

This property represents the CSS content size, so let's reduce ambiguity
by using the spec terminology.

We also bring a bunch of related functions along for the ride.
This commit is contained in:
Andreas Kling 2022-02-06 00:49:09 +01:00
parent dbe5af3c6f
commit 0608de8c12
17 changed files with 140 additions and 140 deletions

View file

@ -39,9 +39,9 @@ void Box::paint(PaintContext& context, PaintPhase phase)
auto margin_box = box_model().margin_box();
Gfx::FloatRect margin_rect;
margin_rect.set_x(absolute_x() - margin_box.left);
margin_rect.set_width(width() + margin_box.left + margin_box.right);
margin_rect.set_width(content_width() + margin_box.left + margin_box.right);
margin_rect.set_y(absolute_y() - margin_box.top);
margin_rect.set_height(height() + margin_box.top + margin_box.bottom);
margin_rect.set_height(content_height() + margin_box.top + margin_box.bottom);
context.painter().draw_rect(enclosing_int_rect(margin_rect), Color::Yellow);
context.painter().draw_rect(enclosing_int_rect(padded_rect()), Color::Cyan);
@ -180,11 +180,11 @@ void Box::set_offset(const Gfx::FloatPoint& offset)
did_set_rect();
}
void Box::set_size(const Gfx::FloatSize& size)
void Box::set_content_size(Gfx::FloatSize const& size)
{
if (m_size == size)
if (m_content_size == size)
return;
m_size = size;
m_content_size = size;
did_set_rect();
}
@ -197,7 +197,7 @@ Gfx::FloatPoint Box::effective_offset() const
const Gfx::FloatRect Box::absolute_rect() const
{
Gfx::FloatRect rect { effective_offset(), size() };
Gfx::FloatRect rect { effective_offset(), content_size() };
for (auto* block = containing_block(); block; block = block->containing_block()) {
rect.translate_by(block->effective_offset());
}