| 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..8c50d97929c851d33417d448890c181cbd6eaa6d
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/editing/FrameCaret.h
|
| @@ -0,0 +1,79 @@
|
| +/*
|
| + * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved.
|
| + *
|
| + * Redistribution and use in source and binary forms, with or without
|
| + * modification, are permitted provided that the following conditions
|
| + * are met:
|
| + * 1. Redistributions of source code must retain the above copyright
|
| + * notice, this list of conditions and the following disclaimer.
|
| + * 2. Redistributions in binary form must reproduce the above copyright
|
| + * notice, this list of conditions and the following disclaimer in the
|
| + * documentation and/or other materials provided with the distribution.
|
| + *
|
| + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
|
| + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
|
| + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
| + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
| + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
| + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
| + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| + */
|
| +
|
| +#ifndef FrameCaret_h
|
| +#define FrameCaret_h
|
| +
|
| +#include "core/editing/CaretBase.h"
|
| +#include "core/editing/VisibleSelection.h"
|
| +
|
| +namespace blink {
|
| +
|
| +class FrameCaret final : public CaretBase {
|
| +public:
|
| + FrameCaret(LocalFrame*);
|
| + ~FrameCaret() override;
|
| +
|
| + // 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
|
|
|