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, DisplayItemClient* displayItemClient) | 277 void ObjectPaintInvalidator::invalidatePaintRectangle(const LayoutRect& dirtyRec
t) |
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 |
291 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking
, PaintInvalidationRectangle); | 292 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking
, PaintInvalidationRectangle); |
292 | 293 |
293 slowSetPaintingLayerNeedsRepaint(); | 294 slowSetPaintingLayerNeedsRepaint(); |
294 if (displayItemClient) | 295 m_object.invalidateDisplayItemClients(PaintInvalidationRectangle); |
295 invalidateDisplayItemClient(*displayItemClient, PaintInvalidationRectang
le); | |
296 else | |
297 m_object.invalidateDisplayItemClients(PaintInvalidationRectangle); | |
298 } | 296 } |
299 | 297 |
300 void ObjectPaintInvalidator::slowSetPaintingLayerNeedsRepaint() | 298 void ObjectPaintInvalidator::slowSetPaintingLayerNeedsRepaint() |
301 { | 299 { |
302 if (PaintLayer* paintingLayer = m_object.paintingLayer()) | 300 if (PaintLayer* paintingLayer = m_object.paintingLayer()) |
303 paintingLayer->setNeedsRepaint(); | 301 paintingLayer->setNeedsRepaint(); |
304 } | 302 } |
305 | 303 |
306 bool ObjectPaintInvalidatorWithContext::incrementallyInvalidatePaint() | 304 bool ObjectPaintInvalidatorWithContext::incrementallyInvalidatePaint() |
307 { | 305 { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 m_object.invalidateDisplayItemClients(reason); | 467 m_object.invalidateDisplayItemClients(reason); |
470 return reason; | 468 return reason; |
471 } | 469 } |
472 | 470 |
473 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() | 471 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() |
474 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) | 472 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) |
475 { | 473 { |
476 } | 474 } |
477 | 475 |
478 } // namespace blink | 476 } // namespace blink |
OLD | NEW |