Index: third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc |
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc |
index cb4ab397cd2e4289945ed3617d16e58611afb18b..c8c5e158f9c0806e1b8c037764dd92b61ab5af3b 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc |
+++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc |
@@ -31,6 +31,34 @@ |
namespace blink { |
+namespace { |
+ |
+// Set the geometry to InlineFlowBox by computing the union of children. |
+void PlaceInlineFlowBoxes(InlineFlowBox* flow_box) { |
+ LayoutUnit logical_left = LayoutUnit::Max(); |
+ LayoutUnit logical_right = LayoutUnit::Min(); |
+ LayoutUnit logical_top = LayoutUnit::Max(); |
+ for (InlineBox* curr = flow_box->FirstChild(); curr; |
+ curr = curr->NextOnLine()) { |
+ if (curr->GetLineLayoutItem().IsLayoutInline()) { |
+ InlineFlowBox* flow = ToInlineFlowBox(curr); |
+ PlaceInlineFlowBoxes(flow); |
+ } |
+ logical_left = std::min(curr->LogicalLeft(), logical_left); |
+ logical_right = std::max(curr->LogicalRight(), logical_right); |
+ logical_top = std::min(curr->LogicalTop(), logical_top); |
+ } |
+ if (logical_left == LayoutUnit::Max()) |
+ return; |
+ logical_left -= flow_box->MarginBorderPaddingLogicalLeft(); |
+ logical_right += flow_box->MarginBorderPaddingLogicalRight(); |
+ flow_box->SetLogicalLeft(logical_left); |
+ flow_box->SetLogicalWidth(logical_right - logical_left); |
+ flow_box->SetLogicalTop(logical_top); |
+} |
+ |
+} // namespace |
+ |
NGInlineNode::NGInlineNode(LayoutObject* start_inline, LayoutNGBlockFlow* block) |
: NGLayoutInputNode(NGLayoutInputNodeType::kLegacyInline), |
start_inline_(start_inline), |
@@ -358,6 +386,10 @@ void NGInlineNode::CopyFragmentDataToLayoutBox( |
} |
DCHECK(!run); |
+ // InlineTextBox and InlineBox are placed, but when ConstructLine() created |
+ // InlineFlowBox, they needed to be placed as well. |
+ PlaceInlineFlowBoxes(root_line_box); |
+ |
// Copy to RootInlineBox. |
NGLineBoxFragment line_box(constraint_space.WritingMode(), |
physical_line_box); |