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

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_multi_column_layout_algorithm.h

Issue 2693193002: [LayoutNG] A different approach to multi-col. (Closed)
Patch Set: tmp upload 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
Index: third_party/WebKit/Source/core/layout/ng/ng_multi_column_layout_algorithm.h
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_multi_column_layout_algorithm.h b/third_party/WebKit/Source/core/layout/ng/ng_multi_column_layout_algorithm.h
new file mode 100644
index 0000000000000000000000000000000000000000..a1da6d4fe67301962b2f9f49a1d050e773b774c9
--- /dev/null
+++ b/third_party/WebKit/Source/core/layout/ng/ng_multi_column_layout_algorithm.h
@@ -0,0 +1,63 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NGMultiColumnLayoutAlgorithm_h
+#define NGMultiColumnLayoutAlgorithm_h
+
+#include "core/CoreExport.h"
+#include "core/layout/ng/ng_block_node.h"
+#include "core/layout/ng/ng_break_token.h"
+#include "core/layout/ng/ng_constraint_space_builder.h"
+#include "core/layout/ng/ng_fragment_builder.h"
+#include "core/layout/ng/ng_layout_algorithm.h"
+
+namespace blink {
+
+class ComputedStyle;
+class NGConstraintSpace;
+class NGConstraintSpaceBuilder;
+
+// A class for general block layout (e.g. a <div> with no special style).
+// Lays out the children in sequence.
+class CORE_EXPORT NGMultiColumnLayoutAlgorithm : public NGLayoutAlgorithm {
+ public:
+ // Default constructor.
+ // @param layout_object The layout object associated with this block.
+ // @param style Style reference of the block that is being laid out.
+ // @param first_child Our first child; the algorithm will use its NextSibling
+ // method to access all the children.
+ // @param space The constraint space which the algorithm should generate a
+ // fragment within.
+ NGMultiColumnLayoutAlgorithm(NGBlockNode* node,
+ NGConstraintSpace* space,
+ NGBreakToken* break_token = nullptr);
+
+ RefPtr<NGLayoutResult> Layout() override;
+ Optional<MinMaxContentSize> ComputeMinMaxContentSize() const override;
+
+ private:
+ const NGConstraintSpace& ConstraintSpace() const {
+ DCHECK(constraint_space_);
+ return *constraint_space_;
+ }
+
+ const ComputedStyle& Style() const { return node_->Style(); }
+
+ Persistent<NGBlockNode> node_;
+ NGConstraintSpace* constraint_space_;
+
+ // The break token from which we are currently resuming layout.
+ NGBreakToken* break_token_;
+
+ NGFragmentBuilder builder_;
+ NGConstraintSpaceBuilder space_builder_;
+
+ NGBoxStrut border_and_padding_;
+ LayoutUnit content_size_;
+ LayoutUnit max_inline_size_;
+};
+
+} // namespace blink
+
+#endif // NGBlockLayoutAlgorithm_h

Powered by Google App Engine
This is Rietveld 408576698