summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/Layout/LayoutBlock.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-23 19:20:06 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-23 19:20:06 +0200
commit7c848645c3963beefd0d9838935c949cb02e0522 (patch)
treeea222fbe0e70939dcc653931256164a0dafd2045 /Libraries/LibWeb/Layout/LayoutBlock.cpp
parentaeeaf33638e17d20a9ccfda033ae37648ca3f485 (diff)
downloadserenity-7c848645c3963beefd0d9838935c949cb02e0522.zip
LibWeb: Take margin into account when positioning absolute descendants
Diffstat (limited to 'Libraries/LibWeb/Layout/LayoutBlock.cpp')
-rw-r--r--Libraries/LibWeb/Layout/LayoutBlock.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Libraries/LibWeb/Layout/LayoutBlock.cpp b/Libraries/LibWeb/Layout/LayoutBlock.cpp
index 40ab73091e..057cfdf9b2 100644
--- a/Libraries/LibWeb/Layout/LayoutBlock.cpp
+++ b/Libraries/LibWeb/Layout/LayoutBlock.cpp
@@ -103,9 +103,9 @@ void LayoutBlock::layout_absolutely_positioned_descendant(LayoutBox& box)
- box_model.offset().bottom.to_px(box)
- box_model.border_box(box).bottom;
- if (!box_model.offset().left.is_auto()) {
+ if (!box_model.offset().left.is_auto() || !box_model.margin().left.is_auto()) {
used_offset.set_x(x_offset + box_model.margin().left.to_px(box));
- } else if (!box_model.offset().right.is_auto()) {
+ } else if (!box_model.offset().right.is_auto() || !box_model.margin().right.is_auto()) {
used_offset.set_x(width() + x_offset - box.width() - box_model.margin().right.to_px(box));
}