| 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 | 12 |
| 11 namespace blink { | 13 namespace blink { |
| 12 | 14 |
| 13 class NGBreakToken; | |
| 14 class NGConstraintSpace; | 15 class NGConstraintSpace; |
| 15 class NGInlineNode; | 16 class NGInlineNode; |
| 16 class NGLineBuilder; | 17 class NGLineBuilder; |
| 17 | 18 |
| 18 // A class for text layout. This takes a NGInlineNode which consists only | 19 // A class for text layout. This takes a NGInlineNode which consists only |
| 19 // non-atomic inlines and produces NGTextFragments. | 20 // non-atomic inlines and produces NGTextFragments. |
| 20 // | 21 // |
| 21 // Unlike other layout algorithms this takes a NGInlineNode as its input instead | 22 // Unlike other layout algorithms this takes a NGInlineNode as its input instead |
| 22 // of the ComputedStyle as it operates over multiple inlines with different | 23 // of the ComputedStyle as it operates over multiple inlines with different |
| 23 // style. | 24 // style. |
| 24 class CORE_EXPORT NGTextLayoutAlgorithm : public NGLayoutAlgorithm { | 25 class CORE_EXPORT NGTextLayoutAlgorithm : public NGLayoutAlgorithm { |
| 25 public: | 26 public: |
| 26 // Default constructor. | 27 // Default constructor. |
| 27 // @param inline_box The inline box to produce fragments from. | 28 // @param inline_box The inline box to produce fragments from. |
| 28 // @param space The constraint space which the algorithm should generate a | 29 // @param space The constraint space which the algorithm should generate a |
| 29 // fragments within. | 30 // fragments within. |
| 30 NGTextLayoutAlgorithm(NGInlineNode* inline_box, | 31 NGTextLayoutAlgorithm(NGInlineNode* inline_box, |
| 31 NGConstraintSpace* space, | 32 NGConstraintSpace* space, |
| 32 NGBreakToken* break_token = nullptr); | 33 NGBreakToken* break_token = nullptr); |
| 33 | 34 |
| 34 NGPhysicalFragment* Layout() override; | 35 NGPhysicalFragment* Layout() override; |
| 35 void LayoutInline(NGLineBuilder*); | 36 void LayoutInline(NGLineBuilder*); |
| 36 | 37 |
| 37 DECLARE_VIRTUAL_TRACE(); | |
| 38 | |
| 39 private: | 38 private: |
| 40 Member<NGInlineNode> inline_box_; | 39 Persistent<NGInlineNode> inline_box_; |
| 41 Member<NGConstraintSpace> constraint_space_; | 40 Persistent<NGConstraintSpace> constraint_space_; |
| 42 Member<NGBreakToken> break_token_; | 41 Persistent<NGBreakToken> break_token_; |
| 43 | 42 |
| 44 friend class NGInlineNodeTest; | 43 friend class NGInlineNodeTest; |
| 45 }; | 44 }; |
| 46 | 45 |
| 47 DEFINE_TYPE_CASTS(NGTextLayoutAlgorithm, | |
| 48 NGLayoutAlgorithm, | |
| 49 algorithm, | |
| 50 algorithm->algorithmType() == kTextLayoutAlgorithm, | |
| 51 algorithm.algorithmType() == kTextLayoutAlgorithm); | |
| 52 | |
| 53 } // namespace blink | 46 } // namespace blink |
| 54 | 47 |
| 55 #endif // NGInlineLayoutAlgorithm_h | 48 #endif // NGInlineLayoutAlgorithm_h |
| OLD | NEW |