| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // Get the layoutObject that will be responsible for painting the caret | 108 // Get the layoutObject that will be responsible for painting the caret |
| 109 // (which is either the layoutObject we just found, or one of its containers). | 109 // (which is either the layoutObject we just found, or one of its containers). |
| 110 LayoutBlockItem caretPainterItem = | 110 LayoutBlockItem caretPainterItem = |
| 111 LayoutBlockItem(caretLayoutBlock(caretPosition.anchorNode())); | 111 LayoutBlockItem(caretLayoutBlock(caretPosition.anchorNode())); |
| 112 LayoutRect caretLocalRectWithWritingMode = caretLocalRect; | 112 LayoutRect caretLocalRectWithWritingMode = caretLocalRect; |
| 113 caretPainterItem.flipForWritingMode(caretLocalRectWithWritingMode); | 113 caretPainterItem.flipForWritingMode(caretLocalRectWithWritingMode); |
| 114 return mapCaretRectToCaretPainter(LayoutItem(layoutObject), caretPainterItem, | 114 return mapCaretRectToCaretPainter(LayoutItem(layoutObject), caretPainterItem, |
| 115 caretLocalRectWithWritingMode); | 115 caretLocalRectWithWritingMode); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void CaretDisplayItemClient::clearPreviousVisualRect(const LayoutBlock& block) { |
| 119 if (block == m_layoutBlock) { |
| 120 m_visualRect = LayoutRect(); |
| 121 m_localRect = LayoutRect(); |
| 122 } |
| 123 if (block == m_previousLayoutBlock) |
| 124 m_visualRectInPreviousLayoutBlock = LayoutRect(); |
| 125 } |
| 126 |
| 127 void CaretDisplayItemClient::layoutBlockWillBeDestroyed( |
| 128 const LayoutBlock& block) { |
| 129 if (block == m_layoutBlock) |
| 130 m_layoutBlock = nullptr; |
| 131 if (block == m_previousLayoutBlock) |
| 132 m_previousLayoutBlock = nullptr; |
| 133 } |
| 134 |
| 118 void CaretDisplayItemClient::updateStyleAndLayoutIfNeeded( | 135 void CaretDisplayItemClient::updateStyleAndLayoutIfNeeded( |
| 119 const PositionWithAffinity& caretPosition) { | 136 const PositionWithAffinity& caretPosition) { |
| 120 // This method may be called multiple times (e.g. in partial lifecycle | 137 // This method may be called multiple times (e.g. in partial lifecycle |
| 121 // updates) before a paint invalidation. We should save m_previousLayoutBlock | 138 // updates) before a paint invalidation. We should save m_previousLayoutBlock |
| 122 // and m_visualRectInPreviousLayoutBlock only if they have not been saved | 139 // and m_visualRectInPreviousLayoutBlock only if they have not been saved |
| 123 // since the last paint invalidation to ensure the caret painted in the | 140 // since the last paint invalidation to ensure the caret painted in the |
| 124 // previous paint invalidated block will be invalidated. We don't care about | 141 // previous paint invalidated block will be invalidated. We don't care about |
| 125 // intermediate changes of layoutBlock because they are not painted. | 142 // intermediate changes of layoutBlock because they are not painted. |
| 126 if (!m_previousLayoutBlock) { | 143 if (!m_previousLayoutBlock) { |
| 127 m_previousLayoutBlock = m_layoutBlock; | 144 m_previousLayoutBlock = m_layoutBlock; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 288 |
| 272 String CaretDisplayItemClient::debugName() const { | 289 String CaretDisplayItemClient::debugName() const { |
| 273 return "Caret"; | 290 return "Caret"; |
| 274 } | 291 } |
| 275 | 292 |
| 276 LayoutRect CaretDisplayItemClient::visualRect() const { | 293 LayoutRect CaretDisplayItemClient::visualRect() const { |
| 277 return m_visualRect; | 294 return m_visualRect; |
| 278 } | 295 } |
| 279 | 296 |
| 280 } // namespace blink | 297 } // namespace blink |
| OLD | NEW |