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

LibWeb: Remove reference_for_percent parameter from Length::resolved()

Despite looking like it was still needed, it was only used for passing
to other calls to Length::resolved() recursively. This makes the
various `foo.resolved().resolved()` calls a lot less awkward.
(Though, still quite awkward.)

I think we'd need to separate calculated lengths out to properly tidy
these calls up, but one yak at a time. :^)
This commit is contained in:
Sam Atkins 2022-01-19 17:00:50 +00:00 committed by Andreas Kling
parent cff44831a8
commit bfcbab0dcf
11 changed files with 133 additions and 132 deletions

View file

@ -36,14 +36,14 @@ void InlineNode::split_into_lines(InlineFormattingContext& context, LayoutMode l
};
if (is_not_undefined_or_auto(computed_values().padding().left)) {
float padding_left = computed_values().padding().left.resolved(CSS::Length::make_px(containing_block.width())).resolved(CSS::Length::make_px(0), *this, containing_block.width()).to_px(*this);
float padding_left = computed_values().padding().left.resolved(CSS::Length::make_px(containing_block.width())).resolved(CSS::Length::make_px(0), *this).to_px(*this);
containing_block.ensure_last_line_box().add_fragment(*this, 0, 0, padding_left, 0, LineBoxFragment::Type::Leading);
}
NodeWithStyleAndBoxModelMetrics::split_into_lines(context, layout_mode);
if (is_not_undefined_or_auto(computed_values().padding().right)) {
float padding_right = computed_values().padding().right.resolved(CSS::Length::make_px(containing_block.width())).resolved(CSS::Length::make_px(0), *this, containing_block.width()).to_px(*this);
float padding_right = computed_values().padding().right.resolved(CSS::Length::make_px(containing_block.width())).resolved(CSS::Length::make_px(0), *this).to_px(*this);
containing_block.ensure_last_line_box().add_fragment(*this, 0, 0, padding_right, 0, LineBoxFragment::Type::Trailing);
}
}
@ -66,9 +66,9 @@ void InlineNode::paint(PaintContext& context, PaintPhase phase)
if (auto computed_box_shadow = computed_values().box_shadow(); computed_box_shadow.has_value()) {
auto box_shadow_data = Painting::BoxShadowData {
.offset_x = (int)computed_box_shadow->offset_x.resolved_or_zero(*this, rect.width()).to_px(*this),
.offset_y = (int)computed_box_shadow->offset_y.resolved_or_zero(*this, rect.height()).to_px(*this),
.blur_radius = (int)computed_box_shadow->blur_radius.resolved_or_zero(*this, rect.width()).to_px(*this),
.offset_x = (int)computed_box_shadow->offset_x.resolved_or_zero(*this).to_px(*this),
.offset_y = (int)computed_box_shadow->offset_y.resolved_or_zero(*this).to_px(*this),
.blur_radius = (int)computed_box_shadow->blur_radius.resolved_or_zero(*this).to_px(*this),
.color = computed_box_shadow->color
};
Painting::paint_box_shadow(context, enclosing_int_rect(rect), box_shadow_data);