OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 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 28 matching lines...) Expand all Loading... |
39 : m_caretRectNeedsUpdate(true) | 39 : m_caretRectNeedsUpdate(true) |
40 , m_caretVisibility(visibility) | 40 , m_caretVisibility(visibility) |
41 { | 41 { |
42 } | 42 } |
43 | 43 |
44 DragCaretController::DragCaretController() | 44 DragCaretController::DragCaretController() |
45 : CaretBase(Visible) | 45 : CaretBase(Visible) |
46 { | 46 { |
47 } | 47 } |
48 | 48 |
49 PassOwnPtr<DragCaretController> DragCaretController::create() | 49 PassOwnPtrWillBeRawPtr<DragCaretController> DragCaretController::create() |
50 { | 50 { |
51 return adoptPtr(new DragCaretController); | 51 return adoptPtrWillBeNoop(new DragCaretController); |
52 } | 52 } |
53 | 53 |
54 bool DragCaretController::isContentRichlyEditable() const | 54 bool DragCaretController::isContentRichlyEditable() const |
55 { | 55 { |
56 return isRichlyEditablePosition(m_position.deepEquivalent()); | 56 return isRichlyEditablePosition(m_position.deepEquivalent()); |
57 } | 57 } |
58 | 58 |
59 void DragCaretController::setCaretPosition(const VisiblePosition& position) | 59 void DragCaretController::setCaretPosition(const VisiblePosition& position) |
60 { | 60 { |
61 if (Node* node = m_position.deepEquivalent().deprecatedNode()) | 61 if (Node* node = m_position.deepEquivalent().deprecatedNode()) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 if (!hasCaret() || !node.inActiveDocument()) | 93 if (!hasCaret() || !node.inActiveDocument()) |
94 return; | 94 return; |
95 | 95 |
96 if (!removingNodeRemovesPosition(node, m_position.deepEquivalent())) | 96 if (!removingNodeRemovesPosition(node, m_position.deepEquivalent())) |
97 return; | 97 return; |
98 | 98 |
99 m_position.deepEquivalent().document()->renderView()->clearSelection(); | 99 m_position.deepEquivalent().document()->renderView()->clearSelection(); |
100 clear(); | 100 clear(); |
101 } | 101 } |
102 | 102 |
| 103 void DragCaretController::trace(Visitor* visitor) |
| 104 { |
| 105 visitor->trace(m_position); |
| 106 } |
| 107 |
103 void CaretBase::clearCaretRect() | 108 void CaretBase::clearCaretRect() |
104 { | 109 { |
105 m_caretLocalRect = LayoutRect(); | 110 m_caretLocalRect = LayoutRect(); |
106 } | 111 } |
107 | 112 |
108 static inline bool caretRendersInsideNode(Node* node) | 113 static inline bool caretRendersInsideNode(Node* node) |
109 { | 114 { |
110 return node && !isRenderedTable(node) && !editingIgnoresContent(node); | 115 return node && !isRenderedTable(node) && !editingIgnoresContent(node); |
111 } | 116 } |
112 | 117 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 context->fillRect(caret, caretColor); | 261 context->fillRect(caret, caretColor); |
257 } | 262 } |
258 | 263 |
259 void DragCaretController::paintDragCaret(LocalFrame* frame, GraphicsContext* p,
const LayoutPoint& paintOffset, const LayoutRect& clipRect) const | 264 void DragCaretController::paintDragCaret(LocalFrame* frame, GraphicsContext* p,
const LayoutPoint& paintOffset, const LayoutRect& clipRect) const |
260 { | 265 { |
261 if (m_position.deepEquivalent().deprecatedNode()->document().frame() == fram
e) | 266 if (m_position.deepEquivalent().deprecatedNode()->document().frame() == fram
e) |
262 paintCaret(m_position.deepEquivalent().deprecatedNode(), p, paintOffset,
clipRect); | 267 paintCaret(m_position.deepEquivalent().deprecatedNode(), p, paintOffset,
clipRect); |
263 } | 268 } |
264 | 269 |
265 } | 270 } |
OLD | NEW |