| 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 27 matching lines...) Expand all Loading... |
| 38 WTF_MAKE_NONCOPYABLE(DragCaret); | 38 WTF_MAKE_NONCOPYABLE(DragCaret); |
| 39 USING_GARBAGE_COLLECTED_MIXIN(DragCaret); | 39 USING_GARBAGE_COLLECTED_MIXIN(DragCaret); |
| 40 | 40 |
| 41 public: | 41 public: |
| 42 static DragCaret* create(); | 42 static DragCaret* create(); |
| 43 | 43 |
| 44 virtual ~DragCaret(); | 44 virtual ~DragCaret(); |
| 45 | 45 |
| 46 void paintDragCaret(LocalFrame*, GraphicsContext&, const LayoutPoint&) const; | 46 void paintDragCaret(LocalFrame*, GraphicsContext&, const LayoutPoint&) const; |
| 47 | 47 |
| 48 // Returns the layout object responsible for painting the caret. |
| 49 LayoutBlock* caretLayoutBlock() const; |
| 50 // Caret rect in coords local to |caretLayoutBlock|. |
| 51 LayoutRect caretLocalRect() const { return m_caretLocalRect; } |
| 52 |
| 53 void setVisualRect(const LayoutRect& r) { m_caretBase->setVisualRect(r); } |
| 54 const DisplayItemClient& getDisplayItemClient() const { return *m_caretBase; } |
| 55 |
| 48 bool hasCaretIn(const LayoutBlock&) const; | 56 bool hasCaretIn(const LayoutBlock&) const; |
| 49 bool isContentRichlyEditable() const; | 57 bool isContentRichlyEditable() const; |
| 50 | 58 |
| 51 bool hasCaret() const { return m_position.isNotNull(); } | 59 bool hasCaret() const { return m_position.isNotNull(); } |
| 52 const PositionWithAffinity& caretPosition() { return m_position; } | 60 const PositionWithAffinity& caretPosition() { return m_position; } |
| 53 void setCaretPosition(const PositionWithAffinity&); | 61 void setCaretPosition(const PositionWithAffinity&); |
| 54 void clear() { setCaretPosition(PositionWithAffinity()); } | 62 void clear() { setCaretPosition(PositionWithAffinity()); } |
| 55 | 63 |
| 56 DECLARE_TRACE(); | 64 DECLARE_TRACE(); |
| 57 | 65 |
| 58 private: | 66 private: |
| 59 DragCaret(); | 67 DragCaret(); |
| 60 | 68 |
| 61 void invalidateCaretRect(Node*, const LayoutRect&); | |
| 62 | |
| 63 // Implementations of |SynchronousMutationObserver| | 69 // Implementations of |SynchronousMutationObserver| |
| 64 void nodeChildrenWillBeRemoved(ContainerNode&) final; | 70 void nodeChildrenWillBeRemoved(ContainerNode&) final; |
| 65 void nodeWillBeRemoved(Node&) final; | 71 void nodeWillBeRemoved(Node&) final; |
| 66 | 72 |
| 67 PositionWithAffinity m_position; | 73 PositionWithAffinity m_position; |
| 68 // caret rect in coords local to the layoutObject responsible for painting the | |
| 69 // caret | |
| 70 LayoutRect m_caretLocalRect; | 74 LayoutRect m_caretLocalRect; |
| 71 const std::unique_ptr<CaretDisplayItemClient> m_caretBase; | 75 const std::unique_ptr<CaretDisplayItemClient> m_caretBase; |
| 72 }; | 76 }; |
| 73 | 77 |
| 74 } // namespace blink | 78 } // namespace blink |
| 75 | 79 |
| 76 #endif // DragCaret_h | 80 #endif // DragCaret_h |
| OLD | NEW |