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

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

Issue 2325073002: [LayoutNG] Handle border and padding when sizing a block and when placing its children. (Closed)
Patch Set: Use modern CSS terms, rather than old XSL terms, for box sides Created 4 years, 3 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 | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
index ae4722e5639624aede739e87e0b97c50998941fa..eb8191faa7c2da338d5463b483461fa7a68e8cca 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
@@ -47,7 +47,8 @@ bool NGBlockLayoutAlgorithm::Layout(const NGConstraintSpace* constraint_space,
constraint_space_for_children_ =
new NGConstraintSpace(*constraint_space, NGLogicalOffset(),
NGLogicalSize(inline_size, block_size));
- content_size_ = LayoutUnit();
+ content_size_ =
+ computeBorderAndPaddingBlockStart(*constraint_space, *style_);
builder_ = new NGFragmentBuilder(NGPhysicalFragmentBase::FragmentBox);
builder_->SetInlineSize(inline_size).SetBlockSize(block_size);
@@ -66,9 +67,15 @@ bool NGBlockLayoutAlgorithm::Layout(const NGConstraintSpace* constraint_space,
LayoutUnit margin_block_start =
CollapseMargins(child_margins, fragment->MarginStrut());
+ // TODO(layout-ng): This is probably something we shouldn't calculate
+ // over and over again for each child.
+ LayoutUnit content_inline_start_edge =
+ computeBorderAndPaddingInlineStart(*constraint_space, *style_);
+
// TODO(layout-ng): Support auto margins
builder_->AddChild(fragment,
- NGLogicalOffset(child_margins.inline_start,
+ NGLogicalOffset(content_inline_start_edge +
+ child_margins.inline_start,
content_size_ + margin_block_start));
content_size_ += fragment->BlockSize() + margin_block_start;
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698