| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 if (!renderer) | 119 if (!renderer) |
| 120 return 0; | 120 return 0; |
| 121 | 121 |
| 122 // if caretNode is a block and caret is inside it then caret should be paint
ed by that block | 122 // if caretNode is a block and caret is inside it then caret should be paint
ed by that block |
| 123 bool paintedByBlock = renderer->isRenderBlock() && caretRendersInsideNode(no
de); | 123 bool paintedByBlock = renderer->isRenderBlock() && caretRendersInsideNode(no
de); |
| 124 return paintedByBlock ? renderer : renderer->containingBlock(); | 124 return paintedByBlock ? renderer : renderer->containingBlock(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool CaretBase::updateCaretRect(Document* document, const VisiblePosition& caret
Position) | 127 bool CaretBase::updateCaretRect(Document* document, const VisiblePosition& caret
Position) |
| 128 { | 128 { |
| 129 document->updateStyleIfNeeded(); | 129 document->updateRenderTreeIfNeeded(); |
| 130 m_caretLocalRect = LayoutRect(); | 130 m_caretLocalRect = LayoutRect(); |
| 131 | 131 |
| 132 m_caretRectNeedsUpdate = false; | 132 m_caretRectNeedsUpdate = false; |
| 133 | 133 |
| 134 if (caretPosition.isNull()) | 134 if (caretPosition.isNull()) |
| 135 return false; | 135 return false; |
| 136 | 136 |
| 137 ASSERT(caretPosition.deepEquivalent().deprecatedNode()->renderer()); | 137 ASSERT(caretPosition.deepEquivalent().deprecatedNode()->renderer()); |
| 138 | 138 |
| 139 // First compute a rect local to the renderer at the selection start. | 139 // First compute a rect local to the renderer at the selection start. |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 context->fillRect(caret, caretColor); | 256 context->fillRect(caret, caretColor); |
| 257 } | 257 } |
| 258 | 258 |
| 259 void DragCaretController::paintDragCaret(LocalFrame* frame, GraphicsContext* p,
const LayoutPoint& paintOffset, const LayoutRect& clipRect) const | 259 void DragCaretController::paintDragCaret(LocalFrame* frame, GraphicsContext* p,
const LayoutPoint& paintOffset, const LayoutRect& clipRect) const |
| 260 { | 260 { |
| 261 if (m_position.deepEquivalent().deprecatedNode()->document().frame() == fram
e) | 261 if (m_position.deepEquivalent().deprecatedNode()->document().frame() == fram
e) |
| 262 paintCaret(m_position.deepEquivalent().deprecatedNode(), p, paintOffset,
clipRect); | 262 paintCaret(m_position.deepEquivalent().deprecatedNode(), p, paintOffset,
clipRect); |
| 263 } | 263 } |
| 264 | 264 |
| 265 } | 265 } |
| OLD | NEW |