mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 08:41:15 +00:00
LibWeb: Resolve Lengths to pixels earlier
This commit is contained in:
parent
356d8bcfe8
commit
f0a4b33a5e
Notes:
sideshowbarker
2024-07-17 18:34:17 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/f0a4b33a5e Pull-request: https://github.com/SerenityOS/serenity/pull/12628
|
@ -414,8 +414,8 @@ void FormattingContext::compute_width_for_absolutely_positioned_non_replaced_ele
|
|||
auto margin_right = CSS::Length::make_auto();
|
||||
const auto border_left = computed_values.border_left().width;
|
||||
const auto border_right = computed_values.border_right().width;
|
||||
const auto padding_left = computed_values.padding().left.resolved(box, width_of_containing_block).resolved(box);
|
||||
const auto padding_right = computed_values.padding().right.resolved(box, width_of_containing_block).resolved(box);
|
||||
const auto padding_left = computed_values.padding().left.resolved(box, width_of_containing_block).to_px(box);
|
||||
const auto padding_right = computed_values.padding().right.resolved(box, width_of_containing_block).to_px(box);
|
||||
|
||||
auto try_compute_width = [&](const auto& a_width) {
|
||||
margin_left = computed_values.margin().left.resolved(box, width_of_containing_block).resolved(box);
|
||||
|
@ -426,15 +426,15 @@ void FormattingContext::compute_width_for_absolutely_positioned_non_replaced_ele
|
|||
auto width = a_width;
|
||||
|
||||
auto solve_for_left = [&] {
|
||||
return CSS::Length(containing_block.content_width() - margin_left.to_px(box) - border_left - padding_left.to_px(box) - width.to_px(box) - padding_right.to_px(box) - border_right - margin_right.to_px(box) - right.to_px(box), CSS::Length::Type::Px);
|
||||
return CSS::Length(containing_block.content_width() - margin_left.to_px(box) - border_left - padding_left - width.to_px(box) - padding_right - border_right - margin_right.to_px(box) - right.to_px(box), CSS::Length::Type::Px);
|
||||
};
|
||||
|
||||
auto solve_for_width = [&] {
|
||||
return CSS::Length(containing_block.content_width() - left.to_px(box) - margin_left.to_px(box) - border_left - padding_left.to_px(box) - padding_right.to_px(box) - border_right - margin_right.to_px(box) - right.to_px(box), CSS::Length::Type::Px);
|
||||
return CSS::Length(containing_block.content_width() - left.to_px(box) - margin_left.to_px(box) - border_left - padding_left - padding_right - border_right - margin_right.to_px(box) - right.to_px(box), CSS::Length::Type::Px);
|
||||
};
|
||||
|
||||
auto solve_for_right = [&] {
|
||||
return CSS::Length(containing_block.content_width() - left.to_px(box) - margin_left.to_px(box) - border_left - padding_left.to_px(box) - width.to_px(box) - padding_right.to_px(box) - border_right - margin_right.to_px(box), CSS::Length::Type::Px);
|
||||
return CSS::Length(containing_block.content_width() - left.to_px(box) - margin_left.to_px(box) - border_left - padding_left - width.to_px(box) - padding_right - border_right - margin_right.to_px(box), CSS::Length::Type::Px);
|
||||
};
|
||||
|
||||
// If all three of 'left', 'width', and 'right' are 'auto':
|
||||
|
@ -540,8 +540,8 @@ void FormattingContext::compute_width_for_absolutely_positioned_non_replaced_ele
|
|||
box.box_model().margin.right = margin_right.to_px(box);
|
||||
box.box_model().border.left = border_left;
|
||||
box.box_model().border.right = border_right;
|
||||
box.box_model().padding.left = padding_left.to_px(box);
|
||||
box.box_model().padding.right = padding_right.to_px(box);
|
||||
box.box_model().padding.left = padding_left;
|
||||
box.box_model().padding.right = padding_right;
|
||||
}
|
||||
|
||||
void FormattingContext::compute_width_for_absolutely_positioned_replaced_element(ReplacedBox& box)
|
||||
|
|
Loading…
Reference in a new issue