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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #include "core/editing/EditingUtilities.h" | 28 #include "core/editing/EditingUtilities.h" |
29 #include "core/editing/VisibleUnits.h" | 29 #include "core/editing/VisibleUnits.h" |
30 #include "core/frame/FrameView.h" | 30 #include "core/frame/FrameView.h" |
31 #include "core/frame/Settings.h" | 31 #include "core/frame/Settings.h" |
32 #include "core/layout/LayoutBlock.h" | 32 #include "core/layout/LayoutBlock.h" |
33 #include "core/layout/LayoutView.h" | 33 #include "core/layout/LayoutView.h" |
34 #include "core/layout/api/LayoutBlockItem.h" | 34 #include "core/layout/api/LayoutBlockItem.h" |
35 #include "core/layout/api/LayoutItem.h" | 35 #include "core/layout/api/LayoutItem.h" |
36 #include "core/layout/api/LayoutViewItem.h" | 36 #include "core/layout/api/LayoutViewItem.h" |
37 #include "core/paint/FindPaintOffsetAndVisualRectNeedingUpdate.h" | |
38 #include "core/paint/ObjectPaintInvalidator.h" | 37 #include "core/paint/ObjectPaintInvalidator.h" |
39 #include "core/paint/PaintInfo.h" | 38 #include "core/paint/PaintInfo.h" |
40 #include "core/paint/PaintInvalidator.h" | 39 #include "core/paint/PaintInvalidator.h" |
41 #include "core/paint/PaintLayer.h" | 40 #include "core/paint/PaintLayer.h" |
42 #include "platform/graphics/GraphicsContext.h" | 41 #include "platform/graphics/GraphicsContext.h" |
43 #include "platform/graphics/paint/DrawingRecorder.h" | 42 #include "platform/graphics/paint/DrawingRecorder.h" |
44 | 43 |
45 namespace blink { | 44 namespace blink { |
46 | 45 |
47 CaretDisplayItemClient::CaretDisplayItemClient() = default; | 46 CaretDisplayItemClient::CaretDisplayItemClient() = default; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 context.paintingLayer->setNeedsRepaint(); | 214 context.paintingLayer->setNeedsRepaint(); |
216 objectInvalidator.invalidateDisplayItemClient(*this, PaintInvalidationCaret); | 215 objectInvalidator.invalidateDisplayItemClient(*this, PaintInvalidationCaret); |
217 m_previousLayoutBlock = nullptr; | 216 m_previousLayoutBlock = nullptr; |
218 } | 217 } |
219 | 218 |
220 void CaretDisplayItemClient::invalidatePaintInCurrentLayoutBlock( | 219 void CaretDisplayItemClient::invalidatePaintInCurrentLayoutBlock( |
221 const PaintInvalidatorContext& context) { | 220 const PaintInvalidatorContext& context) { |
222 DCHECK(m_layoutBlock); | 221 DCHECK(m_layoutBlock); |
223 | 222 |
224 LayoutRect newVisualRect; | 223 LayoutRect newVisualRect; |
225 #if DCHECK_IS_ON() | 224 if (!m_localRect.isEmpty()) { |
226 FindVisualRectNeedingUpdateScope finder(*m_layoutBlock, context, m_visualRect, | 225 newVisualRect = m_localRect; |
227 newVisualRect); | 226 context.mapLocalRectToVisualRectInBacking(*m_layoutBlock, newVisualRect); |
228 #endif | |
229 if (context.needsVisualRectUpdate(*m_layoutBlock)) { | |
230 if (!m_localRect.isEmpty()) { | |
231 newVisualRect = m_localRect; | |
232 context.mapLocalRectToVisualRectInBacking(*m_layoutBlock, newVisualRect); | |
233 | 227 |
234 if (m_layoutBlock->usesCompositedScrolling()) { | 228 if (m_layoutBlock->usesCompositedScrolling()) { |
235 // The caret should use scrolling coordinate space. | 229 // The caret should use scrolling coordinate space. |
236 DCHECK(m_layoutBlock == context.paintInvalidationContainer); | 230 DCHECK(m_layoutBlock == context.paintInvalidationContainer); |
237 newVisualRect.move(LayoutSize(m_layoutBlock->scrolledContentOffset())); | 231 newVisualRect.move(LayoutSize(m_layoutBlock->scrolledContentOffset())); |
238 } | |
239 } | 232 } |
240 } else { | |
241 newVisualRect = m_visualRect; | |
242 } | 233 } |
243 | 234 |
244 if (m_layoutBlock == m_previousLayoutBlock) | 235 if (m_layoutBlock == m_previousLayoutBlock) |
245 m_previousLayoutBlock = nullptr; | 236 m_previousLayoutBlock = nullptr; |
246 | 237 |
247 ObjectPaintInvalidatorWithContext objectInvalidator(*m_layoutBlock, context); | 238 ObjectPaintInvalidatorWithContext objectInvalidator(*m_layoutBlock, context); |
248 if (!m_needsPaintInvalidation && newVisualRect == m_visualRect) { | 239 if (!m_needsPaintInvalidation && newVisualRect == m_visualRect) { |
249 // The caret may change paint offset without changing visual rect, and we | 240 // The caret may change paint offset without changing visual rect, and we |
250 // need to invalidate the display item client if the block is doing full | 241 // need to invalidate the display item client if the block is doing full |
251 // paint invalidation. | 242 // paint invalidation. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 286 |
296 String CaretDisplayItemClient::debugName() const { | 287 String CaretDisplayItemClient::debugName() const { |
297 return "Caret"; | 288 return "Caret"; |
298 } | 289 } |
299 | 290 |
300 LayoutRect CaretDisplayItemClient::visualRect() const { | 291 LayoutRect CaretDisplayItemClient::visualRect() const { |
301 return m_visualRect; | 292 return m_visualRect; |
302 } | 293 } |
303 | 294 |
304 } // namespace blink | 295 } // namespace blink |
OLD | NEW |