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