| 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 NGLayoutAlgorithm_h | 5 #ifndef NGLayoutAlgorithm_h |
| 6 #define NGLayoutAlgorithm_h | 6 #define NGLayoutAlgorithm_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
| 10 #include "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class NGConstraintSpace; | 14 class NGConstraintSpace; |
| 15 class NGFragment; | 15 class NGFragment; |
| 16 | 16 |
| 17 // Base class for all LayoutNG algorithms. | 17 // Base class for all LayoutNG algorithms. |
| 18 class CORE_EXPORT NGLayoutAlgorithm { | 18 class CORE_EXPORT NGLayoutAlgorithm |
| 19 : public GarbageCollectedFinalized<NGLayoutAlgorithm> { |
| 19 WTF_MAKE_NONCOPYABLE(NGLayoutAlgorithm); | 20 WTF_MAKE_NONCOPYABLE(NGLayoutAlgorithm); |
| 20 USING_FAST_MALLOC(NGLayoutAlgorithm); | |
| 21 | 21 |
| 22 public: | 22 public: |
| 23 NGLayoutAlgorithm() {} | 23 NGLayoutAlgorithm() {} |
| 24 virtual ~NGLayoutAlgorithm() {} |
| 24 | 25 |
| 25 // Actual layout function. Lays out the children and descendents within the | 26 // Actual layout function. Lays out the children and descendents within the |
| 26 // constraints given by the NGConstraintSpace. Returns a fragment with the | 27 // constraints given by the NGConstraintSpace. Returns a fragment with the |
| 27 // resulting layout information. | 28 // resulting layout information. |
| 28 // This function can not be const because for interruptible layout, we have | 29 // This function can not be const because for interruptible layout, we have |
| 29 // to be able to store state information. | 30 // to be able to store state information. |
| 30 // Returns true when done; when this function returns false, it has to be | 31 // Returns true when done; when this function returns false, it has to be |
| 31 // called again. The out parameter will only be set when this function | 32 // called again. The out parameter will only be set when this function |
| 32 // returns true. The same constraint space has to be passed each time. | 33 // returns true. The same constraint space has to be passed each time. |
| 33 // TODO(layout-ng): Should we have a StartLayout function to avoid passing | 34 // TODO(layout-ng): Should we have a StartLayout function to avoid passing |
| 34 // the same space for each Layout iteration? | 35 // the same space for each Layout iteration? |
| 35 virtual bool Layout(const NGConstraintSpace*, NGFragment**) = 0; | 36 virtual bool Layout(const NGConstraintSpace*, NGFragment**) = 0; |
| 37 |
| 38 DEFINE_INLINE_VIRTUAL_TRACE() {} |
| 36 }; | 39 }; |
| 37 | 40 |
| 38 } // namespace blink | 41 } // namespace blink |
| 39 | 42 |
| 40 #endif // NGLayoutAlgorithm_h | 43 #endif // NGLayoutAlgorithm_h |
| OLD | NEW |