OLD | NEW |
---|---|
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 #include "core/layout/ng/ng_layout_opportunity_iterator.h" | 5 #include "core/layout/ng/ng_layout_opportunity_iterator.h" |
6 | 6 |
7 #include "core/layout/ng/ng_physical_constraint_space.h" | 7 #include "core/layout/ng/ng_physical_constraint_space.h" |
8 #include "core/layout/ng/ng_units.h" | 8 #include "core/layout/ng/ng_units.h" |
9 #include "wtf/NonCopyingSort.h" | 9 #include "wtf/NonCopyingSort.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... | |
22 CollectAllOpportunities(node->bottom, opportunities); | 22 CollectAllOpportunities(node->bottom, opportunities); |
23 CollectAllOpportunities(node->right, opportunities); | 23 CollectAllOpportunities(node->right, opportunities); |
24 } | 24 } |
25 | 25 |
26 // Creates layout opportunity from the provided space and the origin point. | 26 // Creates layout opportunity from the provided space and the origin point. |
27 NGLayoutOpportunity CreateLayoutOpportunityFromConstraintSpace( | 27 NGLayoutOpportunity CreateLayoutOpportunityFromConstraintSpace( |
28 const NGConstraintSpace& space, | 28 const NGConstraintSpace& space, |
29 const NGLogicalOffset& origin_point) { | 29 const NGLogicalOffset& origin_point) { |
30 NGLayoutOpportunity opportunity; | 30 NGLayoutOpportunity opportunity; |
31 opportunity.offset = space.Offset(); | 31 opportunity.offset = space.Offset(); |
32 opportunity.size = space.Size(); | 32 opportunity.size = space.AvailableSize(); |
cbiesinger
2016/11/18 23:44:23
Why is this correct?
Gleb Lanbin
2016/11/19 04:20:47
Acknowledged.
| |
33 | 33 |
34 // adjust to the origin_point. | 34 // adjust to the origin_point. |
35 opportunity.offset += origin_point; | 35 opportunity.offset += origin_point; |
36 opportunity.size.inline_size -= origin_point.inline_offset; | 36 opportunity.size.inline_size -= origin_point.inline_offset; |
37 opportunity.size.block_size -= origin_point.block_offset; | 37 opportunity.size.block_size -= origin_point.block_offset; |
38 return opportunity; | 38 return opportunity; |
39 } | 39 } |
40 | 40 |
41 // Whether 2 edges overlap with each other. | 41 // Whether 2 edges overlap with each other. |
42 bool IsOverlapping(const NGEdge& edge1, const NGEdge& edge2) { | 42 bool IsOverlapping(const NGEdge& edge1, const NGEdge& edge2) { |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 | 286 |
287 const NGLayoutOpportunity NGLayoutOpportunityIterator::Next() { | 287 const NGLayoutOpportunity NGLayoutOpportunityIterator::Next() { |
288 if (opportunity_iter_ == opportunities_.end()) | 288 if (opportunity_iter_ == opportunities_.end()) |
289 return NGLayoutOpportunity(); | 289 return NGLayoutOpportunity(); |
290 auto* opportunity = opportunity_iter_; | 290 auto* opportunity = opportunity_iter_; |
291 opportunity_iter_++; | 291 opportunity_iter_++; |
292 return NGLayoutOpportunity(*opportunity); | 292 return NGLayoutOpportunity(*opportunity); |
293 } | 293 } |
294 | 294 |
295 } // namespace blink | 295 } // namespace blink |
OLD | NEW |