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

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

Issue 2259963002: [layoutng] Margin support, part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dcheck Created 4 years, 4 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_length_utils.h » ('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 b66e1967aa737344d900025f1c0fcd08555507e9..f73475e43a4b7ef73881966f2c7e1e216ec1397f 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
@@ -8,6 +8,7 @@
#include "core/layout/ng/ng_constraint_space.h"
#include "core/layout/ng/ng_fragment.h"
#include "core/layout/ng/ng_length_utils.h"
+#include "core/layout/ng/ng_margin_strut.h"
#include "core/style/ComputedStyle.h"
#include "platform/LengthFunctions.h"
@@ -26,11 +27,13 @@ NGFragment* NGBlockLayoutAlgorithm::layout(
HeapVector<Member<const NGFragmentBase>> childFragments;
LayoutUnit contentSize;
for (NGBox box : m_boxIterator) {
+ NGBoxMargins childMargins = computeMargins(constraintSpace, *box.style());
NGFragment* fragment = box.layout(constraintSpace);
- // TODO(layout-ng): Take margins into account
- fragment->setOffset(LayoutUnit(), contentSize);
+ // TODO(layout-ng): Support auto margins
+ fragment->setOffset(childMargins.inlineStart,
+ contentSize + childMargins.blockStart);
box.positionUpdated(*fragment);
- contentSize += fragment->blockSize();
+ contentSize += fragment->blockSize() + childMargins.blockSum();
childFragments.append(fragment);
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_length_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698