OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 class CORE_EXPORT FrameCaret final | 52 class CORE_EXPORT FrameCaret final |
53 : public GarbageCollectedFinalized<FrameCaret> { | 53 : public GarbageCollectedFinalized<FrameCaret> { |
54 public: | 54 public: |
55 FrameCaret(LocalFrame&, const SelectionEditor&); | 55 FrameCaret(LocalFrame&, const SelectionEditor&); |
56 ~FrameCaret(); | 56 ~FrameCaret(); |
57 | 57 |
58 const DisplayItemClient& displayItemClient() const; | 58 const DisplayItemClient& displayItemClient() const; |
59 bool isActive() const { return caretPosition().isNotNull(); } | 59 bool isActive() const { return caretPosition().isNotNull(); } |
60 | 60 |
61 void updateAppearance(); | 61 void scheduleVisualUpdateForPaintInvalidationIfNeeded(); |
62 | 62 |
63 // Used to suspend caret blinking while the mouse is down. | 63 // Used to suspend caret blinking while the mouse is down. |
64 void setCaretBlinkingSuspended(bool suspended) { | 64 void setCaretBlinkingSuspended(bool suspended) { |
65 m_isCaretBlinkingSuspended = suspended; | 65 m_isCaretBlinkingSuspended = suspended; |
66 } | 66 } |
67 bool isCaretBlinkingSuspended() const { return m_isCaretBlinkingSuspended; } | 67 bool isCaretBlinkingSuspended() const { return m_isCaretBlinkingSuspended; } |
68 void stopCaretBlinkTimer(); | 68 void stopCaretBlinkTimer(); |
69 void startBlinkCaret(); | 69 void startBlinkCaret(); |
70 void setCaretVisibility(CaretVisibility); | 70 void setCaretVisibility(CaretVisibility); |
71 IntRect absoluteCaretBounds() const; | 71 IntRect absoluteCaretBounds() const; |
(...skipping 20 matching lines...) Expand all Loading... |
92 DECLARE_TRACE(); | 92 DECLARE_TRACE(); |
93 | 93 |
94 private: | 94 private: |
95 friend class FrameSelectionTest; | 95 friend class FrameSelectionTest; |
96 | 96 |
97 const PositionWithAffinity caretPosition() const; | 97 const PositionWithAffinity caretPosition() const; |
98 | 98 |
99 bool shouldBlinkCaret() const; | 99 bool shouldBlinkCaret() const; |
100 void caretBlinkTimerFired(TimerBase*); | 100 void caretBlinkTimerFired(TimerBase*); |
101 bool caretPositionIsValidForDocument(const Document&) const; | 101 bool caretPositionIsValidForDocument(const Document&) const; |
102 | 102 void updateAppearance(); |
103 void scheduleVisualUpdateForPaintInvalidationIfNeeded(); | |
104 | 103 |
105 const Member<const SelectionEditor> m_selectionEditor; | 104 const Member<const SelectionEditor> m_selectionEditor; |
106 const Member<LocalFrame> m_frame; | 105 const Member<LocalFrame> m_frame; |
107 const std::unique_ptr<CaretDisplayItemClient> m_displayItemClient; | 106 const std::unique_ptr<CaretDisplayItemClient> m_displayItemClient; |
108 CaretVisibility m_caretVisibility; | 107 CaretVisibility m_caretVisibility; |
109 // TODO(https://crbug.com/668758): Consider using BeginFrame update for this. | 108 // TODO(https://crbug.com/668758): Consider using BeginFrame update for this. |
110 TaskRunnerTimer<FrameCaret> m_caretBlinkTimer; | 109 TaskRunnerTimer<FrameCaret> m_caretBlinkTimer; |
111 bool m_shouldPaintCaret : 1; | 110 bool m_shouldPaintCaret : 1; |
112 bool m_isCaretBlinkingSuspended : 1; | 111 bool m_isCaretBlinkingSuspended : 1; |
113 bool m_shouldShowBlockCursor : 1; | 112 bool m_shouldShowBlockCursor : 1; |
114 | 113 |
115 DISALLOW_COPY_AND_ASSIGN(FrameCaret); | 114 DISALLOW_COPY_AND_ASSIGN(FrameCaret); |
116 }; | 115 }; |
117 | 116 |
118 } // namespace blink | 117 } // namespace blink |
119 | 118 |
120 #endif // FrameCaret_h | 119 #endif // FrameCaret_h |
OLD | NEW |