summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/layout/ng/inline/ng_line_box_fragment_builder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/layout/ng/inline/ng_line_box_fragment_builder.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/layout/ng/inline/ng_line_box_fragment_builder.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/chromium/third_party/blink/renderer/core/layout/ng/inline/ng_line_box_fragment_builder.cc b/chromium/third_party/blink/renderer/core/layout/ng/inline/ng_line_box_fragment_builder.cc
index 984f06e7d8b..1b67ab8a75a 100644
--- a/chromium/third_party/blink/renderer/core/layout/ng/inline/ng_line_box_fragment_builder.cc
+++ b/chromium/third_party/blink/renderer/core/layout/ng/inline/ng_line_box_fragment_builder.cc
@@ -14,6 +14,7 @@
#include "third_party/blink/renderer/core/layout/ng/ng_layout_result.h"
#include "third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h"
#include "third_party/blink/renderer/core/layout/ng/ng_positioned_float.h"
+#include "third_party/blink/renderer/core/layout/ng/ng_relative_utils.h"
namespace blink {
@@ -24,6 +25,9 @@ void NGLineBoxFragmentBuilder::Reset() {
oof_positioned_candidates_.Shrink(0);
unpositioned_list_marker_ = NGUnpositionedListMarker();
+ bfc_block_offset_.reset();
+ line_box_bfc_block_offset_.reset();
+
size_.inline_size = LayoutUnit();
metrics_ = FontHeight::Empty();
line_box_type_ = NGPhysicalLineBoxFragment::kNormalLineBox;
@@ -43,11 +47,15 @@ void NGLineBoxFragmentBuilder::PropagateChildrenData(
for (unsigned index = 0; index < children.size(); ++index) {
auto& child = children[index];
if (child.layout_result) {
- // TODO(almaher): Handle the inline case correctly for OOF fragmentation.
- // The relative offset should not always be set to LogicalOffset() here.
- PropagateChildData(child.layout_result->PhysicalFragment(),
- child.Offset(),
- /* relative_offset */ LogicalOffset());
+ // An accumulated relative offset is applied to an OOF once it reaches its
+ // inline container. Subtract out the relative offset to avoid adding it
+ // twice.
+ PropagateChildData(
+ child.layout_result->PhysicalFragment(),
+ child.Offset() -
+ ComputeRelativeOffsetForInline(*ConstraintSpace(),
+ child.PhysicalFragment()->Style()),
+ /* reltaive_offset */ LogicalOffset());
// Skip over any children, the information should have already been
// propagated into this layout result.
@@ -65,7 +73,8 @@ void NGLineBoxFragmentBuilder::PropagateChildrenData(
}
DCHECK(oof_positioned_descendants_.IsEmpty());
- MoveOutOfFlowDescendantCandidatesToDescendants();
+ MoveOutOfFlowDescendantCandidatesToDescendants(
+ /* relative_offset */ LogicalOffset());
}
scoped_refptr<const NGLayoutResult>