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

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

Issue 2693193002: [LayoutNG] A different approach to multi-col. (Closed)
Patch Set: Created 3 years, 10 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
Index: third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
index f95e7fd31ac1655e8a3f8eccaaf4d1fa963924e2..fa37f4ba1d9ca781040a12708b4438e48960a572 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
@@ -15,6 +15,7 @@
#include "core/layout/ng/ng_fragment_builder.h"
#include "core/layout/ng/ng_inline_node.h"
#include "core/layout/ng/ng_length_utils.h"
+#include "core/layout/ng/ng_multi_column_layout_algorithm.h"
#include "core/layout/ng/ng_writing_mode.h"
#include "core/paint/PaintLayer.h"
#include "platform/RuntimeEnabledFeatures.h"
@@ -85,10 +86,17 @@ RefPtr<NGPhysicalFragment> NGBlockNode::Layout(
return fragment_;
}
- RefPtr<NGPhysicalFragment> fragment =
- NGBlockLayoutAlgorithm(GetLayoutObject(), &Style(), FirstChild(),
- constraint_space, CurrentBreakToken())
- .Layout();
+ RefPtr<NGPhysicalFragment> fragment = nullptr;
+ if (Style().specifiesColumns()) {
+ fragment =
+ NGMultiColumnLayoutAlgorithm(this, constraint_space,
+ toNGBlockBreakToken(CurrentBreakToken()))
+ .Layout();
+ } else {
+ fragment = NGBlockLayoutAlgorithm(this, constraint_space,
+ toNGBlockBreakToken(CurrentBreakToken()))
+ .Layout();
+ }
fragment_ = toNGPhysicalBoxFragment(fragment.get());
CopyFragmentDataToLayoutBox(*constraint_space);
@@ -121,8 +129,7 @@ MinAndMaxContentSizes NGBlockNode::ComputeMinAndMaxContentSizes() {
.ToConstraintSpace();
// TODO(cbiesinger): For orthogonal children, we need to always synthesize.
- NGBlockLayoutAlgorithm minmax_algorithm(layout_box_, &Style(), FirstChild(),
- constraint_space);
+ NGBlockLayoutAlgorithm minmax_algorithm(this, constraint_space);
Optional<MinAndMaxContentSizes> maybe_sizes =
minmax_algorithm.ComputeMinAndMaxContentSizes();
if (maybe_sizes.has_value())
@@ -305,7 +312,7 @@ RefPtr<NGPhysicalBoxFragment> NGBlockNode::RunOldLayout(
LayoutRect overflow = layout_box_->layoutOverflowRect();
// TODO(layout-ng): This does not handle writing modes correctly (for
// overflow)
- NGFragmentBuilder builder(NGPhysicalFragment::kFragmentBox, layout_box_);
+ NGFragmentBuilder builder(NGPhysicalFragment::kFragmentBox, this);
builder.SetInlineSize(layout_box_->logicalWidth())
.SetBlockSize(layout_box_->logicalHeight())
.SetDirection(layout_box_->styleRef().direction())

Powered by Google App Engine
This is Rietveld 408576698