Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1051)

Unified Diff: third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc

Issue 2887623002: [LayoutNG] Place InlineFlowBox from NGFragment tree (Closed)
Patch Set: Update TestExpectations Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698