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(const RenderView*, bool isContentEditable) const; | 57 bool shouldRepaintCaret(const RenderView*, bool isContentEditable) const; |
58 void paintCaret(Node*, GraphicsContext*, const LayoutPoint&, const LayoutRec
t& clipRect) const; | 58 void paintCaret(Node*, GraphicsContext*, const LayoutPoint&, const LayoutRec
t& clipRect) const; |
59 | 59 |
60 const LayoutRect& localCaretRectWithoutUpdate() const { return m_caretLocalR
ect; } | 60 const LayoutRect& localCaretRectWithoutUpdate() const { return m_caretLocalR
ect; } |
61 | 61 |
62 bool shouldUpdateCaretRect() const { return m_caretRectNeedsUpdate; } | |
63 void setCaretRectNeedsUpdate() { m_caretRectNeedsUpdate = true; } | |
64 | |
65 void setCaretVisibility(CaretVisibility visibility) { m_caretVisibility = vi
sibility; } | 62 void setCaretVisibility(CaretVisibility visibility) { m_caretVisibility = vi
sibility; } |
66 bool caretIsVisible() const { return m_caretVisibility == Visible; } | 63 bool caretIsVisible() const { return m_caretVisibility == Visible; } |
67 CaretVisibility caretVisibility() const { return m_caretVisibility; } | 64 CaretVisibility caretVisibility() const { return m_caretVisibility; } |
68 | 65 |
69 protected: | 66 protected: |
70 static RenderBlock* caretRenderer(Node*); | 67 static RenderBlock* caretRenderer(Node*); |
71 static void invalidateLocalCaretRect(Node*, const LayoutRect&); | 68 static void invalidateLocalCaretRect(Node*, const LayoutRect&); |
72 | 69 |
73 private: | 70 private: |
74 LayoutRect m_caretLocalRect; // caret rect in coords local to the renderer r
esponsible for painting the caret | 71 LayoutRect m_caretLocalRect; // caret rect in coords local to the renderer r
esponsible for painting the caret |
75 bool m_caretRectNeedsUpdate; // true if m_caretRect (and m_absCaretBounds in
FrameSelection) need to be calculated | |
76 CaretVisibility m_caretVisibility; | 72 CaretVisibility m_caretVisibility; |
77 }; | 73 }; |
78 | 74 |
79 class DragCaretController final : public NoBaseWillBeGarbageCollected<DragCaretC
ontroller>, private CaretBase { | 75 class DragCaretController final : public NoBaseWillBeGarbageCollected<DragCaretC
ontroller>, private CaretBase { |
80 WTF_MAKE_NONCOPYABLE(DragCaretController); | 76 WTF_MAKE_NONCOPYABLE(DragCaretController); |
81 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; | 77 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
82 public: | 78 public: |
83 static PassOwnPtrWillBeRawPtr<DragCaretController> create(); | 79 static PassOwnPtrWillBeRawPtr<DragCaretController> create(); |
84 | 80 |
85 RenderBlock* caretRenderer() const; | 81 RenderBlock* caretRenderer() const; |
(...skipping 14 matching lines...) Expand all Loading... |
100 private: | 96 private: |
101 DragCaretController(); | 97 DragCaretController(); |
102 | 98 |
103 VisiblePosition m_position; | 99 VisiblePosition m_position; |
104 }; | 100 }; |
105 | 101 |
106 } // namespace blink | 102 } // namespace blink |
107 | 103 |
108 | 104 |
109 #endif // Caret_h | 105 #endif // Caret_h |
OLD | NEW |