| 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 NGPhysicalFragment_h | 5 #ifndef NGPhysicalFragment_h |
| 6 #define NGPhysicalFragment_h | 6 #define NGPhysicalFragment_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/layout/ng/ng_units.h" | 9 #include "core/layout/ng/ng_units.h" |
| 10 #include "platform/LayoutUnit.h" | 10 #include "platform/LayoutUnit.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // such that paint/hit-testing/etc don't modify it. | 26 // such that paint/hit-testing/etc don't modify it. |
| 27 // | 27 // |
| 28 // Layout code should only access geometry information through the | 28 // Layout code should only access geometry information through the |
| 29 // NGFragment wrapper classes which transforms information into the logical | 29 // NGFragment wrapper classes which transforms information into the logical |
| 30 // coordinate system. | 30 // coordinate system. |
| 31 class CORE_EXPORT NGPhysicalFragment : public RefCounted<NGPhysicalFragment> { | 31 class CORE_EXPORT NGPhysicalFragment : public RefCounted<NGPhysicalFragment> { |
| 32 public: | 32 public: |
| 33 enum NGFragmentType { kFragmentBox = 0, kFragmentText = 1 }; | 33 enum NGFragmentType { kFragmentBox = 0, kFragmentText = 1 }; |
| 34 | 34 |
| 35 NGFragmentType Type() const { return static_cast<NGFragmentType>(type_); } | 35 NGFragmentType Type() const { return static_cast<NGFragmentType>(type_); } |
| 36 bool IsBox() const { return Type() == NGFragmentType::kFragmentBox; } |
| 37 bool IsText() const { return Type() == NGFragmentType::kFragmentText; } |
| 36 | 38 |
| 37 // Override RefCounted's deref() to ensure operator delete is called on the | 39 // Override RefCounted's deref() to ensure operator delete is called on the |
| 38 // appropriate subclass type. | 40 // appropriate subclass type. |
| 39 void deref() const { | 41 void deref() const { |
| 40 if (derefBase()) | 42 if (derefBase()) |
| 41 destroy(); | 43 destroy(); |
| 42 } | 44 } |
| 43 | 45 |
| 44 // The accessors in this class shouldn't be used by layout code directly, | 46 // The accessors in this class shouldn't be used by layout code directly, |
| 45 // instead should be accessed by the NGFragmentBase classes. These accessors | 47 // instead should be accessed by the NGFragmentBase classes. These accessors |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 unsigned type_ : 1; | 105 unsigned type_ : 1; |
| 104 unsigned is_placed_ : 1; | 106 unsigned is_placed_ : 1; |
| 105 | 107 |
| 106 private: | 108 private: |
| 107 void destroy() const; | 109 void destroy() const; |
| 108 }; | 110 }; |
| 109 | 111 |
| 110 } // namespace blink | 112 } // namespace blink |
| 111 | 113 |
| 112 #endif // NGPhysicalFragment_h | 114 #endif // NGPhysicalFragment_h |
| OLD | NEW |