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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_layout_algorithm.h

Issue 2816933003: Use Layout Opportunity Iterator to position new FC blocks. (Closed)
Patch Set: Fix comments Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NGLayoutAlgorithm_h 5 #ifndef NGLayoutAlgorithm_h
6 #define NGLayoutAlgorithm_h 6 #define NGLayoutAlgorithm_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/layout/ng/ng_floats_utils.h"
9 #include "core/layout/ng/ng_fragment_builder.h" 10 #include "core/layout/ng/ng_fragment_builder.h"
10 #include "core/layout/ng/ng_min_max_content_size.h" 11 #include "core/layout/ng/ng_min_max_content_size.h"
11 #include "platform/wtf/Allocator.h" 12 #include "platform/wtf/Allocator.h"
12 #include "platform/wtf/Optional.h" 13 #include "platform/wtf/Optional.h"
13 14
14 namespace blink { 15 namespace blink {
15 16
16 class ComputedStyle; 17 class ComputedStyle;
17 class NGConstraintSpace; 18 class NGConstraintSpace;
18 class NGLayoutResult; 19 class NGLayoutResult;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 const ComputedStyle& Style() const { 58 const ComputedStyle& Style() const {
58 DCHECK(node_); 59 DCHECK(node_);
59 return node_->Style(); 60 return node_->Style();
60 } 61 }
61 62
62 NGLogicalOffset ContainerBfcOffset() const { 63 NGLogicalOffset ContainerBfcOffset() const {
63 DCHECK(container_builder_.BfcOffset().has_value()); 64 DCHECK(container_builder_.BfcOffset().has_value());
64 return container_builder_.BfcOffset().value(); 65 return container_builder_.BfcOffset().value();
65 } 66 }
66 67
68 // Positions pending floats starting from {@origin_block_offset} and relative
69 // to ContainerBfcOffset().
70 void PositionPendingFloats(LayoutUnit origin_block_offset) {
ikilpatrick 2017/04/18 13:19:56 if there is another way to do this i'd prefer that
Gleb Lanbin 2017/04/18 17:30:20 yes, I was thinking about that as well. Here are 4
ikilpatrick 2017/04/18 21:04:11 My preferred option here would be (4) in a follow
71 DCHECK(container_builder_.BfcOffset())
72 << "Parent BFC offset should be known here";
73 const auto& floating_objects = container_builder_.UnpositionedFloats();
74 PositionFloats(origin_block_offset, ContainerBfcOffset().block_offset,
75 floating_objects, MutableConstraintSpace());
76 container_builder_.MutablePositionedFloats().AppendVector(floating_objects);
77 container_builder_.MutableUnpositionedFloats().Clear();
78 }
79
67 virtual NGInputNodeType* Node() const { return node_; } 80 virtual NGInputNodeType* Node() const { return node_; }
68 81
69 NGBreakTokenType* BreakToken() const { return break_token_; } 82 NGBreakTokenType* BreakToken() const { return break_token_; }
70 83
71 Persistent<NGInputNodeType> node_; 84 Persistent<NGInputNodeType> node_;
72 NGConstraintSpace* constraint_space_; 85 NGConstraintSpace* constraint_space_;
73 86
74 // The break token from which we are currently resuming layout. 87 // The break token from which we are currently resuming layout.
75 NGBreakTokenType* break_token_; 88 NGBreakTokenType* break_token_;
76 89
77 NGFragmentBuilder container_builder_; 90 NGFragmentBuilder container_builder_;
78 }; 91 };
79 92
80 } // namespace blink 93 } // namespace blink
81 94
82 #endif // NGLayoutAlgorithm_h 95 #endif // NGLayoutAlgorithm_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698