| 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 16 matching lines...) Expand all Loading... |
| 27 #define FrameCaret_h | 27 #define FrameCaret_h |
| 28 | 28 |
| 29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
| 30 #include "core/editing/CaretBase.h" | 30 #include "core/editing/CaretBase.h" |
| 31 #include "platform/geometry/IntRect.h" | 31 #include "platform/geometry/IntRect.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 class SelectionEditor; | 35 class SelectionEditor; |
| 36 | 36 |
| 37 enum class CaretVisibility { Visible, Hidden }; |
| 38 |
| 37 class CORE_EXPORT FrameCaret final : public CaretBase { | 39 class CORE_EXPORT FrameCaret final : public CaretBase { |
| 38 public: | 40 public: |
| 39 FrameCaret(LocalFrame*, const SelectionEditor&); | 41 FrameCaret(LocalFrame*, const SelectionEditor&); |
| 40 ~FrameCaret() override; | 42 ~FrameCaret() override; |
| 41 | 43 |
| 42 bool isActive() const { return caretPosition().isNotNull(); } | 44 bool isActive() const { return caretPosition().isNotNull(); } |
| 43 | 45 |
| 44 void updateAppearance(); | 46 void updateAppearance(); |
| 45 | 47 |
| 46 // Used to suspend caret blinking while the mouse is down. | 48 // Used to suspend caret blinking while the mouse is down. |
| 47 void setCaretBlinkingSuspended(bool suspended) { m_isCaretBlinkingSuspended
= suspended; } | 49 void setCaretBlinkingSuspended(bool suspended) { m_isCaretBlinkingSuspended
= suspended; } |
| 48 bool isCaretBlinkingSuspended() const { return m_isCaretBlinkingSuspended; } | 50 bool isCaretBlinkingSuspended() const { return m_isCaretBlinkingSuspended; } |
| 49 void stopCaretBlinkTimer(); | 51 void stopCaretBlinkTimer(); |
| 50 void startBlinkCaret(); | 52 void startBlinkCaret(); |
| 51 | 53 |
| 52 void setCaretVisibility(CaretVisibility) override; | 54 void setCaretVisibility(CaretVisibility); |
| 53 bool isCaretBoundsDirty() const { return m_caretRectDirty; } | 55 bool isCaretBoundsDirty() const { return m_caretRectDirty; } |
| 54 void setCaretRectNeedsUpdate(); | 56 void setCaretRectNeedsUpdate(); |
| 55 // If |forceInvalidation| is true the caret's previous and new rectangles | 57 // If |forceInvalidation| is true the caret's previous and new rectangles |
| 56 // are forcibly invalidated regardless of the state of the blink timer. | 58 // are forcibly invalidated regardless of the state of the blink timer. |
| 57 void invalidateCaretRect(bool forceInvalidation); | 59 void invalidateCaretRect(bool forceInvalidation); |
| 58 IntRect absoluteCaretBounds(); | 60 IntRect absoluteCaretBounds(); |
| 59 | 61 |
| 60 bool shouldShowBlockCursor() const { return m_shouldShowBlockCursor; } | 62 bool shouldShowBlockCursor() const { return m_shouldShowBlockCursor; } |
| 61 void setShouldShowBlockCursor(bool); | 63 void setShouldShowBlockCursor(bool); |
| 62 | 64 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 81 bool shouldBlinkCaret() const; | 83 bool shouldBlinkCaret() const; |
| 82 void caretBlinkTimerFired(TimerBase*); | 84 void caretBlinkTimerFired(TimerBase*); |
| 83 bool caretPositionIsValidForDocument(const Document&) const; | 85 bool caretPositionIsValidForDocument(const Document&) const; |
| 84 | 86 |
| 85 const Member<const SelectionEditor> m_selectionEditor; | 87 const Member<const SelectionEditor> m_selectionEditor; |
| 86 const Member<LocalFrame> m_frame; | 88 const Member<LocalFrame> m_frame; |
| 87 // The last node which painted the caret. Retained for clearing the old | 89 // The last node which painted the caret. Retained for clearing the old |
| 88 // caret when it moves. | 90 // caret when it moves. |
| 89 Member<Node> m_previousCaretNode; | 91 Member<Node> m_previousCaretNode; |
| 90 LayoutRect m_previousCaretRect; | 92 LayoutRect m_previousCaretRect; |
| 93 CaretVisibility m_caretVisibility; |
| 91 CaretVisibility m_previousCaretVisibility; | 94 CaretVisibility m_previousCaretVisibility; |
| 92 Timer<FrameCaret> m_caretBlinkTimer; | 95 Timer<FrameCaret> m_caretBlinkTimer; |
| 93 bool m_caretRectDirty : 1; | 96 bool m_caretRectDirty : 1; |
| 94 bool m_shouldPaintCaret : 1; | 97 bool m_shouldPaintCaret : 1; |
| 95 bool m_isCaretBlinkingSuspended : 1; | 98 bool m_isCaretBlinkingSuspended : 1; |
| 96 bool m_shouldShowBlockCursor : 1; | 99 bool m_shouldShowBlockCursor : 1; |
| 97 }; | 100 }; |
| 98 | 101 |
| 99 } // namespace blink | 102 } // namespace blink |
| 100 | 103 |
| 101 #endif // FrameCaret_h | 104 #endif // FrameCaret_h |
| OLD | NEW |