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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
448 } | 448 } |
449 | 449 |
450 void ObjectPaintInvalidatorWithContext::fullyInvalidatePaint( | 450 void ObjectPaintInvalidatorWithContext::fullyInvalidatePaint( |
451 PaintInvalidationReason reason, | 451 PaintInvalidationReason reason, |
452 const LayoutRect& oldVisualRect, | 452 const LayoutRect& oldVisualRect, |
453 const LayoutRect& newVisualRect) { | 453 const LayoutRect& newVisualRect) { |
454 // The following logic avoids invalidating twice if one set of bounds contains | 454 // The following logic avoids invalidating twice if one set of bounds contains |
455 // the other. | 455 // the other. |
456 if (!newVisualRect.contains(oldVisualRect)) { | 456 if (!newVisualRect.contains(oldVisualRect)) { |
457 LayoutRect invalidationRect = oldVisualRect; | 457 LayoutRect invalidationRect = oldVisualRect; |
458 invalidatePaintUsingContainer(*m_context.paintInvalidationContainer, | 458 invalidatePaintRectangleWithContext(invalidationRect, reason); |
459 invalidationRect, reason); | |
460 | 459 |
461 if (invalidationRect.contains(newVisualRect)) | 460 if (invalidationRect.contains(newVisualRect)) |
462 return; | 461 return; |
463 } | 462 } |
464 | 463 |
465 invalidatePaintUsingContainer(*m_context.paintInvalidationContainer, | 464 invalidatePaintRectangleWithContext(newVisualRect, reason); |
466 newVisualRect, reason); | 465 } |
466 | |
467 void ObjectPaintInvalidatorWithContext::invalidatePaintRectangleWithContext( | |
468 const LayoutRect& rect, | |
469 PaintInvalidationReason reason) { | |
470 if (rect.isEmpty()) | |
471 return; | |
472 | |
473 // If the parent has fully invalidated and its visual rect covers this object | |
474 // on the same backing, skip the invalidation. | |
475 if (m_object.parent() && m_context.parentContext && | |
476 m_context.parentContext->paintInvalidationContainer == | |
477 m_context.paintInvalidationContainer && | |
478 // This is a quick test to exclude the case that parent and child are not | |
479 // on the same backing of the paint invalidation container. | |
480 m_object.parent() != m_context.paintInvalidationContainer && | |
wkorman
2017/02/23 01:26:25
I wanted to better understand how checking whether
Xianzhu
2017/02/23 04:38:49
The idea was that the paint invalidation container
| |
481 isImmediateFullPaintInvalidationReason( | |
482 m_object.parent()->fullPaintInvalidationReason()) && | |
483 (m_context.parentContext->oldVisualRect.contains(rect) || | |
484 m_context.parentContext->newVisualRect.contains(rect))) | |
485 return; | |
486 | |
487 invalidatePaintUsingContainer(*m_context.paintInvalidationContainer, rect, | |
488 reason); | |
467 } | 489 } |
468 | 490 |
469 DISABLE_CFI_PERF | 491 DISABLE_CFI_PERF |
470 PaintInvalidationReason | 492 PaintInvalidationReason |
471 ObjectPaintInvalidatorWithContext::computePaintInvalidationReason() { | 493 ObjectPaintInvalidatorWithContext::computePaintInvalidationReason() { |
472 // This is before any early return to ensure the background obscuration status | 494 // This is before any early return to ensure the background obscuration status |
473 // is saved. | 495 // is saved. |
474 bool backgroundObscurationChanged = false; | 496 bool backgroundObscurationChanged = false; |
475 bool backgroundObscured = m_object.backgroundIsKnownToBeObscured(); | 497 bool backgroundObscured = m_object.backgroundIsKnownToBeObscured(); |
476 if (backgroundObscured != m_object.previousBackgroundObscured()) { | 498 if (backgroundObscured != m_object.previousBackgroundObscured()) { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
611 | 633 |
612 m_context.paintingLayer->setNeedsRepaint(); | 634 m_context.paintingLayer->setNeedsRepaint(); |
613 m_object.invalidateDisplayItemClients(reason); | 635 m_object.invalidateDisplayItemClients(reason); |
614 return reason; | 636 return reason; |
615 } | 637 } |
616 | 638 |
617 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() | 639 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() |
618 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} | 640 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} |
619 | 641 |
620 } // namespace blink | 642 } // namespace blink |
OLD | NEW |