mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 02:37:35 +00:00
LibWeb: Remove Layout::Box::width_of_logical_containing_block()
This was a hack to percentages within tables relative to the nearest table-row ancestor instead of the nearest table container. That didn't actually make sense, so this patch simply removes the hack in favor of containing_block()->width().
This commit is contained in:
parent
4333d0d639
commit
ca154723f7
6 changed files with 4 additions and 23 deletions
|
@ -120,7 +120,7 @@ void BlockFormattingContext::compute_width(Box& box)
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& computed_values = box.computed_values();
|
auto& computed_values = box.computed_values();
|
||||||
float width_of_containing_block = box.width_of_logical_containing_block();
|
float width_of_containing_block = box.containing_block()->width();
|
||||||
|
|
||||||
auto zero_value = CSS::Length::make_px(0);
|
auto zero_value = CSS::Length::make_px(0);
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ void BlockFormattingContext::compute_width_for_floating_box(Box& box)
|
||||||
{
|
{
|
||||||
// 10.3.5 Floating, non-replaced elements
|
// 10.3.5 Floating, non-replaced elements
|
||||||
auto& computed_values = box.computed_values();
|
auto& computed_values = box.computed_values();
|
||||||
float width_of_containing_block = box.width_of_logical_containing_block();
|
float width_of_containing_block = box.containing_block()->width();
|
||||||
auto zero_value = CSS::Length::make_px(0);
|
auto zero_value = CSS::Length::make_px(0);
|
||||||
|
|
||||||
auto margin_left = computed_values.margin().left.resolved_or_zero(box, width_of_containing_block);
|
auto margin_left = computed_values.margin().left.resolved_or_zero(box, width_of_containing_block);
|
||||||
|
@ -389,7 +389,7 @@ void BlockFormattingContext::compute_position(Box& box)
|
||||||
|
|
||||||
auto& box_model = box.box_model();
|
auto& box_model = box.box_model();
|
||||||
auto& computed_values = box.computed_values();
|
auto& computed_values = box.computed_values();
|
||||||
float width_of_containing_block = box.width_of_logical_containing_block();
|
float width_of_containing_block = box.containing_block()->width();
|
||||||
|
|
||||||
auto specified_left = computed_values.offset().left.resolved_or_zero(box, width_of_containing_block);
|
auto specified_left = computed_values.offset().left.resolved_or_zero(box, width_of_containing_block);
|
||||||
auto specified_right = computed_values.offset().right.resolved_or_zero(box, width_of_containing_block);
|
auto specified_right = computed_values.offset().right.resolved_or_zero(box, width_of_containing_block);
|
||||||
|
|
|
@ -234,11 +234,4 @@ StackingContext* Box::enclosing_stacking_context()
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
float Box::width_of_logical_containing_block() const
|
|
||||||
{
|
|
||||||
auto* containing_block = this->containing_block();
|
|
||||||
VERIFY(containing_block);
|
|
||||||
return containing_block->width();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,8 +122,6 @@ public:
|
||||||
virtual void paint_box_shadow(PaintContext& context);
|
virtual void paint_box_shadow(PaintContext& context);
|
||||||
virtual void paint_background(PaintContext& context);
|
virtual void paint_background(PaintContext& context);
|
||||||
|
|
||||||
virtual float width_of_logical_containing_block() const;
|
|
||||||
|
|
||||||
Painting::BorderRadiusData normalized_border_radius_data();
|
Painting::BorderRadiusData normalized_border_radius_data();
|
||||||
|
|
||||||
virtual Optional<float> intrinsic_width() const { return {}; }
|
virtual Optional<float> intrinsic_width() const { return {}; }
|
||||||
|
|
|
@ -106,7 +106,7 @@ void FlexFormattingContext::run(Box& run_box, LayoutMode)
|
||||||
|
|
||||||
void FlexFormattingContext::populate_specified_margins(FlexItem& item, CSS::FlexDirection flex_direction) const
|
void FlexFormattingContext::populate_specified_margins(FlexItem& item, CSS::FlexDirection flex_direction) const
|
||||||
{
|
{
|
||||||
auto width_of_containing_block = item.box.width_of_logical_containing_block();
|
auto width_of_containing_block = item.box.containing_block()->width();
|
||||||
// FIXME: This should also take reverse-ness into account
|
// FIXME: This should also take reverse-ness into account
|
||||||
if (flex_direction == CSS::FlexDirection::Row || flex_direction == CSS::FlexDirection::RowReverse) {
|
if (flex_direction == CSS::FlexDirection::Row || flex_direction == CSS::FlexDirection::RowReverse) {
|
||||||
item.margins.main_before = item.box.computed_values().margin().left.resolved_or_zero(item.box, width_of_containing_block).to_px(item.box);
|
item.margins.main_before = item.box.computed_values().margin().left.resolved_or_zero(item.box, width_of_containing_block).to_px(item.box);
|
||||||
|
|
|
@ -31,11 +31,4 @@ size_t TableCellBox::colspan() const
|
||||||
return verify_cast<DOM::Element>(*dom_node()).attribute(HTML::AttributeNames::colspan).to_uint().value_or(1);
|
return verify_cast<DOM::Element>(*dom_node()).attribute(HTML::AttributeNames::colspan).to_uint().value_or(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
float TableCellBox::width_of_logical_containing_block() const
|
|
||||||
{
|
|
||||||
if (auto* row = first_ancestor_of_type<TableRowBox>())
|
|
||||||
return row->width();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,6 @@ public:
|
||||||
size_t colspan() const;
|
size_t colspan() const;
|
||||||
|
|
||||||
static CSS::Display static_display() { return CSS::Display { CSS::Display::Internal::TableCell }; }
|
static CSS::Display static_display() { return CSS::Display { CSS::Display::Internal::TableCell }; }
|
||||||
|
|
||||||
private:
|
|
||||||
virtual float width_of_logical_containing_block() const override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue