瀏覽代碼

LibWeb: Don't try to be clever about -libweb-center relative position

Let's just say that -libweb-center centers the block in its containing
block for now. We can get fancy with relative offsets later.
Andreas Kling 5 年之前
父節點
當前提交
1e15fa30e4
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Libraries/LibWeb/Layout/LayoutBlock.cpp

+ 1 - 1
Libraries/LibWeb/Layout/LayoutBlock.cpp

@@ -454,7 +454,7 @@ void LayoutBlock::compute_position()
         + box_model().offset().left.to_px(*this);
         + box_model().offset().left.to_px(*this);
 
 
     if (parent()->is_block() && parent()->style().text_align() == CSS::ValueID::VendorSpecificCenter) {
     if (parent()->is_block() && parent()->style().text_align() == CSS::ValueID::VendorSpecificCenter) {
-        position_x += (containing_block.width() / 2) - width() / 2;
+        position_x = (containing_block.width() / 2) - width() / 2;
     }
     }
 
 
     float position_y = box_model().margin_box(*this).top
     float position_y = box_model().margin_box(*this).top