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