diff options
author | Andreas Kling <kling@serenityos.org> | 2022-02-11 21:57:56 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-11 21:57:56 +0100 |
commit | 63345c4dfc50f3fbb393aca1f20da83a83a7a4e5 (patch) | |
tree | e5900ff65ffe6933ee9c8c8bf1b167efa9b5b129 /Userland/Libraries/LibWeb | |
parent | 9a92236a2451bbfdb54004740e58f8ff4ed5e1b2 (diff) | |
download | serenity-63345c4dfc50f3fbb393aca1f20da83a83a7a4e5.zip |
LibWeb: Rename Layout::Box absolute rect helpers
- padded_rect() -> absolute_padding_box_rect()
- bordered_rect() -> absolute_border_box_rect()
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/BlockContainer.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/Box.cpp | 14 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/Box.h | 6 |
4 files changed, 12 insertions, 12 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp b/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp index 079befc78c..6cd636fa5a 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp @@ -46,7 +46,7 @@ void BlockContainer::paint(PaintContext& context, PaintPhase phase) if (should_clip_overflow()) { context.painter().save(); // FIXME: Handle overflow-x and overflow-y being different values. - context.painter().add_clip_rect(enclosing_int_rect(padded_rect())); + context.painter().add_clip_rect(enclosing_int_rect(absolute_padding_box_rect())); context.painter().translate(-m_scroll_offset.to_type<int>()); } diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index dd6394b066..fb7f8c4275 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -544,7 +544,7 @@ void BlockFormattingContext::layout_initial_containing_block(LayoutMode layout_m float bottom_edge = 0; float right_edge = 0; icb.for_each_in_subtree_of_type<Box>([&](Box& child) { - auto child_rect = child.bordered_rect(); + auto child_rect = child.absolute_border_box_rect(); bottom_edge = max(bottom_edge, child_rect.bottom()); right_edge = max(right_edge, child_rect.right()); return IterationDecision::Continue; diff --git a/Userland/Libraries/LibWeb/Layout/Box.cpp b/Userland/Libraries/LibWeb/Layout/Box.cpp index 6786d62d75..21e8b2a86b 100644 --- a/Userland/Libraries/LibWeb/Layout/Box.cpp +++ b/Userland/Libraries/LibWeb/Layout/Box.cpp @@ -44,7 +44,7 @@ void Box::paint(PaintContext& context, PaintPhase phase) 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); + context.painter().draw_rect(enclosing_int_rect(absolute_padding_box_rect()), Color::Cyan); context.painter().draw_rect(enclosing_int_rect(content_rect), Color::Magenta); } @@ -61,7 +61,7 @@ void Box::paint_border(PaintContext& context) .bottom = computed_values().border_bottom(), .left = computed_values().border_left(), }; - Painting::paint_all_borders(context, bordered_rect(), normalized_border_radius_data(), borders_data); + Painting::paint_all_borders(context, absolute_border_box_rect(), normalized_border_radius_data(), borders_data); } void Box::paint_background(PaintContext& context) @@ -85,13 +85,13 @@ void Box::paint_background(PaintContext& context) background_color = document().background_color(context.palette()); } } else { - background_rect = enclosing_int_rect(padded_rect()); + background_rect = enclosing_int_rect(absolute_padding_box_rect()); } // HACK: If the Box has a border, use the bordered_rect to paint the background. // This way if we have a border-radius there will be no gap between the filling and actual border. if (computed_values().border_top().width || computed_values().border_right().width || computed_values().border_bottom().width || computed_values().border_left().width) - background_rect = enclosing_int_rect(bordered_rect()); + background_rect = enclosing_int_rect(absolute_border_box_rect()); Painting::paint_background(context, *this, background_rect, background_color, background_layers, normalized_border_radius_data()); } @@ -113,12 +113,12 @@ void Box::paint_box_shadow(PaintContext& context) static_cast<int>(layer.spread_distance.resolved_or_zero(*this).to_px(*this)), layer.placement == CSS::BoxShadowPlacement::Outer ? Painting::BoxShadowPlacement::Outer : Painting::BoxShadowPlacement::Inner); } - Painting::paint_box_shadow(context, enclosing_int_rect(bordered_rect()), resolved_box_shadow_data); + Painting::paint_box_shadow(context, enclosing_int_rect(absolute_border_box_rect()), resolved_box_shadow_data); } Painting::BorderRadiusData Box::normalized_border_radius_data() { - return Painting::normalized_border_radius_data(*this, bordered_rect(), + return Painting::normalized_border_radius_data(*this, absolute_border_box_rect(), computed_values().border_top_left_radius(), computed_values().border_top_right_radius(), computed_values().border_bottom_right_radius(), @@ -235,7 +235,7 @@ void Box::before_children_paint(PaintContext& context, PaintPhase phase) // FIXME: Support more overflow variations. if (computed_values().overflow_x() == CSS::Overflow::Hidden && computed_values().overflow_y() == CSS::Overflow::Hidden) { context.painter().save(); - context.painter().add_clip_rect(enclosing_int_rect(bordered_rect())); + context.painter().add_clip_rect(enclosing_int_rect(absolute_border_box_rect())); } } diff --git a/Userland/Libraries/LibWeb/Layout/Box.h b/Userland/Libraries/LibWeb/Layout/Box.h index c2928e4a59..8db420581c 100644 --- a/Userland/Libraries/LibWeb/Layout/Box.h +++ b/Userland/Libraries/LibWeb/Layout/Box.h @@ -37,7 +37,7 @@ public: float content_width() const { return m_content_size.width(); } float content_height() const { return m_content_size.height(); } - Gfx::FloatRect padded_rect() const + Gfx::FloatRect absolute_padding_box_rect() const { auto absolute_rect = this->absolute_rect(); Gfx::FloatRect rect; @@ -48,9 +48,9 @@ public: return rect; } - Gfx::FloatRect bordered_rect() const + Gfx::FloatRect absolute_border_box_rect() const { - auto padded_rect = this->padded_rect(); + auto padded_rect = this->absolute_padding_box_rect(); Gfx::FloatRect rect; rect.set_x(padded_rect.x() - box_model().border.left); rect.set_width(padded_rect.width() + box_model().border.left + box_model().border.right); |