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/LayoutView.h" | 9 #include "core/layout/LayoutView.h" |
10 #include "core/layout/api/LayoutPartItem.h" | 10 #include "core/layout/api/LayoutPartItem.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 return value; | 274 return value; |
275 } | 275 } |
276 | 276 |
277 static void invalidatePaintRectangleOnWindow( | 277 static void invalidatePaintRectangleOnWindow( |
278 const LayoutBoxModelObject& paintInvalidationContainer, | 278 const LayoutBoxModelObject& paintInvalidationContainer, |
279 const IntRect& dirtyRect) { | 279 const IntRect& dirtyRect) { |
280 FrameView* frameView = paintInvalidationContainer.frameView(); | 280 FrameView* frameView = paintInvalidationContainer.frameView(); |
281 DCHECK(paintInvalidationContainer.isLayoutView() && | 281 DCHECK(paintInvalidationContainer.isLayoutView() && |
282 paintInvalidationContainer.layer()->compositingState() == | 282 paintInvalidationContainer.layer()->compositingState() == |
283 NotComposited); | 283 NotComposited); |
284 if (!frameView || paintInvalidationContainer.document().printing()) | 284 |
| 285 if (!frameView) |
| 286 return; |
| 287 |
| 288 if (paintInvalidationContainer.document().printing() && |
| 289 !RuntimeEnabledFeatures::printBrowserEnabled()) |
285 return; | 290 return; |
286 | 291 |
287 DCHECK(frameView->frame().ownerLayoutItem().isNull()); | 292 DCHECK(frameView->frame().ownerLayoutItem().isNull()); |
288 | 293 |
289 IntRect paintRect = dirtyRect; | 294 IntRect paintRect = dirtyRect; |
290 paintRect.intersect(frameView->visibleContentRect()); | 295 paintRect.intersect(frameView->visibleContentRect()); |
291 if (paintRect.isEmpty()) | 296 if (paintRect.isEmpty()) |
292 return; | 297 return; |
293 | 298 |
294 if (HostWindow* window = frameView->getHostWindow()) | 299 if (HostWindow* window = frameView->getHostWindow()) |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 } | 389 } |
385 | 390 |
386 LayoutRect ObjectPaintInvalidator::invalidatePaintRectangle( | 391 LayoutRect ObjectPaintInvalidator::invalidatePaintRectangle( |
387 const LayoutRect& dirtyRect, | 392 const LayoutRect& dirtyRect, |
388 DisplayItemClient* displayItemClient) { | 393 DisplayItemClient* displayItemClient) { |
389 CHECK(m_object.isRooted()); | 394 CHECK(m_object.isRooted()); |
390 | 395 |
391 if (dirtyRect.isEmpty()) | 396 if (dirtyRect.isEmpty()) |
392 return LayoutRect(); | 397 return LayoutRect(); |
393 | 398 |
394 if (m_object.view()->document().printing()) | 399 if (m_object.view()->document().printing() && |
| 400 !RuntimeEnabledFeatures::printBrowserEnabled()) |
395 return LayoutRect(); // Don't invalidate paints if we're printing. | 401 return LayoutRect(); // Don't invalidate paints if we're printing. |
396 | 402 |
397 const LayoutBoxModelObject& paintInvalidationContainer = | 403 const LayoutBoxModelObject& paintInvalidationContainer = |
398 m_object.containerForPaintInvalidation(); | 404 m_object.containerForPaintInvalidation(); |
399 LayoutRect dirtyRectOnBacking = dirtyRect; | 405 LayoutRect dirtyRectOnBacking = dirtyRect; |
400 PaintLayer::mapRectToPaintInvalidationBacking( | 406 PaintLayer::mapRectToPaintInvalidationBacking( |
401 m_object, paintInvalidationContainer, dirtyRectOnBacking); | 407 m_object, paintInvalidationContainer, dirtyRectOnBacking); |
402 dirtyRectOnBacking.move(m_object.scrollAdjustmentForPaintInvalidation( | 408 dirtyRectOnBacking.move(m_object.scrollAdjustmentForPaintInvalidation( |
403 paintInvalidationContainer)); | 409 paintInvalidationContainer)); |
404 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking, | 410 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking, |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 | 611 |
606 m_context.paintingLayer->setNeedsRepaint(); | 612 m_context.paintingLayer->setNeedsRepaint(); |
607 m_object.invalidateDisplayItemClients(reason); | 613 m_object.invalidateDisplayItemClients(reason); |
608 return reason; | 614 return reason; |
609 } | 615 } |
610 | 616 |
611 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() | 617 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() |
612 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} | 618 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} |
613 | 619 |
614 } // namespace blink | 620 } // namespace blink |
OLD | NEW |