| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool CaretBase::updateCaretRect(Document* document, const PositionWithAffinity&
caretPosition) | 92 bool CaretBase::updateCaretRect(Document* document, const PositionWithAffinity&
caretPosition) |
| 93 { | 93 { |
| 94 m_caretPainter = nullptr; | 94 m_caretPainter = nullptr; |
| 95 m_caretLocalRect = LayoutRect(); | 95 m_caretLocalRect = LayoutRect(); |
| 96 | 96 |
| 97 if (caretPosition.position().isNull()) | 97 if (caretPosition.position().isNull()) |
| 98 return false; | 98 return false; |
| 99 | 99 |
| 100 ASSERT(caretPosition.position().deprecatedNode()->layoutObject()); | 100 ASSERT(caretPosition.position().anchorNode()->layoutObject()); |
| 101 | 101 |
| 102 // First compute a rect local to the layoutObject at the selection start. | 102 // First compute a rect local to the layoutObject at the selection start. |
| 103 LayoutObject* layoutObject; | 103 LayoutObject* layoutObject; |
| 104 m_caretLocalRect = localCaretRectOfPosition(caretPosition, layoutObject); | 104 m_caretLocalRect = localCaretRectOfPosition(caretPosition, layoutObject); |
| 105 | 105 |
| 106 // Get the layoutObject that will be responsible for painting the caret | 106 // Get the layoutObject that will be responsible for painting the caret |
| 107 // (which is either the layoutObject we just found, or one of its containers
). | 107 // (which is either the layoutObject we just found, or one of its containers
). |
| 108 m_caretPainter = caretLayoutObject(caretPosition.position().deprecatedNode()
); | 108 m_caretPainter = caretLayoutObject(caretPosition.position().anchorNode()); |
| 109 | 109 |
| 110 mapCaretRectToCaretPainter(layoutObject, m_caretPainter, m_caretLocalRect); | 110 mapCaretRectToCaretPainter(layoutObject, m_caretPainter, m_caretLocalRect); |
| 111 | 111 |
| 112 return true; | 112 return true; |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool CaretBase::updateCaretRect(Document* document, const VisiblePosition& caret
Position) | 115 bool CaretBase::updateCaretRect(Document* document, const VisiblePosition& caret
Position) |
| 116 { | 116 { |
| 117 return updateCaretRect(document, PositionWithAffinity(caretPosition.deepEqui
valent(), caretPosition.affinity())); | 117 return updateCaretRect(document, PositionWithAffinity(caretPosition.deepEqui
valent(), caretPosition.affinity())); |
| 118 } | 118 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 else | 197 else |
| 198 element = node->parentElement(); | 198 element = node->parentElement(); |
| 199 | 199 |
| 200 if (element && element->layoutObject()) | 200 if (element && element->layoutObject()) |
| 201 caretColor = element->layoutObject()->resolveColor(CSSPropertyColor); | 201 caretColor = element->layoutObject()->resolveColor(CSSPropertyColor); |
| 202 | 202 |
| 203 context->fillRect(caret, caretColor); | 203 context->fillRect(caret, caretColor); |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace blink | 206 } // namespace blink |
| OLD | NEW |