OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/paint/ObjectPaintInvalidator.h" | 5 #include "core/paint/ObjectPaintInvalidator.h" |
6 | 6 |
7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "core/layout/LayoutBlockFlow.h" | 9 #include "core/layout/LayoutBlockFlow.h" |
10 #include "core/layout/compositing/CompositedLayerMapping.h" | 10 #include "core/layout/compositing/CompositedLayerMapping.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 267 |
268 // This conditional handles situations where non-rooted (and hence non-compo
sited) frames are | 268 // This conditional handles situations where non-rooted (and hence non-compo
sited) frames are |
269 // painted, such as SVG images. | 269 // painted, such as SVG images. |
270 if (!paintInvalidationContainer.isPaintInvalidationContainer()) | 270 if (!paintInvalidationContainer.isPaintInvalidationContainer()) |
271 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn
tRect(dirtyRect)); | 271 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn
tRect(dirtyRect)); |
272 | 272 |
273 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio
nContainer.isPaintInvalidationContainer()) | 273 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio
nContainer.isPaintInvalidationContainer()) |
274 setBackingNeedsPaintInvalidationInRect(paintInvalidationContainer, dirty
Rect, invalidationReason); | 274 setBackingNeedsPaintInvalidationInRect(paintInvalidationContainer, dirty
Rect, invalidationReason); |
275 } | 275 } |
276 | 276 |
277 void ObjectPaintInvalidator::invalidatePaintRectangle(const LayoutRect& dirtyRec
t) | 277 void ObjectPaintInvalidator::invalidatePaintRectangle(const LayoutRect& dirtyRec
t, DisplayItemClient* displayItemClient) |
278 { | 278 { |
279 CHECK(m_object.isRooted()); | 279 CHECK(m_object.isRooted()); |
280 | 280 |
281 if (dirtyRect.isEmpty()) | 281 if (dirtyRect.isEmpty()) |
282 return; | 282 return; |
283 | 283 |
284 if (m_object.view()->document().printing()) | 284 if (m_object.view()->document().printing()) |
285 return; // Don't invalidate paints if we're printing. | 285 return; // Don't invalidate paints if we're printing. |
286 | 286 |
287 const LayoutBoxModelObject& paintInvalidationContainer = m_object.containerF
orPaintInvalidation(); | 287 const LayoutBoxModelObject& paintInvalidationContainer = m_object.containerF
orPaintInvalidation(); |
288 LayoutRect dirtyRectOnBacking = dirtyRect; | 288 LayoutRect dirtyRectOnBacking = dirtyRect; |
289 PaintLayer::mapRectToPaintInvalidationBacking(m_object, paintInvalidationCon
tainer, dirtyRectOnBacking); | 289 PaintLayer::mapRectToPaintInvalidationBacking(m_object, paintInvalidationCon
tainer, dirtyRectOnBacking); |
290 dirtyRectOnBacking.move(m_object.scrollAdjustmentForPaintInvalidation(paintI
nvalidationContainer)); | 290 dirtyRectOnBacking.move(m_object.scrollAdjustmentForPaintInvalidation(paintI
nvalidationContainer)); |
291 | |
292 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking
, PaintInvalidationRectangle); | 291 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking
, PaintInvalidationRectangle); |
293 | 292 |
294 slowSetPaintingLayerNeedsRepaint(); | 293 slowSetPaintingLayerNeedsRepaint(); |
295 m_object.invalidateDisplayItemClients(PaintInvalidationRectangle); | 294 if (displayItemClient) |
| 295 invalidateDisplayItemClient(*displayItemClient, PaintInvalidationRectang
le); |
| 296 else |
| 297 m_object.invalidateDisplayItemClients(PaintInvalidationRectangle); |
296 } | 298 } |
297 | 299 |
298 void ObjectPaintInvalidator::slowSetPaintingLayerNeedsRepaint() | 300 void ObjectPaintInvalidator::slowSetPaintingLayerNeedsRepaint() |
299 { | 301 { |
300 if (PaintLayer* paintingLayer = m_object.paintingLayer()) | 302 if (PaintLayer* paintingLayer = m_object.paintingLayer()) |
301 paintingLayer->setNeedsRepaint(); | 303 paintingLayer->setNeedsRepaint(); |
302 } | 304 } |
303 | 305 |
304 bool ObjectPaintInvalidatorWithContext::incrementallyInvalidatePaint() | 306 bool ObjectPaintInvalidatorWithContext::incrementallyInvalidatePaint() |
305 { | 307 { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 m_object.invalidateDisplayItemClients(reason); | 469 m_object.invalidateDisplayItemClients(reason); |
468 return reason; | 470 return reason; |
469 } | 471 } |
470 | 472 |
471 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() | 473 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() |
472 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) | 474 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) |
473 { | 475 { |
474 } | 476 } |
475 | 477 |
476 } // namespace blink | 478 } // namespace blink |
OLD | NEW |