| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // PositionWithAffinity version if possible. | 52 // PositionWithAffinity version if possible. |
| 53 // A position in HTMLTextFromControlElement is a typical example. | 53 // A position in HTMLTextFromControlElement is a typical example. |
| 54 bool updateCaretRect(Document*, const PositionWithAffinity& caretPosition); | 54 bool updateCaretRect(Document*, const PositionWithAffinity& caretPosition); |
| 55 bool updateCaretRect(Document*, const VisiblePosition& caretPosition); | 55 bool updateCaretRect(Document*, const VisiblePosition& caretPosition); |
| 56 IntRect absoluteBoundsForLocalRect(Node*, const LayoutRect&) const; | 56 IntRect absoluteBoundsForLocalRect(Node*, const LayoutRect&) const; |
| 57 bool shouldRepaintCaret(Node&) const; | 57 bool shouldRepaintCaret(Node&) const; |
| 58 bool shouldRepaintCaret(const LayoutView*) const; | 58 bool shouldRepaintCaret(const LayoutView*) const; |
| 59 void paintCaret(Node*, GraphicsContext*, const LayoutPoint&, const LayoutRec
t& clipRect) const; | 59 void paintCaret(Node*, GraphicsContext*, const LayoutPoint&, const LayoutRec
t& clipRect) const; |
| 60 | 60 |
| 61 const LayoutRect& localCaretRectWithoutUpdate() const { return m_caretLocalR
ect; } | 61 const LayoutRect& localCaretRectWithoutUpdate() const { return m_caretLocalR
ect; } |
| 62 LayoutBlock* caretPainter() const { return m_caretPainter; } |
| 62 | 63 |
| 63 void setCaretVisibility(CaretVisibility visibility) { m_caretVisibility = vi
sibility; } | 64 void setCaretVisibility(CaretVisibility visibility) { m_caretVisibility = vi
sibility; } |
| 64 bool caretIsVisible() const { return m_caretVisibility == Visible; } | 65 bool caretIsVisible() const { return m_caretVisibility == Visible; } |
| 65 CaretVisibility caretVisibility() const { return m_caretVisibility; } | 66 CaretVisibility caretVisibility() const { return m_caretVisibility; } |
| 66 | 67 |
| 67 protected: | |
| 68 static LayoutBlock* caretLayoutObject(Node*); | 68 static LayoutBlock* caretLayoutObject(Node*); |
| 69 static void invalidateLocalCaretRect(Node*, const LayoutRect&); | 69 static void invalidateLocalCaretRect(Node*, const LayoutRect&); |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 LayoutBlock* m_caretPainter; // layout object responsible for painting the c
aret |
| 72 LayoutRect m_caretLocalRect; // caret rect in coords local to the layoutObje
ct responsible for painting the caret | 73 LayoutRect m_caretLocalRect; // caret rect in coords local to the layoutObje
ct responsible for painting the caret |
| 73 CaretVisibility m_caretVisibility; | 74 CaretVisibility m_caretVisibility; |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 class DragCaretController final : public NoBaseWillBeGarbageCollected<DragCaretC
ontroller>, private CaretBase { | 77 class DragCaretController final : public NoBaseWillBeGarbageCollected<DragCaretC
ontroller>, private CaretBase { |
| 77 WTF_MAKE_NONCOPYABLE(DragCaretController); | 78 WTF_MAKE_NONCOPYABLE(DragCaretController); |
| 78 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(DragCaretController); | 79 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(DragCaretController); |
| 79 public: | 80 public: |
| 80 static PassOwnPtrWillBeRawPtr<DragCaretController> create(); | 81 static PassOwnPtrWillBeRawPtr<DragCaretController> create(); |
| 81 | 82 |
| 82 LayoutBlock* caretLayoutObject() const; | 83 LayoutBlock* caretLayoutObject() const { return CaretBase::caretPainter(); } |
| 83 void paintDragCaret(LocalFrame*, GraphicsContext*, const LayoutPoint&, const
LayoutRect& clipRect) const; | 84 void paintDragCaret(LocalFrame*, GraphicsContext*, const LayoutPoint&, const
LayoutRect& clipRect) const; |
| 84 | 85 |
| 85 bool isContentEditable() const { return m_position.rootEditableElement(); } | 86 bool isContentEditable() const { return m_position.rootEditableElement(); } |
| 86 bool isContentRichlyEditable() const; | 87 bool isContentRichlyEditable() const; |
| 87 | 88 |
| 88 bool hasCaret() const { return m_position.isNotNull(); } | 89 bool hasCaret() const { return m_position.isNotNull(); } |
| 89 const VisiblePosition& caretPosition() { return m_position; } | 90 const VisiblePosition& caretPosition() { return m_position; } |
| 90 void setCaretPosition(const VisiblePosition&); | 91 void setCaretPosition(const VisiblePosition&); |
| 91 void clear() { setCaretPosition(VisiblePosition()); } | 92 void clear() { setCaretPosition(VisiblePosition()); } |
| 92 | 93 |
| 93 void nodeWillBeRemoved(Node&); | 94 void nodeWillBeRemoved(Node&); |
| 94 | 95 |
| 95 DECLARE_TRACE(); | 96 DECLARE_TRACE(); |
| 96 | 97 |
| 97 private: | 98 private: |
| 98 DragCaretController(); | 99 DragCaretController(); |
| 99 | 100 |
| 100 VisiblePosition m_position; | 101 VisiblePosition m_position; |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 } // namespace blink | 104 } // namespace blink |
| 104 | 105 |
| 105 | 106 |
| 106 #endif // Caret_h | 107 #endif // Caret_h |
| OLD | NEW |