diff options
author | Andreas Kling <kling@serenityos.org> | 2022-01-24 01:39:49 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-24 02:09:17 +0100 |
commit | 9a483682806d3543a8263fc34f0ce0b914ee96a5 (patch) | |
tree | 76e92864129ba23dc3ee17b87123ef404a6a06c2 /Userland/Libraries/LibWeb | |
parent | d58f60c953d4b7f6bdc5e01621564c23f5da0008 (diff) | |
download | serenity-9a483682806d3543a8263fc34f0ce0b914ee96a5.zip |
LibWeb: Simplify code that compute initial child positions in BFC
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index e13f49ed5c..8b2d272008 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -455,12 +455,8 @@ void BlockFormattingContext::place_block_level_replaced_element_in_normal_flow(B compute_vertical_box_model_metrics(child_box, containing_block); - float x = box_model.margin.left - + box_model.border.left - + box_model.padding.left - + box_model.offset.left; - - float y = box_model.margin_box().top + containing_block.box_model().offset.top; + float x = box_model.margin_box().left + box_model.offset.left; + float y = box_model.margin_box().top + box_model.offset.top; child_box.set_offset(x, y); } @@ -472,13 +468,11 @@ void BlockFormattingContext::place_block_level_non_replaced_element_in_normal_fl compute_vertical_box_model_metrics(child_box, containing_block); - float x = box_model.margin.left - + box_model.border.left - + box_model.padding.left - + box_model.offset.left; - + float x = 0; if (containing_block.computed_values().text_align() == CSS::TextAlign::LibwebCenter) { x = (containing_block.width() / 2) - child_box.width() / 2; + } else { + x = box_model.margin_box().left + box_model.offset.left; } float y = box_model.margin_box().top |