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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // https://bugs.webkit.org/show_bug.cgi?id=108283 | 202 // https://bugs.webkit.org/show_bug.cgi?id=108283 |
203 LayoutRect inflatedRect = rect; | 203 LayoutRect inflatedRect = rect; |
204 inflatedRect.inflate(1); | 204 inflatedRect.inflate(1); |
205 | 205 |
206 caretPainter->repaintRectangle(inflatedRect); | 206 caretPainter->repaintRectangle(inflatedRect); |
207 } | 207 } |
208 | 208 |
209 bool CaretBase::shouldRepaintCaret(const RenderView* view, bool isContentEditabl
e) const | 209 bool CaretBase::shouldRepaintCaret(const RenderView* view, bool isContentEditabl
e) const |
210 { | 210 { |
211 ASSERT(view); | 211 ASSERT(view); |
212 Frame* frame = view->frameView() ? view->frameView()->frame() : 0; // The fr
ame where the selection started. | 212 bool caretBrowsing = false; |
213 bool caretBrowsing = frame && frame->settings() && frame->settings()->caretB
rowsingEnabled(); | 213 if (FrameView* frameView = view->frameView()) { |
| 214 Frame& frame = frameView->frame(); // The frame where the selection star
ted |
| 215 caretBrowsing = frame.settings() && frame.settings()->caretBrowsingEnabl
ed(); |
| 216 } |
214 return (caretBrowsing || isContentEditable); | 217 return (caretBrowsing || isContentEditable); |
215 } | 218 } |
216 | 219 |
217 void CaretBase::invalidateCaretRect(Node* node, bool caretRectChanged) | 220 void CaretBase::invalidateCaretRect(Node* node, bool caretRectChanged) |
218 { | 221 { |
219 // EDIT FIXME: This is an unfortunate hack. | 222 // EDIT FIXME: This is an unfortunate hack. |
220 // Basically, we can't trust this layout position since we | 223 // Basically, we can't trust this layout position since we |
221 // can't guarantee that the check to see if we are in unrendered | 224 // can't guarantee that the check to see if we are in unrendered |
222 // content will work at this point. We may have to wait for | 225 // content will work at this point. We may have to wait for |
223 // a layout and re-render of the document to happen. So, resetting this | 226 // a layout and re-render of the document to happen. So, resetting this |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 context->fillRect(caret, caretColor); | 269 context->fillRect(caret, caretColor); |
267 } | 270 } |
268 | 271 |
269 void DragCaretController::paintDragCaret(Frame* frame, GraphicsContext* p, const
LayoutPoint& paintOffset, const LayoutRect& clipRect) const | 272 void DragCaretController::paintDragCaret(Frame* frame, GraphicsContext* p, const
LayoutPoint& paintOffset, const LayoutRect& clipRect) const |
270 { | 273 { |
271 if (m_position.deepEquivalent().deprecatedNode()->document().frame() == fram
e) | 274 if (m_position.deepEquivalent().deprecatedNode()->document().frame() == fram
e) |
272 paintCaret(m_position.deepEquivalent().deprecatedNode(), p, paintOffset,
clipRect); | 275 paintCaret(m_position.deepEquivalent().deprecatedNode(), p, paintOffset,
clipRect); |
273 } | 276 } |
274 | 277 |
275 } | 278 } |
OLD | NEW |