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

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

Issue 1994883002: [Editing][CodeHealth] Extract new FrameCaret class from FrameSelection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 4 years, 7 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
new file mode 100644
index 0000000000000000000000000000000000000000..d19a7c2b20ff87fcd66ef2e8033162ed86d99c74
--- /dev/null
+++ b/third_party/WebKit/Source/core/editing/FrameCaret.h
@@ -0,0 +1,58 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
yosin_UTC9 2016/05/19 08:32:36 Copyright text should be taken from FrameSelection
yoichio 2016/05/20 05:12:12 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef FrameCaret_h
+#define FrameCaret_h
+
+#include "core/editing/CaretBase.h"
+#include "core/editing/VisibleSelection.h"
+
+namespace blink {
+
+class FrameCaret : public CaretBase {
+public:
+ FrameCaret(LocalFrame*);
+ virtual ~FrameCaret() { }
yosin_UTC9 2016/05/19 08:32:36 Please put int .cpp as |FrameCaret::~FrameCaret()
yoichio 2016/05/20 05:12:12 Done.
+
+ // Used to suspend caret blinking while the mouse is down.
+ void setCaretBlinkingSuspended(bool suspended) { m_isCaretBlinkingSuspended = suspended; }
+ bool isCaretBlinkingSuspended() const { return m_isCaretBlinkingSuspended; }
+ void stopCaretBlinkTimer();
+ void startBlinkCaret();
+
+ bool isCaretBoundsDirty() const { return m_caretRectDirty; }
+ void setCaretRectNeedsUpdate();
+ void invalidateCaretRect(const VisibleSelection&);
+
+ void paintCaret(GraphicsContext&, const LayoutPoint&, const VisibleSelection&);
+
+ void dataWillChange(const CharacterData&);
+ void nodeWillBeRemoved(Node&);
+
+ void prepareForDestruction();
+
+ // For unittests
+ bool shouldPaintCaretForTesting() const { return m_shouldPaintCaret; }
+ bool isPreviousCaretDirtyForTesting() const { return m_previousCaretNode; }
+
+ DECLARE_VIRTUAL_TRACE();
+
+private:
+ void caretBlinkTimerFired(Timer<FrameCaret>*);
+
+ const Member<LocalFrame> m_frame;
+ // The last node which painted the caret. Retained for clearing the old
+ // caret when it moves.
+ Member<Node> m_previousCaretNode;
+ LayoutRect m_previousCaretRect;
+ CaretVisibility m_previousCaretVisibility;
+ Timer<FrameCaret> m_caretBlinkTimer;
+ bool m_caretRectDirty : 1;
+ bool m_shouldPaintCaret : 1;
+ bool m_isCaretBlinkingSuspended : 1;
+};
+
+} // namespace blink
+
+#endif // FrameCaret_h

Powered by Google App Engine
This is Rietveld 408576698