Index: third_party/WebKit/Source/core/editing/FrameSelection.h |
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.h b/third_party/WebKit/Source/core/editing/FrameSelection.h |
index 0ff79f1a61b23a17695589cfb12ca4cb2d7a25c8..c7eb81ced0daab9ce36083f8de9a40bedd4dcd3a 100644 |
--- a/third_party/WebKit/Source/core/editing/FrameSelection.h |
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.h |
@@ -27,6 +27,7 @@ |
#ifndef FrameSelection_h |
#define FrameSelection_h |
+#include <memory> |
#include "core/CoreExport.h" |
#include "core/dom/Range.h" |
#include "core/dom/SynchronousMutationObserver.h" |
@@ -38,9 +39,9 @@ |
#include "platform/Timer.h" |
#include "platform/geometry/IntRect.h" |
#include "platform/geometry/LayoutRect.h" |
+#include "platform/graphics/PaintInvalidationReason.h" |
#include "platform/heap/Handle.h" |
#include "wtf/Noncopyable.h" |
-#include <memory> |
namespace blink { |
@@ -56,6 +57,7 @@ class SelectionEditor; |
class PendingSelection; |
class Text; |
class TextIteratorBehavior; |
+struct PaintInvalidatorContext; |
enum class CursorAlignOnScroll { IfNeeded, Always }; |
@@ -189,9 +191,9 @@ class CORE_EXPORT FrameSelection final |
Position start() const { return selection().start(); } |
Position end() const { return selection().end(); } |
- // Returns true if specified layout block has caret. This function is |
- // called during InRecalStyle and InPaint. |
- bool hasCaretIn(const LayoutBlock&) const; |
+ // Returns true if specified layout block should paint caret. This function is |
+ // called during painting only. |
+ bool shouldPaintCaret(const LayoutBlock&) const; |
// Bounds of (possibly transformed) caret in absolute coords |
IntRect absoluteCaretBounds(); |
@@ -210,15 +212,22 @@ class CORE_EXPORT FrameSelection final |
Range* firstRange() const; |
void documentAttached(Document*); |
- void dataWillChange(const CharacterData& node); |
void didLayout(); |
bool isAppearanceDirty() const; |
void commitAppearanceIfNeeded(LayoutView&); |
void setCaretVisible(bool caretIsVisible); |
- void setCaretRectNeedsUpdate(); |
void scheduleVisualUpdate() const; |
- void invalidateCaretRect(bool forceInvalidation = false); |
+ void scheduleVisualUpdateForPaintInvalidationIfNeeded() const; |
+ |
+ // Paint invalidation methods delegating to FrameCaret. |
+ void clearPreviousCaretVisualRect(const LayoutBlock&); |
+ void layoutBlockWillBeDestroyed(const LayoutBlock&); |
+ void updateStyleAndLayoutIfNeeded(); |
+ void invalidatePaintIfNeeded(const LayoutBlock&, |
+ const PaintInvalidatorContext&, |
+ PaintInvalidationReason); |
+ |
void paintCaret(GraphicsContext&, const LayoutPoint&); |
// Used to suspend caret blinking while the mouse is down. |
@@ -280,6 +289,7 @@ class CORE_EXPORT FrameSelection final |
DECLARE_TRACE(); |
private: |
+ friend class BlockPaintInvalidatorTest; |
friend class FrameSelectionTest; |
friend class PaintControllerPaintTestForSlimmingPaintV1AndV2; |
friend class SelectionControllerTest; |
@@ -288,7 +298,6 @@ class CORE_EXPORT FrameSelection final |
explicit FrameSelection(LocalFrame&); |
- // For |PaintControllerPaintTestForSlimmingPaintV1AndV2|. |
const DisplayItemClient& caretDisplayItemClientForTesting() const; |
// Note: We have |selectionInFlatTree()| for unit tests, we should |
@@ -335,10 +344,6 @@ class CORE_EXPORT FrameSelection final |
unsigned oldLength) final; |
void didSplitTextNode(const Text& oldNode) final; |
- // For unittests |
- bool shouldPaintCaretForTesting() const; |
- bool isPreviousCaretDirtyForTesting() const; |
- |
Member<LocalFrame> m_frame; |
const Member<PendingSelection> m_pendingSelection; |
const Member<SelectionEditor> m_selectionEditor; |