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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 const PaintInvalidatorContext&, | 81 const PaintInvalidatorContext&, |
82 PaintInvalidationReason); | 82 PaintInvalidationReason); |
83 | 83 |
84 bool shouldPaintCaret(const LayoutBlock&) const; | 84 bool shouldPaintCaret(const LayoutBlock&) const; |
85 void paintCaret(GraphicsContext&, const LayoutPoint&) const; | 85 void paintCaret(GraphicsContext&, const LayoutPoint&) const; |
86 | 86 |
87 // For unit tests. | 87 // For unit tests. |
88 const DisplayItemClient& caretDisplayItemClientForTesting() const; | 88 const DisplayItemClient& caretDisplayItemClientForTesting() const; |
89 const LayoutBlock* caretLayoutBlockForTesting() const; | 89 const LayoutBlock* caretLayoutBlockForTesting() const; |
90 bool shouldPaintCaretForTesting() const { return m_shouldPaintCaret; } | 90 bool shouldPaintCaretForTesting() const { return m_shouldPaintCaret; } |
| 91 void recreateCaretBlinkTimerForTesting(RefPtr<WebTaskRunner>); |
91 | 92 |
92 DECLARE_TRACE(); | 93 DECLARE_TRACE(); |
93 | 94 |
94 private: | 95 private: |
95 friend class FrameSelectionTest; | 96 friend class FrameSelectionTest; |
96 | 97 |
97 const PositionWithAffinity caretPosition() const; | 98 const PositionWithAffinity caretPosition() const; |
98 | 99 |
99 bool shouldBlinkCaret() const; | 100 bool shouldBlinkCaret() const; |
100 void caretBlinkTimerFired(TimerBase*); | 101 void caretBlinkTimerFired(TimerBase*); |
101 bool caretPositionIsValidForDocument(const Document&) const; | 102 bool caretPositionIsValidForDocument(const Document&) const; |
102 void updateAppearance(); | 103 void updateAppearance(); |
103 | 104 |
104 const Member<const SelectionEditor> m_selectionEditor; | 105 const Member<const SelectionEditor> m_selectionEditor; |
105 const Member<LocalFrame> m_frame; | 106 const Member<LocalFrame> m_frame; |
106 const std::unique_ptr<CaretDisplayItemClient> m_displayItemClient; | 107 const std::unique_ptr<CaretDisplayItemClient> m_displayItemClient; |
107 CaretVisibility m_caretVisibility; | 108 CaretVisibility m_caretVisibility; |
108 // TODO(https://crbug.com/668758): Consider using BeginFrame update for this. | 109 // TODO(https://crbug.com/668758): Consider using BeginFrame update for this. |
109 TaskRunnerTimer<FrameCaret> m_caretBlinkTimer; | 110 std::unique_ptr<TaskRunnerTimer<FrameCaret>> m_caretBlinkTimer; |
110 bool m_shouldPaintCaret : 1; | 111 bool m_shouldPaintCaret : 1; |
111 bool m_isCaretBlinkingSuspended : 1; | 112 bool m_isCaretBlinkingSuspended : 1; |
112 bool m_shouldShowBlockCursor : 1; | 113 bool m_shouldShowBlockCursor : 1; |
113 | 114 |
114 DISALLOW_COPY_AND_ASSIGN(FrameCaret); | 115 DISALLOW_COPY_AND_ASSIGN(FrameCaret); |
115 }; | 116 }; |
116 | 117 |
117 } // namespace blink | 118 } // namespace blink |
118 | 119 |
119 #endif // FrameCaret_h | 120 #endif // FrameCaret_h |
OLD | NEW |