OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 30 matching lines...) Expand all Loading... |
41 class LayoutBlock; | 41 class LayoutBlock; |
42 | 42 |
43 class CORE_EXPORT CaretBase : public GarbageCollectedFinalized<CaretBase>, | 43 class CORE_EXPORT CaretBase : public GarbageCollectedFinalized<CaretBase>, |
44 public DisplayItemClient { | 44 public DisplayItemClient { |
45 WTF_MAKE_NONCOPYABLE(CaretBase); | 45 WTF_MAKE_NONCOPYABLE(CaretBase); |
46 | 46 |
47 public: | 47 public: |
48 CaretBase(); | 48 CaretBase(); |
49 virtual ~CaretBase(); | 49 virtual ~CaretBase(); |
50 | 50 |
51 void invalidateCaretRect(Node*); | 51 void invalidateCaretRect(Node*, const LayoutRect&); |
52 void clearCaretRect(); | |
53 // Creating VisiblePosition causes synchronous layout so we should use the | 52 // Creating VisiblePosition causes synchronous layout so we should use the |
54 // PositionWithAffinity version if possible. | 53 // PositionWithAffinity version if possible. |
55 // A position in HTMLTextFromControlElement is a typical example. | 54 // A position in HTMLTextFromControlElement is a typical example. |
56 void updateCaretRect(const PositionWithAffinity& caretPosition); | 55 static LayoutRect computeCaretRect(const PositionWithAffinity& caretPosition); |
57 void updateCaretRect(const VisiblePosition& caretPosition); | 56 |
| 57 // TODO(yosin): We should move |computeCaretRect()| with |VisiblePosition| to |
| 58 // "FrameCaret.cpp" as static file local function. |
| 59 static LayoutRect computeCaretRect(const VisiblePosition& caretPosition); |
| 60 |
| 61 // TODO(yosin): We should move |absoluteBoundsForLocalRect()| with |
| 62 // |VisiblePosition| to "FrameCaret.cpp" as static file local function. |
58 IntRect absoluteBoundsForLocalRect(Node*, const LayoutRect&) const; | 63 IntRect absoluteBoundsForLocalRect(Node*, const LayoutRect&) const; |
| 64 |
| 65 // TODO(yosin): We should move |shouldRepaintCaret()| to "FrameCaret.cpp" as |
| 66 // static file local function. |
59 bool shouldRepaintCaret(Node&) const; | 67 bool shouldRepaintCaret(Node&) const; |
60 void paintCaret(Node*, | 68 static void paintCaret(Node*, |
61 GraphicsContext&, | 69 GraphicsContext&, |
62 const LayoutPoint&, | 70 const DisplayItemClient&, |
63 DisplayItem::Type) const; | 71 const LayoutRect& caretLocalRect, |
64 | 72 const LayoutPoint&, |
65 const LayoutRect& localCaretRectWithoutUpdate() const { | 73 DisplayItem::Type); |
66 return m_caretLocalRect; | |
67 } | |
68 | 74 |
69 static LayoutBlock* caretLayoutObject(Node*); | 75 static LayoutBlock* caretLayoutObject(Node*); |
70 void invalidateLocalCaretRect(Node*, const LayoutRect&); | 76 void invalidateLocalCaretRect(Node*, const LayoutRect&); |
71 | 77 |
72 // DisplayItemClient methods. | 78 // DisplayItemClient methods. |
73 LayoutRect visualRect() const override; | 79 LayoutRect visualRect() const override; |
74 String debugName() const final; | 80 String debugName() const final; |
75 | 81 |
76 DECLARE_VIRTUAL_TRACE(); | 82 DECLARE_VIRTUAL_TRACE(); |
77 | 83 |
78 private: | 84 private: |
79 // caret rect in coords local to the layoutObject responsible for painting the | |
80 // caret | |
81 LayoutRect m_caretLocalRect; | |
82 LayoutRect m_visualRect; | 85 LayoutRect m_visualRect; |
83 }; | 86 }; |
84 | 87 |
85 } // namespace blink | 88 } // namespace blink |
86 | 89 |
87 #endif // CaretBase_h | 90 #endif // CaretBase_h |
OLD | NEW |