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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/editing/Caret.h" | 27 #include "core/editing/Caret.h" |
28 | 28 |
29 #include "core/dom/Document.h" | 29 #include "core/dom/Document.h" |
30 #include "core/editing/VisibleUnits.h" | 30 #include "core/editing/VisibleUnits.h" |
31 #include "core/editing/htmlediting.h" | 31 #include "core/editing/htmlediting.h" |
32 #include "core/frame/LocalFrame.h" | 32 #include "core/frame/LocalFrame.h" |
33 #include "core/frame/Settings.h" | 33 #include "core/frame/Settings.h" |
34 #include "core/html/HTMLTextFormControlElement.h" | 34 #include "core/html/HTMLTextFormControlElement.h" |
| 35 #include "core/layout/Layer.h" |
35 #include "core/rendering/RenderBlock.h" | 36 #include "core/rendering/RenderBlock.h" |
36 #include "core/rendering/RenderLayer.h" | |
37 #include "core/rendering/RenderView.h" | 37 #include "core/rendering/RenderView.h" |
38 #include "platform/graphics/GraphicsContext.h" | 38 #include "platform/graphics/GraphicsContext.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 CaretBase::CaretBase(CaretVisibility visibility) | 42 CaretBase::CaretBase(CaretVisibility visibility) |
43 : m_caretVisibility(visibility) | 43 : m_caretVisibility(visibility) |
44 { | 44 { |
45 } | 45 } |
46 | 46 |
47 DragCaretController::DragCaretController() | 47 DragCaretController::DragCaretController() |
48 : CaretBase(Visible) | 48 : CaretBase(Visible) |
49 { | 49 { |
50 } | 50 } |
51 | 51 |
52 PassOwnPtrWillBeRawPtr<DragCaretController> DragCaretController::create() | 52 PassOwnPtrWillBeRawPtr<DragCaretController> DragCaretController::create() |
53 { | 53 { |
54 return adoptPtrWillBeNoop(new DragCaretController); | 54 return adoptPtrWillBeNoop(new DragCaretController); |
55 } | 55 } |
56 | 56 |
57 bool DragCaretController::isContentRichlyEditable() const | 57 bool DragCaretController::isContentRichlyEditable() const |
58 { | 58 { |
59 return isRichlyEditablePosition(m_position.deepEquivalent()); | 59 return isRichlyEditablePosition(m_position.deepEquivalent()); |
60 } | 60 } |
61 | 61 |
62 void DragCaretController::setCaretPosition(const VisiblePosition& position) | 62 void DragCaretController::setCaretPosition(const VisiblePosition& position) |
63 { | 63 { |
64 // for querying RenderLayer::compositingState() | 64 // for querying Layer::compositingState() |
65 // This code is probably correct, since it doesn't occur in a stack that inv
olves updating compositing state. | 65 // This code is probably correct, since it doesn't occur in a stack that inv
olves updating compositing state. |
66 DisableCompositingQueryAsserts disabler; | 66 DisableCompositingQueryAsserts disabler; |
67 | 67 |
68 if (Node* node = m_position.deepEquivalent().deprecatedNode()) | 68 if (Node* node = m_position.deepEquivalent().deprecatedNode()) |
69 invalidateCaretRect(node); | 69 invalidateCaretRect(node); |
70 m_position = position; | 70 m_position = position; |
71 Document* document = nullptr; | 71 Document* document = nullptr; |
72 if (Node* node = m_position.deepEquivalent().deprecatedNode()) { | 72 if (Node* node = m_position.deepEquivalent().deprecatedNode()) { |
73 invalidateCaretRect(node); | 73 invalidateCaretRect(node); |
74 document = &node->document(); | 74 document = &node->document(); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 context->fillRect(caret, caretColor); | 276 context->fillRect(caret, caretColor); |
277 } | 277 } |
278 | 278 |
279 void DragCaretController::paintDragCaret(LocalFrame* frame, GraphicsContext* p,
const LayoutPoint& paintOffset, const LayoutRect& clipRect) const | 279 void DragCaretController::paintDragCaret(LocalFrame* frame, GraphicsContext* p,
const LayoutPoint& paintOffset, const LayoutRect& clipRect) const |
280 { | 280 { |
281 if (m_position.deepEquivalent().deprecatedNode()->document().frame() == fram
e) | 281 if (m_position.deepEquivalent().deprecatedNode()->document().frame() == fram
e) |
282 paintCaret(m_position.deepEquivalent().deprecatedNode(), p, paintOffset,
clipRect); | 282 paintCaret(m_position.deepEquivalent().deprecatedNode(), p, paintOffset,
clipRect); |
283 } | 283 } |
284 | 284 |
285 } | 285 } |
OLD | NEW |