Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Unified Diff: third_party/WebKit/Source/core/editing/FrameSelection.h

Issue 2665823002: Invalidate caret during paint invalidation (Closed)
Patch Set: NeedsRebaseline Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameCaret.cpp ('k') | third_party/WebKit/Source/core/editing/FrameSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698