OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "core/layout/ng/ng_physical_constraint_space.h" | |
6 | |
7 namespace blink { | |
8 | |
9 NGPhysicalConstraintSpace::NGPhysicalConstraintSpace( | |
10 NGPhysicalSize available_size, | |
11 NGPhysicalSize percentage_resolution_size, | |
12 bool fixed_width, | |
13 bool fixed_height, | |
14 bool width_direction_triggers_scrollbar, | |
15 bool height_direction_triggers_scrollbar, | |
16 NGFragmentationType width_direction_fragmentation_type, | |
17 NGFragmentationType height_direction_fragmentation_type, | |
18 bool is_new_fc) | |
19 : available_size_(available_size), | |
20 percentage_resolution_size_(percentage_resolution_size), | |
21 fixed_width_(fixed_width), | |
22 fixed_height_(fixed_height), | |
23 width_direction_triggers_scrollbar_(width_direction_triggers_scrollbar), | |
24 height_direction_triggers_scrollbar_(height_direction_triggers_scrollbar), | |
25 width_direction_fragmentation_type_(width_direction_fragmentation_type), | |
26 height_direction_fragmentation_type_(height_direction_fragmentation_type), | |
27 is_new_fc_(is_new_fc), | |
28 last_left_float_exclusion_(nullptr), | |
29 last_right_float_exclusion_(nullptr) {} | |
30 | |
31 void NGPhysicalConstraintSpace::AddExclusion(const NGExclusion& exclusion) { | |
32 NGExclusion* exclusion_ptr = new NGExclusion(exclusion); | |
33 exclusions_.append(WTF::wrapUnique(exclusion_ptr)); | |
34 if (exclusion.type == NGExclusion::kFloatLeft) { | |
35 last_left_float_exclusion_ = exclusions_.rbegin()->get(); | |
36 } else if (exclusion.type == NGExclusion::kFloatRight) { | |
37 last_right_float_exclusion_ = exclusions_.rbegin()->get(); | |
38 } | |
39 } | |
40 | |
41 const Vector<std::unique_ptr<const NGExclusion>>& | |
42 NGPhysicalConstraintSpace::Exclusions(unsigned options) const { | |
43 // TODO(layout-ng): Filter based on options? Perhaps layout Opportunities | |
44 // should filter instead? | |
45 return exclusions_; | |
46 } | |
47 | |
48 } // namespace blink | |
OLD | NEW |