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

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

Issue 2721613003: [LayoutNG] Move remaining ng_units structs to their own files (Closed)
Patch Set: Don't export NGBoxStrut for now 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_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 a755d5ac107dacdcbe1c428a14e894e3a1971784..e7bf8c5c54045bbc37a60ded243f0758b3b873ed 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
@@ -17,7 +17,6 @@
#include "core/layout/ng/ng_length_utils.h"
#include "core/layout/ng/ng_line_builder.h"
#include "core/layout/ng/ng_out_of_flow_layout_part.h"
-#include "core/layout/ng/ng_units.h"
#include "core/style/ComputedStyle.h"
#include "platform/LengthFunctions.h"
#include "wtf/Optional.h"
@@ -313,9 +312,9 @@ NGBlockLayoutAlgorithm::NGBlockLayoutAlgorithm(
builder_(WTF::wrapUnique(
new NGFragmentBuilder(NGPhysicalFragment::kFragmentBox, node))) {}
-Optional<MinAndMaxContentSizes>
-NGBlockLayoutAlgorithm::ComputeMinAndMaxContentSizes() const {
- MinAndMaxContentSizes sizes;
+Optional<MinMaxContentSize> NGBlockLayoutAlgorithm::ComputeMinMaxContentSize()
+ const {
+ MinMaxContentSize sizes;
// Size-contained elements don't consider their contents for intrinsic sizing.
if (Style().containsSize())
@@ -324,7 +323,7 @@ NGBlockLayoutAlgorithm::ComputeMinAndMaxContentSizes() const {
// TODO: handle floats & orthogonal children.
for (NGLayoutInputNode* node = node_->FirstChild(); node;
node = node->NextSibling()) {
- MinAndMaxContentSizes child_sizes;
+ MinMaxContentSize child_sizes;
if (node->Type() == NGLayoutInputNode::kLegacyInline) {
// From |NGBlockLayoutAlgorithm| perspective, we can handle |NGInlineNode|
// almost the same as |NGBlockNode|, because an |NGInlineNode| includes
@@ -332,13 +331,12 @@ NGBlockLayoutAlgorithm::ComputeMinAndMaxContentSizes() const {
// an anonymous box that contains all line boxes.
// |NextSibling| returns the next block sibling, or nullptr, skipping all
// following inline siblings and descendants.
- child_sizes = toNGInlineNode(node)->ComputeMinAndMaxContentSizes();
+ child_sizes = toNGInlineNode(node)->ComputeMinMaxContentSize();
} else {
- Optional<MinAndMaxContentSizes> child_minmax;
+ Optional<MinMaxContentSize> child_minmax;
NGBlockNode* block_child = toNGBlockNode(node);
- if (NeedMinAndMaxContentSizesForContentContribution(
- block_child->Style())) {
- child_minmax = block_child->ComputeMinAndMaxContentSizes();
+ if (NeedMinMaxContentSizeForContentContribution(block_child->Style())) {
+ child_minmax = block_child->ComputeMinMaxContentSize();
}
child_sizes = ComputeMinAndMaxContentContribution(block_child->Style(),
@@ -378,9 +376,9 @@ void NGBlockLayoutAlgorithm::UpdateFragmentBfcOffset(
}
RefPtr<NGLayoutResult> NGBlockLayoutAlgorithm::Layout() {
- WTF::Optional<MinAndMaxContentSizes> sizes;
- if (NeedMinAndMaxContentSizes(ConstraintSpace(), Style()))
- sizes = ComputeMinAndMaxContentSizes();
+ WTF::Optional<MinMaxContentSize> sizes;
+ if (NeedMinMaxContentSize(ConstraintSpace(), Style()))
+ sizes = ComputeMinMaxContentSize();
border_and_padding_ = ComputeBorders(ConstraintSpace(), Style()) +
ComputePadding(ConstraintSpace(), Style());
@@ -667,11 +665,11 @@ void NGBlockLayoutAlgorithm::FinalizeForFragmentation() {
NGBoxStrut NGBlockLayoutAlgorithm::CalculateMargins(
const NGConstraintSpace& space,
const ComputedStyle& style) {
- WTF::Optional<MinAndMaxContentSizes> sizes;
- if (NeedMinAndMaxContentSizes(space, style)) {
- // TODO(ikilpatrick): Change ComputeMinAndMaxContentSizes to return
- // MinAndMaxContentSizes.
- sizes = toNGBlockNode(current_child_)->ComputeMinAndMaxContentSizes();
+ WTF::Optional<MinMaxContentSize> sizes;
+ if (NeedMinMaxContentSize(space, style)) {
+ // TODO(ikilpatrick): Change ComputeMinMaxContentSize to return
+ // MinMaxContentSize.
+ sizes = toNGBlockNode(current_child_)->ComputeMinMaxContentSize();
}
LayoutUnit child_inline_size =
ComputeInlineSizeForFragment(space, style, sizes);

Powered by Google App Engine
This is Rietveld 408576698