| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 if (!m_previousLayoutBlock) { | 126 if (!m_previousLayoutBlock) { |
| 127 m_previousLayoutBlock = m_layoutBlock; | 127 m_previousLayoutBlock = m_layoutBlock; |
| 128 m_visualRectInPreviousLayoutBlock = m_visualRect; | 128 m_visualRectInPreviousLayoutBlock = m_visualRect; |
| 129 } | 129 } |
| 130 | 130 |
| 131 LayoutBlock* newLayoutBlock = caretLayoutBlock(caretPosition.anchorNode()); | 131 LayoutBlock* newLayoutBlock = caretLayoutBlock(caretPosition.anchorNode()); |
| 132 if (newLayoutBlock != m_layoutBlock) { | 132 if (newLayoutBlock != m_layoutBlock) { |
| 133 if (m_layoutBlock) | 133 if (m_layoutBlock) |
| 134 m_layoutBlock->setMayNeedPaintInvalidation(); | 134 m_layoutBlock->setMayNeedPaintInvalidation(); |
| 135 m_layoutBlock = newLayoutBlock; | 135 m_layoutBlock = newLayoutBlock; |
| 136 if (newLayoutBlock) | 136 m_visualRect = LayoutRect(); |
| 137 if (newLayoutBlock) { |
| 137 m_needsPaintInvalidation = true; | 138 m_needsPaintInvalidation = true; |
| 138 m_visualRect = LayoutRect(); | 139 if (newLayoutBlock == m_previousLayoutBlock) { |
| 140 // The caret has disappeared and is reappearing in the same block, |
| 141 // since the last paint invalidation. Set m_visualRect as if the caret |
| 142 // has always been there as paint invalidation doesn't care about the |
| 143 // intermediate changes. |
| 144 m_visualRect = m_visualRectInPreviousLayoutBlock; |
| 145 } |
| 146 } |
| 139 } | 147 } |
| 140 | 148 |
| 141 if (!newLayoutBlock) { | 149 if (!newLayoutBlock) { |
| 142 m_color = Color(); | 150 m_color = Color(); |
| 143 m_localRect = LayoutRect(); | 151 m_localRect = LayoutRect(); |
| 144 return; | 152 return; |
| 145 } | 153 } |
| 146 | 154 |
| 147 Color newColor; | 155 Color newColor; |
| 148 if (caretPosition.anchorNode()) { | 156 if (caretPosition.anchorNode()) { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 274 |
| 267 String CaretDisplayItemClient::debugName() const { | 275 String CaretDisplayItemClient::debugName() const { |
| 268 return "Caret"; | 276 return "Caret"; |
| 269 } | 277 } |
| 270 | 278 |
| 271 LayoutRect CaretDisplayItemClient::visualRect() const { | 279 LayoutRect CaretDisplayItemClient::visualRect() const { |
| 272 return m_visualRect; | 280 return m_visualRect; |
| 273 } | 281 } |
| 274 | 282 |
| 275 } // namespace blink | 283 } // namespace blink |
| OLD | NEW |