mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:17:35 +00:00
LibWeb/Layout: Rename Box::{paint => paintable}_box()
It returns a PaintableBox, not a 'PaintBox'.
This commit is contained in:
parent
ec37b55777
commit
754e458d0a
20 changed files with 50 additions and 50 deletions
|
@ -38,7 +38,7 @@ void InlinePaintable::paint(PaintContext& context, Painting::PaintPhase phase) c
|
|||
auto top_right_border_radius = computed_values().border_top_right_radius();
|
||||
auto bottom_right_border_radius = computed_values().border_bottom_right_radius();
|
||||
auto bottom_left_border_radius = computed_values().border_bottom_left_radius();
|
||||
auto containing_block_position_in_absolute_coordinates = containing_block()->paint_box()->absolute_position();
|
||||
auto containing_block_position_in_absolute_coordinates = containing_block()->paintable_box()->absolute_position();
|
||||
|
||||
for_each_fragment([&](auto const& fragment, bool is_first_fragment, bool is_last_fragment) {
|
||||
CSSPixelRect absolute_fragment_rect { containing_block_position_in_absolute_coordinates.translated(fragment.offset()), fragment.size() };
|
||||
|
@ -89,7 +89,7 @@ void InlinePaintable::paint(PaintContext& context, Painting::PaintPhase phase) c
|
|||
.left = computed_values().border_left(),
|
||||
};
|
||||
|
||||
auto containing_block_position_in_absolute_coordinates = containing_block()->paint_box()->absolute_position();
|
||||
auto containing_block_position_in_absolute_coordinates = containing_block()->paintable_box()->absolute_position();
|
||||
|
||||
for_each_fragment([&](auto const& fragment, bool is_first_fragment, bool is_last_fragment) {
|
||||
CSSPixelRect absolute_fragment_rect { containing_block_position_in_absolute_coordinates.translated(fragment.offset()), fragment.size() };
|
||||
|
@ -132,7 +132,7 @@ void InlinePaintable::for_each_fragment(Callback callback) const
|
|||
{
|
||||
// FIXME: This will be slow if the containing block has a lot of fragments!
|
||||
Vector<Layout::LineBoxFragment const&> fragments;
|
||||
verify_cast<PaintableWithLines>(*containing_block()->paint_box()).for_each_fragment([&](auto& fragment) {
|
||||
verify_cast<PaintableWithLines>(*containing_block()->paintable_box()).for_each_fragment([&](auto& fragment) {
|
||||
if (layout_node().is_inclusive_ancestor_of(fragment.layout_node()))
|
||||
fragments.append(fragment);
|
||||
return IterationDecision::Continue;
|
||||
|
|
|
@ -76,7 +76,7 @@ CSSPixelPoint PaintableBox::effective_offset() const
|
|||
{
|
||||
CSSPixelPoint offset;
|
||||
if (containing_block() && m_containing_line_box_fragment.has_value()) {
|
||||
auto& paintable_with_lines = *verify_cast<PaintableWithLines>(containing_block()->paint_box());
|
||||
auto& paintable_with_lines = *verify_cast<PaintableWithLines>(containing_block()->paintable_box());
|
||||
auto const& fragment = paintable_with_lines.line_boxes()[m_containing_line_box_fragment->line_box_index].fragments()[m_containing_line_box_fragment->fragment_index];
|
||||
offset = fragment.offset();
|
||||
} else {
|
||||
|
@ -93,7 +93,7 @@ CSSPixelRect PaintableBox::compute_absolute_rect() const
|
|||
{
|
||||
CSSPixelRect rect { effective_offset(), content_size() };
|
||||
for (auto const* block = containing_block(); block && block->paintable(); block = block->paintable()->containing_block())
|
||||
rect.translate_by(block->paint_box()->effective_offset());
|
||||
rect.translate_by(block->paintable_box()->effective_offset());
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
@ -137,8 +137,8 @@ Painting::StackingContext* PaintableBox::enclosing_stacking_context()
|
|||
if (!is<Layout::Box>(ancestor))
|
||||
continue;
|
||||
auto& ancestor_box = static_cast<Layout::Box&>(const_cast<Layout::NodeWithStyle&>(*ancestor));
|
||||
if (auto* ancestor_paint_box = ancestor_box.paint_box(); ancestor_paint_box && ancestor_paint_box->stacking_context())
|
||||
return const_cast<StackingContext*>(ancestor_paint_box->stacking_context());
|
||||
if (auto* ancestor_paintable_box = ancestor_box.paintable_box(); ancestor_paintable_box && ancestor_paintable_box->stacking_context())
|
||||
return const_cast<StackingContext*>(ancestor_paintable_box->stacking_context());
|
||||
}
|
||||
// We should always reach the Layout::Viewport stacking context.
|
||||
VERIFY_NOT_REACHED();
|
||||
|
@ -321,8 +321,8 @@ Optional<CSSPixelRect> PaintableBox::calculate_overflow_clipped_rect() const
|
|||
// transforms doesn't make sense
|
||||
// TODO: figure out if there are cases when stacking context should be
|
||||
// crossed to calculate correct clip rect
|
||||
if (!stacking_context() && containing_block() && containing_block()->paint_box()) {
|
||||
m_clip_rect = containing_block()->paint_box()->calculate_overflow_clipped_rect();
|
||||
if (!stacking_context() && containing_block() && containing_block()->paintable_box()) {
|
||||
m_clip_rect = containing_block()->paintable_box()->calculate_overflow_clipped_rect();
|
||||
}
|
||||
|
||||
auto overflow_x = computed_values().overflow_x();
|
||||
|
@ -702,7 +702,7 @@ Optional<HitTestResult> PaintableWithLines::hit_test(CSSPixelPoint position, Hit
|
|||
Optional<HitTestResult> last_good_candidate;
|
||||
for (auto& line_box : m_line_boxes) {
|
||||
for (auto& fragment : line_box.fragments()) {
|
||||
if (is<Layout::Box>(fragment.layout_node()) && static_cast<Layout::Box const&>(fragment.layout_node()).paint_box()->stacking_context())
|
||||
if (is<Layout::Box>(fragment.layout_node()) && static_cast<Layout::Box const&>(fragment.layout_node()).paintable_box()->stacking_context())
|
||||
continue;
|
||||
if (!fragment.layout_node().containing_block()) {
|
||||
dbgln("FIXME: PaintableWithLines::hit_test(): Missing containing block on {}", fragment.layout_node().debug_description());
|
||||
|
|
|
@ -41,7 +41,7 @@ CSSPixelRect SVGPaintable::compute_absolute_rect() const
|
|||
if (auto* svg_svg_box = layout_box().first_ancestor_of_type<Layout::SVGSVGBox>()) {
|
||||
CSSPixelRect rect { effective_offset(), content_size() };
|
||||
for (Layout::Box const* ancestor = svg_svg_box; ancestor && ancestor->paintable(); ancestor = ancestor->paintable()->containing_block())
|
||||
rect.translate_by(ancestor->paint_box()->effective_offset());
|
||||
rect.translate_by(ancestor->paintable_box()->effective_offset());
|
||||
return rect;
|
||||
}
|
||||
return PaintableBox::compute_absolute_rect();
|
||||
|
|
|
@ -79,7 +79,7 @@ void StackingContext::paint_descendants(PaintContext& context, Layout::Node cons
|
|||
|
||||
box.for_each_child([&](auto& child) {
|
||||
// If `child` establishes its own stacking context, skip over it.
|
||||
if (is<Layout::Box>(child) && child.paintable() && static_cast<Layout::Box const&>(child).paint_box()->stacking_context())
|
||||
if (is<Layout::Box>(child) && child.paintable() && static_cast<Layout::Box const&>(child).paintable_box()->stacking_context())
|
||||
return;
|
||||
// If `child` is positioned with a z-index of `0` or `auto`, skip over it.
|
||||
if (child.is_positioned()) {
|
||||
|
@ -176,7 +176,7 @@ void StackingContext::paint_internal(PaintContext& context) const
|
|||
// Draw positioned descendants with z-index `0` or `auto` in tree order. (step 8)
|
||||
// NOTE: Non-positioned descendants that establish stacking contexts with z-index `0` or `auto` are also painted here.
|
||||
// FIXME: There's more to this step that we have yet to understand and implement.
|
||||
m_box->paint_box()->for_each_in_subtree_of_type<PaintableBox>([&](PaintableBox const& paint_box) {
|
||||
m_box->paintable_box()->for_each_in_subtree_of_type<PaintableBox>([&](PaintableBox const& paint_box) {
|
||||
auto const& z_index = paint_box.computed_values().z_index();
|
||||
if (auto* child = paint_box.stacking_context()) {
|
||||
if (!z_index.has_value() || z_index.value() == 0)
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
StackingContext* parent() { return m_parent; }
|
||||
StackingContext const* parent() const { return m_parent; }
|
||||
|
||||
PaintableBox const& paintable_box() const { return *m_box->paint_box(); }
|
||||
PaintableBox const& paintable_box() const { return *m_box->paintable_box(); }
|
||||
|
||||
enum class StackingContextPaintPhase {
|
||||
BackgroundAndBorders,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue