| 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 FindPaintOffsetAndVisualRectNeedingUpdate_h | 5 #ifndef FindPaintOffsetAndVisualRectNeedingUpdate_h |
| 6 #define FindPaintOffsetAndVisualRectNeedingUpdate_h | 6 #define FindPaintOffsetAndVisualRectNeedingUpdate_h |
| 7 | 7 |
| 8 #if DCHECK_IS_ON() | 8 #if DCHECK_IS_ON() |
| 9 | 9 |
| 10 #include "core/layout/LayoutObject.h" | 10 #include "core/layout/LayoutObject.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 const LayoutObject& object_; | 54 const LayoutObject& object_; |
| 55 const bool& is_actually_needed_; | 55 const bool& is_actually_needed_; |
| 56 LayoutPoint old_paint_offset_; | 56 LayoutPoint old_paint_offset_; |
| 57 RefPtr<const TransformPaintPropertyNode> old_paint_offset_translation_; | 57 RefPtr<const TransformPaintPropertyNode> old_paint_offset_translation_; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 class FindVisualRectNeedingUpdateScopeBase { | 60 class FindVisualRectNeedingUpdateScopeBase { |
| 61 protected: | 61 protected: |
| 62 FindVisualRectNeedingUpdateScopeBase(const LayoutObject& object, | 62 FindVisualRectNeedingUpdateScopeBase(const LayoutObject& object, |
| 63 const PaintInvalidatorContext& context, | 63 const PaintInvalidatorContext& context, |
| 64 const LayoutRect& old_visual_rect) | 64 const LayoutRect& old_visual_rect, |
| 65 bool is_actually_needed) |
| 65 : object_(object), | 66 : object_(object), |
| 66 context_(context), | 67 context_(context), |
| 67 old_visual_rect_(old_visual_rect), | 68 old_visual_rect_(old_visual_rect), |
| 68 needed_visual_rect_update_(context.NeedsVisualRectUpdate(object)) { | 69 needed_visual_rect_update_(context.NeedsVisualRectUpdate(object)) { |
| 69 if (needed_visual_rect_update_) { | 70 if (needed_visual_rect_update_) { |
| 70 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() || | 71 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() || |
| 71 (context.tree_builder_context_ && | 72 is_actually_needed); |
| 72 context.tree_builder_context_->is_actually_needed)); | |
| 73 return; | 73 return; |
| 74 } | 74 } |
| 75 context.force_visual_rect_update_for_checking_ = true; | 75 context.force_visual_rect_update_for_checking_ = true; |
| 76 DCHECK(context.NeedsVisualRectUpdate(object)); | 76 DCHECK(context.NeedsVisualRectUpdate(object)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 ~FindVisualRectNeedingUpdateScopeBase() { | 79 ~FindVisualRectNeedingUpdateScopeBase() { |
| 80 context_.force_visual_rect_update_for_checking_ = false; | 80 context_.force_visual_rect_update_for_checking_ = false; |
| 81 DCHECK_EQ(needed_visual_rect_update_, | 81 DCHECK_EQ(needed_visual_rect_update_, |
| 82 context_.NeedsVisualRectUpdate(object_)); | 82 context_.NeedsVisualRectUpdate(object_)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // For updates of visual rects (e.g. of scroll controls, caret, selection,etc.) | 117 // For updates of visual rects (e.g. of scroll controls, caret, selection,etc.) |
| 118 // contained by an object. | 118 // contained by an object. |
| 119 class FindVisualRectNeedingUpdateScope : FindVisualRectNeedingUpdateScopeBase { | 119 class FindVisualRectNeedingUpdateScope : FindVisualRectNeedingUpdateScopeBase { |
| 120 public: | 120 public: |
| 121 FindVisualRectNeedingUpdateScope(const LayoutObject& object, | 121 FindVisualRectNeedingUpdateScope(const LayoutObject& object, |
| 122 const PaintInvalidatorContext& context, | 122 const PaintInvalidatorContext& context, |
| 123 const LayoutRect& old_visual_rect, | 123 const LayoutRect& old_visual_rect, |
| 124 // Must be a reference to a rect that | 124 // Must be a reference to a rect that |
| 125 // outlives this scope. | 125 // outlives this scope. |
| 126 const LayoutRect& new_visual_rect) | 126 const LayoutRect& new_visual_rect) |
| 127 : FindVisualRectNeedingUpdateScopeBase(object, context, old_visual_rect), | 127 : FindVisualRectNeedingUpdateScopeBase( |
| 128 object, |
| 129 context, |
| 130 old_visual_rect, |
| 131 context.tree_builder_context_actually_needed_), |
| 128 new_visual_rect_ref_(new_visual_rect) {} | 132 new_visual_rect_ref_(new_visual_rect) {} |
| 129 | 133 |
| 130 ~FindVisualRectNeedingUpdateScope() { CheckVisualRect(new_visual_rect_ref_); } | 134 ~FindVisualRectNeedingUpdateScope() { CheckVisualRect(new_visual_rect_ref_); } |
| 131 | 135 |
| 132 private: | 136 private: |
| 133 const LayoutRect& new_visual_rect_ref_; | 137 const LayoutRect& new_visual_rect_ref_; |
| 134 }; | 138 }; |
| 135 | 139 |
| 136 // For updates of object visual rect and location. | 140 // For updates of object visual rect and location. |
| 137 class FindObjectVisualRectNeedingUpdateScope | 141 class FindObjectVisualRectNeedingUpdateScope |
| 138 : FindVisualRectNeedingUpdateScopeBase { | 142 : FindVisualRectNeedingUpdateScopeBase { |
| 139 public: | 143 public: |
| 140 FindObjectVisualRectNeedingUpdateScope(const LayoutObject& object, | 144 FindObjectVisualRectNeedingUpdateScope(const LayoutObject& object, |
| 141 const PaintInvalidatorContext& context) | 145 const PaintInvalidatorContext& context, |
| 146 bool is_actually_needed) |
| 142 : FindVisualRectNeedingUpdateScopeBase(object, | 147 : FindVisualRectNeedingUpdateScopeBase(object, |
| 143 context, | 148 context, |
| 144 object.VisualRect()), | 149 object.VisualRect(), |
| 150 is_actually_needed), |
| 145 old_location_(ObjectPaintInvalidator(object).LocationInBacking()) {} | 151 old_location_(ObjectPaintInvalidator(object).LocationInBacking()) {} |
| 146 | 152 |
| 147 ~FindObjectVisualRectNeedingUpdateScope() { | 153 ~FindObjectVisualRectNeedingUpdateScope() { |
| 148 CheckVisualRect(object_.VisualRect()); | 154 CheckVisualRect(object_.VisualRect()); |
| 149 CheckLocation(); | 155 CheckLocation(); |
| 150 } | 156 } |
| 151 | 157 |
| 152 void CheckLocation() { | 158 void CheckLocation() { |
| 153 if (needed_visual_rect_update_) | 159 if (needed_visual_rect_update_) |
| 154 return; | 160 return; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 171 | 177 |
| 172 private: | 178 private: |
| 173 LayoutPoint old_location_; | 179 LayoutPoint old_location_; |
| 174 }; | 180 }; |
| 175 | 181 |
| 176 } // namespace blink | 182 } // namespace blink |
| 177 | 183 |
| 178 #endif // DCHECK_IS_ON() | 184 #endif // DCHECK_IS_ON() |
| 179 | 185 |
| 180 #endif // FindPaintOffsetAndVisualRectNeedingUpdate_h | 186 #endif // FindPaintOffsetAndVisualRectNeedingUpdate_h |
| OLD | NEW |