#include "platform/geometry/LayoutRect.h"
#include "wtf/Noncopyable.h"
-namespace WebCore {
+namespace blink {
class LocalFrame;
class GraphicsContext;
-class RenderObject;
+class PositionWithAffinity;
+class RenderBlock;
class RenderView;
class CaretBase {
WTF_MAKE_NONCOPYABLE(CaretBase);
- WTF_MAKE_FAST_ALLOCATED;
+ WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
protected:
enum CaretVisibility { Visible, Hidden };
explicit CaretBase(CaretVisibility = Hidden);
void invalidateCaretRect(Node*, bool caretRectChanged = false);
void clearCaretRect();
+ // Creating VisiblePosition causes synchronous layout so we should use the
+ // PositionWithAffinity version if possible.
+ // A position in HTMLTextFromControlElement is a typical example.
+ bool updateCaretRect(Document*, const PositionWithAffinity& caretPosition);
bool updateCaretRect(Document*, const VisiblePosition& caretPosition);
IntRect absoluteBoundsForLocalRect(Node*, const LayoutRect&) const;
bool shouldRepaintCaret(const RenderView*, bool isContentEditable) const;
CaretVisibility caretVisibility() const { return m_caretVisibility; }
protected:
- static RenderObject* caretRenderer(Node*);
+ static RenderBlock* caretRenderer(Node*);
static void repaintCaretForLocalRect(Node*, const LayoutRect&);
private:
CaretVisibility m_caretVisibility;
};
-class DragCaretController : private CaretBase {
+class DragCaretController FINAL : public NoBaseWillBeGarbageCollected<DragCaretController>, private CaretBase {
WTF_MAKE_NONCOPYABLE(DragCaretController);
- WTF_MAKE_FAST_ALLOCATED;
+ WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
public:
- static PassOwnPtr<DragCaretController> create();
+ static PassOwnPtrWillBeRawPtr<DragCaretController> create();
- RenderObject* caretRenderer() const;
+ RenderBlock* caretRenderer() const;
void paintDragCaret(LocalFrame*, GraphicsContext*, const LayoutPoint&, const LayoutRect& clipRect) const;
bool isContentEditable() const { return m_position.rootEditableElement(); }
void nodeWillBeRemoved(Node&);
+ void trace(Visitor*);
+
private:
DragCaretController();
VisiblePosition m_position;
};
-} // namespace WebCore
+} // namespace blink
#endif // Caret_h