| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 FragmentData_h | 5 #ifndef FragmentData_h |
| 6 #define FragmentData_h | 6 #define FragmentData_h |
| 7 | 7 |
| 8 #include "core/paint/ClipRects.h" |
| 8 #include "core/paint/ObjectPaintProperties.h" | 9 #include "core/paint/ObjectPaintProperties.h" |
| 10 #include "platform/RuntimeEnabledFeatures.h" |
| 9 | 11 |
| 10 namespace blink { | 12 namespace blink { |
| 11 | 13 |
| 12 class ObjectPaintProperties; | 14 class ObjectPaintProperties; |
| 13 | 15 |
| 14 // Represents the data for a particular fragment of a LayoutObject. | 16 // Represents the data for a particular fragment of a LayoutObject. |
| 15 // Only LayoutObjects with a self-painting PaintLayer may have more than one | 17 // Only LayoutObjects with a self-painting PaintLayer may have more than one |
| 16 // FragmentDeta, and even then only when they are inside of multicol. | 18 // FragmentDeta, and even then only when they are inside of multicol. |
| 17 // See README.md. | 19 // See README.md. |
| 18 class CORE_EXPORT FragmentData { | 20 class CORE_EXPORT FragmentData { |
| 19 public: | 21 public: |
| 20 static std::unique_ptr<FragmentData> Create() { | 22 static std::unique_ptr<FragmentData> Create() { |
| 21 return WTF::WrapUnique(new FragmentData()); | 23 return WTF::WrapUnique(new FragmentData()); |
| 22 } | 24 } |
| 23 | 25 |
| 24 ObjectPaintProperties* PaintProperties() const { | 26 ObjectPaintProperties* PaintProperties() const { |
| 25 return paint_properties_.get(); | 27 return paint_properties_.get(); |
| 26 } | 28 } |
| 27 ObjectPaintProperties& EnsurePaintProperties(); | 29 ObjectPaintProperties& EnsurePaintProperties(); |
| 28 void ClearPaintProperties(); | 30 void ClearPaintProperties(); |
| 29 | 31 |
| 32 ClipRects* PreviousClipRects() const { |
| 33 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); |
| 34 return previous_clip_rects_.Get(); |
| 35 } |
| 36 void SetPreviousClipRects(ClipRects& clip_rects) { |
| 37 previous_clip_rects_ = &clip_rects; |
| 38 } |
| 39 void ClearPreviousClipRects() { previous_clip_rects_.Clear(); } |
| 40 |
| 30 FragmentData* NextFragment() { return next_fragment_.get(); } | 41 FragmentData* NextFragment() { return next_fragment_.get(); } |
| 31 | 42 |
| 32 private: | 43 private: |
| 33 // Holds references to the paint property nodes created by this object. | 44 // Holds references to the paint property nodes created by this object. |
| 34 std::unique_ptr<ObjectPaintProperties> paint_properties_; | 45 std::unique_ptr<ObjectPaintProperties> paint_properties_; |
| 35 | 46 |
| 47 // These are used to detect changes to clipping that might invalidate |
| 48 // subsequence caching or paint phase optimizations. |
| 49 RefPtr<ClipRects> previous_clip_rects_; |
| 50 |
| 36 std::unique_ptr<FragmentData> next_fragment_; | 51 std::unique_ptr<FragmentData> next_fragment_; |
| 37 }; | 52 }; |
| 38 | 53 |
| 39 } // namespace blink | 54 } // namespace blink |
| 40 | 55 |
| 41 #endif // FragmentData_h | 56 #endif // FragmentData_h |
| OLD | NEW |