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

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

Issue 1958093002: CONTINUED Make FrameSelection to hold non-canonicalized positions Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2017-01-16T20:04:35 Created 3 years, 11 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/FrameCaret.h
diff --git a/third_party/WebKit/Source/core/editing/FrameCaret.h b/third_party/WebKit/Source/core/editing/FrameCaret.h
index 6da45f284cc29f09678b52fe1475ebdfb809faa7..4b3e27825e2219819878dd6a2292b2748e9efe4d 100644
--- a/third_party/WebKit/Source/core/editing/FrameCaret.h
+++ b/third_party/WebKit/Source/core/editing/FrameCaret.h
@@ -27,22 +27,42 @@
#define FrameCaret_h
#include "core/CoreExport.h"
-#include "core/editing/CaretBase.h"
-#include "platform/geometry/IntRect.h"
+#include "core/dom/SynchronousMutationObserver.h"
+#include "core/editing/PositionWithAffinity.h"
+#include "platform/Timer.h"
+#include "platform/geometry/LayoutRect.h"
+#include "platform/heap/GarbageCollected.h"
+#include "platform/heap/Member.h"
+#include "wtf/Noncopyable.h"
+#include <memory>
namespace blink {
+class CaretBase;
+class CharacterData;
+class DisplayItemClient;
+class Document;
+class GraphicsContext;
+class Node;
+class LocalFrame;
class SelectionEditor;
enum class CaretVisibility { Visible, Hidden };
-class CORE_EXPORT FrameCaret final : public CaretBase {
+class CORE_EXPORT FrameCaret final
+ : public GarbageCollectedFinalized<FrameCaret>,
+ public SynchronousMutationObserver {
+ WTF_MAKE_NONCOPYABLE(FrameCaret);
+ USING_GARBAGE_COLLECTED_MIXIN(FrameCaret);
+
public:
FrameCaret(LocalFrame&, const SelectionEditor&);
- ~FrameCaret() override;
+ ~FrameCaret();
+ const DisplayItemClient& displayItemClient() const;
bool isActive() const { return caretPosition().isNotNull(); }
+ void documentAttached(Document*);
void updateAppearance();
// Used to suspend caret blinking while the mouse is down.
@@ -54,7 +74,7 @@ class CORE_EXPORT FrameCaret final : public CaretBase {
void startBlinkCaret();
void setCaretVisibility(CaretVisibility);
- bool isCaretBoundsDirty() const { return m_caretRectDirty; }
+ bool isCaretBoundsDirty() const { return m_didScheduleUpdate; }
void setCaretRectNeedsUpdate();
// If |forceInvalidation| is true the caret's previous and new rectangles
// are forcibly invalidated regardless of the state of the blink timer.
@@ -66,16 +86,11 @@ class CORE_EXPORT FrameCaret final : public CaretBase {
void paintCaret(GraphicsContext&, const LayoutPoint&);
- void dataWillChange(const CharacterData&);
- void nodeWillBeRemoved(Node&);
-
- void documentDetached();
-
// For unittests
bool shouldPaintCaretForTesting() const { return m_shouldPaintCaret; }
bool isPreviousCaretDirtyForTesting() const { return m_previousCaretNode; }
- DECLARE_VIRTUAL_TRACE();
+ DECLARE_TRACE();
private:
friend class FrameSelectionTest;
@@ -86,18 +101,27 @@ class CORE_EXPORT FrameCaret final : public CaretBase {
void caretBlinkTimerFired(TimerBase*);
bool caretPositionIsValidForDocument(const Document&) const;
+ // Implementation of |SynchronousMutationObserver| member functions.
+ void contextDestroyed(Document*) final;
+ void nodeWillBeRemoved(Node&) final;
+
+ // TODO(yosin): We should get rid of |dataWillChange()|.
+ void dataWillChange(const CharacterData&);
+
const Member<const SelectionEditor> m_selectionEditor;
const Member<LocalFrame> m_frame;
+ const std::unique_ptr<CaretBase> m_caretBase;
// The last node which painted the caret. Retained for clearing the old
// caret when it moves.
Member<Node> m_previousCaretNode;
Member<Node> m_previousCaretAnchorNode;
LayoutRect m_previousCaretRect;
+ Color m_previousCaretColor;
CaretVisibility m_caretVisibility;
CaretVisibility m_previousCaretVisibility;
// TODO(https://crbug.com/668758): Consider using BeginFrame update for this.
TaskRunnerTimer<FrameCaret> m_caretBlinkTimer;
- bool m_caretRectDirty : 1;
+ bool m_didScheduleUpdate : 1;
bool m_shouldPaintCaret : 1;
bool m_isCaretBlinkingSuspended : 1;
bool m_shouldShowBlockCursor : 1;
« no previous file with comments | « third_party/WebKit/Source/core/editing/DragCaretController.cpp ('k') | third_party/WebKit/Source/core/editing/FrameCaret.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698