Chromium Code Reviews| 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 #ifndef NGInlineLayoutAlgorithm_h | 5 #ifndef NGInlineLayoutAlgorithm_h |
| 6 #define NGInlineLayoutAlgorithm_h | 6 #define NGInlineLayoutAlgorithm_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/layout/ng/ng_layout_algorithm.h" | 9 #include "core/layout/ng/ng_layout_algorithm.h" |
| 10 #include "wtf/RefPtr.h" | 10 #include "wtf/RefPtr.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class ComputedStyle; | 14 class ComputedStyle; |
| 15 class NGBreakToken; | 15 class NGBreakToken; |
| 16 class NGConstraintSpace; | 16 class NGConstraintSpace; |
| 17 class NGFragmentBuilder; | 17 class NGFragmentBuilder; |
| 18 class NGInlineNode; | 18 class NGInlineNode; |
| 19 class NGLineBuilder; | |
| 20 | 19 |
| 21 // A class for inline layout (e.g. a anonymous block with inline-level children | 20 // A class for inline layout (e.g. a anonymous block with inline-level children |
| 22 // only). | 21 // only). |
| 23 // | 22 // |
| 24 // This algorithm may at some point be merged with NGBlockLayoutAlgorithm in | 23 // This algorithm may at some point be merged with NGBlockLayoutAlgorithm in |
| 25 // the future. Currently it exists as its own class to simplify the LayoutNG | 24 // the future. Currently it exists as its own class to simplify the LayoutNG |
| 26 // transition period. | 25 // transition period. |
| 27 class CORE_EXPORT NGInlineLayoutAlgorithm : public NGLayoutAlgorithm { | 26 class CORE_EXPORT NGInlineLayoutAlgorithm : public NGLayoutAlgorithm { |
| 28 public: | 27 public: |
| 29 // Default constructor. | 28 // Default constructor. |
| 30 // @param style Style reference of the block that is being laid out. | 29 // @param style Style reference of the block that is being laid out. |
| 31 // @param first_child Our first child; the algorithm will use its NextSibling | 30 // @param first_child Our first child; the algorithm will use its NextSibling |
| 32 // method to access all the children. | 31 // method to access all the children. |
| 33 // @param space The constraint space which the algorithm should generate a | 32 // @param space The constraint space which the algorithm should generate a |
| 34 // fragment within. | 33 // fragment within. |
| 35 NGInlineLayoutAlgorithm(PassRefPtr<const ComputedStyle>, | 34 NGInlineLayoutAlgorithm(PassRefPtr<const ComputedStyle>, |
| 36 NGInlineNode* first_child, | 35 NGInlineNode* first_child, |
| 37 NGConstraintSpace* space, | 36 NGConstraintSpace* space, |
| 38 NGBreakToken* break_token = nullptr); | 37 NGBreakToken* break_token = nullptr); |
| 39 | 38 |
| 40 NGPhysicalFragment* Layout() override; | 39 NGPhysicalFragment* Layout() override; |
| 41 | 40 |
| 42 DECLARE_VIRTUAL_TRACE(); | 41 DECLARE_VIRTUAL_TRACE(); |
| 43 | 42 |
| 44 private: | 43 private: |
| 45 // Read-only Getters. | 44 // Read-only Getters. |
| 46 const ComputedStyle& Style() const { return *style_; } | 45 const ComputedStyle& Style() const { return *style_; } |
| 47 | 46 |
| 48 bool LayoutCurrentChild(); | 47 bool LayoutCurrentChild(); |
|
ikilpatrick
2017/01/23 23:21:36
can you remove this? i forgot to in an earlier pat
atotic
2017/01/23 23:31:21
done
| |
| 49 NGConstraintSpace* CreateConstraintSpaceForCurrentChild() const; | 48 NGConstraintSpace* CreateConstraintSpaceForCurrentChild( |
|
ikilpatrick
2017/01/23 23:21:36
can you rename this to:
CreateConstraintSpaceForCh
atotic
2017/01/23 23:31:21
done
| |
| 49 const NGInlineNode& current_child) const; | |
| 50 | 50 |
| 51 RefPtr<const ComputedStyle> style_; | 51 RefPtr<const ComputedStyle> style_; |
| 52 Member<NGInlineNode> first_child_; | 52 Member<NGInlineNode> first_child_; |
| 53 Member<NGConstraintSpace> constraint_space_; | 53 Member<NGConstraintSpace> constraint_space_; |
| 54 Member<NGBreakToken> break_token_; | 54 Member<NGBreakToken> break_token_; |
| 55 Member<NGFragmentBuilder> builder_; | 55 Member<NGFragmentBuilder> builder_; |
| 56 Member<NGConstraintSpace> space_for_current_child_; | |
| 57 Member<NGInlineNode> current_child_; | |
| 58 Member<NGLineBuilder> line_builder_; | |
| 59 }; | 56 }; |
| 60 | 57 |
| 61 } // namespace blink | 58 } // namespace blink |
| 62 | 59 |
| 63 #endif // NGInlineLayoutAlgorithm_h | 60 #endif // NGInlineLayoutAlgorithm_h |
| OLD | NEW |