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

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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 context.paintingLayer->setNeedsRepaint(); 215 context.paintingLayer->setNeedsRepaint();
215 objectInvalidator.invalidateDisplayItemClient(*this, PaintInvalidationCaret); 216 objectInvalidator.invalidateDisplayItemClient(*this, PaintInvalidationCaret);
216 m_previousLayoutBlock = nullptr; 217 m_previousLayoutBlock = nullptr;
217 } 218 }
218 219
219 void CaretDisplayItemClient::invalidatePaintInCurrentLayoutBlock( 220 void CaretDisplayItemClient::invalidatePaintInCurrentLayoutBlock(
220 const PaintInvalidatorContext& context) { 221 const PaintInvalidatorContext& context) {
221 DCHECK(m_layoutBlock); 222 DCHECK(m_layoutBlock);
222 223
223 LayoutRect newVisualRect; 224 LayoutRect newVisualRect;
224 if (!m_localRect.isEmpty()) { 225 #if DCHECK_IS_ON()
225 newVisualRect = m_localRect; 226 FindVisualRectNeedingUpdateScope finder(*m_layoutBlock, context, m_visualRect,
226 context.mapLocalRectToVisualRectInBacking(*m_layoutBlock, newVisualRect); 227 newVisualRect);
228 #endif
229 if (context.needsVisualRectUpdate(*m_layoutBlock)) {
230 if (!m_localRect.isEmpty()) {
231 newVisualRect = m_localRect;
232 context.mapLocalRectToVisualRectInBacking(*m_layoutBlock, newVisualRect);
227 233
228 if (m_layoutBlock->usesCompositedScrolling()) { 234 if (m_layoutBlock->usesCompositedScrolling()) {
229 // The caret should use scrolling coordinate space. 235 // The caret should use scrolling coordinate space.
230 DCHECK(m_layoutBlock == context.paintInvalidationContainer); 236 DCHECK(m_layoutBlock == context.paintInvalidationContainer);
231 newVisualRect.move(LayoutSize(m_layoutBlock->scrolledContentOffset())); 237 newVisualRect.move(LayoutSize(m_layoutBlock->scrolledContentOffset()));
238 }
232 } 239 }
240 } else {
241 newVisualRect = m_visualRect;
233 } 242 }
234 243
235 if (m_layoutBlock == m_previousLayoutBlock) 244 if (m_layoutBlock == m_previousLayoutBlock)
236 m_previousLayoutBlock = nullptr; 245 m_previousLayoutBlock = nullptr;
237 246
238 ObjectPaintInvalidatorWithContext objectInvalidator(*m_layoutBlock, context); 247 ObjectPaintInvalidatorWithContext objectInvalidator(*m_layoutBlock, context);
239 if (!m_needsPaintInvalidation && newVisualRect == m_visualRect) { 248 if (!m_needsPaintInvalidation && newVisualRect == m_visualRect) {
240 // The caret may change paint offset without changing visual rect, and we 249 // The caret may change paint offset without changing visual rect, and we
241 // need to invalidate the display item client if the block is doing full 250 // need to invalidate the display item client if the block is doing full
242 // paint invalidation. 251 // paint invalidation.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 295
287 String CaretDisplayItemClient::debugName() const { 296 String CaretDisplayItemClient::debugName() const {
288 return "Caret"; 297 return "Caret";
289 } 298 }
290 299
291 LayoutRect CaretDisplayItemClient::visualRect() const { 300 LayoutRect CaretDisplayItemClient::visualRect() const {
292 return m_visualRect; 301 return m_visualRect;
293 } 302 }
294 303
295 } // namespace blink 304 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698