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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // previous paint invalidated block will be invalidated. We don't care about | 124 // previous paint invalidated block will be invalidated. We don't care about |
125 // intermediate changes of layoutBlock because they are not painted. | 125 // intermediate changes of layoutBlock because they are not painted. |
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->setMayNeedPaintInvalidationWithoutGeometryChange(); |
135 m_layoutBlock = newLayoutBlock; | 135 m_layoutBlock = newLayoutBlock; |
136 if (newLayoutBlock) | 136 if (newLayoutBlock) |
137 m_needsPaintInvalidation = true; | 137 m_needsPaintInvalidation = true; |
138 m_visualRect = LayoutRect(); | 138 m_visualRect = LayoutRect(); |
139 } | 139 } |
140 | 140 |
141 if (!newLayoutBlock) { | 141 if (!newLayoutBlock) { |
142 m_color = Color(); | 142 m_color = Color(); |
143 m_localRect = LayoutRect(); | 143 m_localRect = LayoutRect(); |
144 return; | 144 return; |
145 } | 145 } |
146 | 146 |
147 Color newColor; | 147 Color newColor; |
148 if (caretPosition.anchorNode()) { | 148 if (caretPosition.anchorNode()) { |
149 newColor = caretPosition.anchorNode()->layoutObject()->resolveColor( | 149 newColor = caretPosition.anchorNode()->layoutObject()->resolveColor( |
150 CSSPropertyCaretColor); | 150 CSSPropertyCaretColor); |
151 } | 151 } |
152 if (newColor != m_color) { | 152 if (newColor != m_color) { |
153 m_needsPaintInvalidation = true; | 153 m_needsPaintInvalidation = true; |
154 m_color = newColor; | 154 m_color = newColor; |
155 } | 155 } |
156 | 156 |
157 LayoutRect newLocalRect = computeCaretRect(caretPosition); | 157 LayoutRect newLocalRect = computeCaretRect(caretPosition); |
158 if (newLocalRect != m_localRect) { | 158 if (newLocalRect != m_localRect) { |
159 m_needsPaintInvalidation = true; | 159 m_needsPaintInvalidation = true; |
160 m_localRect = newLocalRect; | 160 m_localRect = newLocalRect; |
161 } | 161 } |
162 | 162 |
163 if (m_needsPaintInvalidation) | 163 if (m_needsPaintInvalidation) |
164 newLayoutBlock->setMayNeedPaintInvalidation(); | 164 newLayoutBlock->setMayNeedPaintInvalidationWithoutGeometryChange(); |
165 } | 165 } |
166 | 166 |
167 void CaretDisplayItemClient::invalidatePaintIfNeeded( | 167 void CaretDisplayItemClient::invalidatePaintIfNeeded( |
168 const LayoutBlock& block, | 168 const LayoutBlock& block, |
169 const PaintInvalidatorContext& context) { | 169 const PaintInvalidatorContext& context) { |
170 if (block == m_layoutBlock) { | 170 if (block == m_layoutBlock) { |
171 invalidatePaintInCurrentLayoutBlock(context); | 171 invalidatePaintInCurrentLayoutBlock(context); |
172 return; | 172 return; |
173 } | 173 } |
174 | 174 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 266 |
267 String CaretDisplayItemClient::debugName() const { | 267 String CaretDisplayItemClient::debugName() const { |
268 return "Caret"; | 268 return "Caret"; |
269 } | 269 } |
270 | 270 |
271 LayoutRect CaretDisplayItemClient::visualRect() const { | 271 LayoutRect CaretDisplayItemClient::visualRect() const { |
272 return m_visualRect; | 272 return m_visualRect; |
273 } | 273 } |
274 | 274 |
275 } // namespace blink | 275 } // namespace blink |
OLD | NEW |