| 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 BlockPaintInvalidator_h | 5 #ifndef BlockPaintInvalidator_h |
| 6 #define BlockPaintInvalidator_h | 6 #define BlockPaintInvalidator_h |
| 7 | 7 |
| 8 #include "platform/graphics/PaintInvalidationReason.h" | 8 #include "platform/graphics/PaintInvalidationReason.h" |
| 9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 struct PaintInvalidatorContext; | 13 struct PaintInvalidatorContext; |
| 14 class LayoutBlock; | 14 class LayoutBlock; |
| 15 class LayoutRect; |
| 16 class LocalFrame; |
| 17 class DisplayItemClient; |
| 15 | 18 |
| 16 class BlockPaintInvalidator { | 19 class BlockPaintInvalidator { |
| 17 STACK_ALLOCATED(); | 20 STACK_ALLOCATED(); |
| 18 | 21 |
| 19 public: | 22 public: |
| 20 BlockPaintInvalidator(const LayoutBlock& block, | 23 BlockPaintInvalidator(const LayoutBlock& block, |
| 21 const PaintInvalidatorContext& context) | 24 const PaintInvalidatorContext& context) |
| 22 : m_block(block), m_context(context) {} | 25 : m_block(block), m_context(context) {} |
| 23 | 26 |
| 27 static void blockWillBeDestroyed(const LayoutBlock&); |
| 28 |
| 29 // Called before paint invalidation tree walk to ensure that the blocks whose |
| 30 // caret status changed will be reached during the tree walk. |
| 31 static void setMayNeedPaintInvalidationForCaretsIfNeeded( |
| 32 const LocalFrame& localFrameRoot); |
| 33 |
| 24 PaintInvalidationReason invalidatePaintIfNeeded(); | 34 PaintInvalidationReason invalidatePaintIfNeeded(); |
| 25 | 35 |
| 36 static void clearPreviousCaretVisualRects(const LayoutBlock&); |
| 37 |
| 26 private: | 38 private: |
| 39 // Returns new visual rect. |
| 40 LayoutRect invalidateCaretIfNeeded(PaintInvalidationReason, |
| 41 const LayoutRect& oldVisualRect, |
| 42 const LayoutRect& newLocalRect, |
| 43 const DisplayItemClient&); |
| 44 void invalidateCaretsIfNeeded(PaintInvalidationReason); |
| 45 |
| 27 const LayoutBlock& m_block; | 46 const LayoutBlock& m_block; |
| 28 const PaintInvalidatorContext& m_context; | 47 const PaintInvalidatorContext& m_context; |
| 29 }; | 48 }; |
| 30 | 49 |
| 31 } // namespace blink | 50 } // namespace blink |
| 32 | 51 |
| 33 #endif | 52 #endif |
| OLD | NEW |