Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: third_party/WebKit/Source/core/editing/CaretDisplayItemClient.cpp

Issue 2732573003: Skip paint property update and visual rect update if no geometry change (Closed)
Patch Set: - Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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"
37 #include "core/paint/ObjectPaintInvalidator.h" 38 #include "core/paint/ObjectPaintInvalidator.h"
38 #include "core/paint/PaintInfo.h" 39 #include "core/paint/PaintInfo.h"
39 #include "core/paint/PaintInvalidator.h" 40 #include "core/paint/PaintInvalidator.h"
40 #include "core/paint/PaintLayer.h" 41 #include "core/paint/PaintLayer.h"
41 #include "platform/graphics/GraphicsContext.h" 42 #include "platform/graphics/GraphicsContext.h"
42 #include "platform/graphics/paint/DrawingRecorder.h" 43 #include "platform/graphics/paint/DrawingRecorder.h"
43 44
44 namespace blink { 45 namespace blink {
45 46
46 CaretDisplayItemClient::CaretDisplayItemClient() = default; 47 CaretDisplayItemClient::CaretDisplayItemClient() = default;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 context.paintingLayer->setNeedsRepaint(); 217 context.paintingLayer->setNeedsRepaint();
217 objectInvalidator.invalidateDisplayItemClient(*this, PaintInvalidationCaret); 218 objectInvalidator.invalidateDisplayItemClient(*this, PaintInvalidationCaret);
218 m_previousLayoutBlock = nullptr; 219 m_previousLayoutBlock = nullptr;
219 } 220 }
220 221
221 void CaretDisplayItemClient::invalidatePaintInCurrentLayoutBlock( 222 void CaretDisplayItemClient::invalidatePaintInCurrentLayoutBlock(
222 const PaintInvalidatorContext& context) { 223 const PaintInvalidatorContext& context) {
223 DCHECK(m_layoutBlock); 224 DCHECK(m_layoutBlock);
224 225
225 LayoutRect newVisualRect; 226 LayoutRect newVisualRect;
226 if (!m_localRect.isEmpty()) { 227 #if DCHECK_IS_ON()
227 newVisualRect = m_localRect; 228 FindVisualRectNeedingUpdateScope finder(*m_layoutBlock, context, m_visualRect,
228 context.mapLocalRectToVisualRectInBacking(*m_layoutBlock, newVisualRect); 229 newVisualRect);
230 #endif
231 if (context.needsVisualRectUpdate(*m_layoutBlock)) {
232 if (!m_localRect.isEmpty()) {
233 newVisualRect = m_localRect;
234 context.mapLocalRectToVisualRectInBacking(*m_layoutBlock, newVisualRect);
229 235
230 if (m_layoutBlock->usesCompositedScrolling()) { 236 if (m_layoutBlock->usesCompositedScrolling()) {
231 // The caret should use scrolling coordinate space. 237 // The caret should use scrolling coordinate space.
232 DCHECK(m_layoutBlock == context.paintInvalidationContainer); 238 DCHECK(m_layoutBlock == context.paintInvalidationContainer);
233 newVisualRect.move(LayoutSize(m_layoutBlock->scrolledContentOffset())); 239 newVisualRect.move(LayoutSize(m_layoutBlock->scrolledContentOffset()));
240 }
234 } 241 }
242 } else {
243 newVisualRect = m_visualRect;
235 } 244 }
236 245
237 if (m_layoutBlock == m_previousLayoutBlock) 246 if (m_layoutBlock == m_previousLayoutBlock)
238 m_previousLayoutBlock = nullptr; 247 m_previousLayoutBlock = nullptr;
239 248
240 ObjectPaintInvalidatorWithContext objectInvalidator(*m_layoutBlock, context); 249 ObjectPaintInvalidatorWithContext objectInvalidator(*m_layoutBlock, context);
241 if (!m_needsPaintInvalidation && newVisualRect == m_visualRect) { 250 if (!m_needsPaintInvalidation && newVisualRect == m_visualRect) {
242 // The caret may change paint offset without changing visual rect, and we 251 // The caret may change paint offset without changing visual rect, and we
243 // need to invalidate the display item client if the block is doing full 252 // need to invalidate the display item client if the block is doing full
244 // paint invalidation. 253 // paint invalidation.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 297
289 String CaretDisplayItemClient::debugName() const { 298 String CaretDisplayItemClient::debugName() const {
290 return "Caret"; 299 return "Caret";
291 } 300 }
292 301
293 LayoutRect CaretDisplayItemClient::visualRect() const { 302 LayoutRect CaretDisplayItemClient::visualRect() const {
294 return m_visualRect; 303 return m_visualRect;
295 } 304 }
296 305
297 } // namespace blink 306 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698