Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp

Issue 2707063003: Don't invalidate rect if it's covered by fully invalidated parent's visual rect (Closed)
Patch Set: - Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 bool ObjectPaintInvalidatorWithContext::parentFullyInvalidatedOnSameBacking() {
468 if (!m_object.parent() || !m_context.parentContext)
469 return false;
470
471 if (!isImmediateFullPaintInvalidationReason(
472 m_object.parent()->fullPaintInvalidationReason()))
473 return false;
474
475 // Parent and child should have the same paint invalidation container.
476 if (m_context.parentContext->paintInvalidationContainer !=
477 m_context.paintInvalidationContainer)
478 return false;
479
480 // Both parent and child are contents of the paint invalidation container,
481 // so they are on the same backing.
482 if (m_object.parent() != m_context.paintInvalidationContainer)
483 return true;
484
485 // If the paint invalidation container (i.e. parent) uses composited
486 // scrolling, parent and child might be on different backing (scrolling
487 // container vs scrolling contents).
488 return !m_context.paintInvalidationContainer->usesCompositedScrolling();
489 }
490
491 void ObjectPaintInvalidatorWithContext::invalidatePaintRectangleWithContext(
492 const LayoutRect& rect,
493 PaintInvalidationReason reason) {
494 if (rect.isEmpty())
495 return;
496
497 // If the parent has fully invalidated and its visual rect covers this object
498 // on the same backing, skip the invalidation.
499 if (parentFullyInvalidatedOnSameBacking() &&
500 (m_context.parentContext->oldVisualRect.contains(rect) ||
501 m_context.parentContext->newVisualRect.contains(rect)))
502 return;
503
504 invalidatePaintUsingContainer(*m_context.paintInvalidationContainer, rect,
505 reason);
467 } 506 }
468 507
469 DISABLE_CFI_PERF 508 DISABLE_CFI_PERF
470 PaintInvalidationReason 509 PaintInvalidationReason
471 ObjectPaintInvalidatorWithContext::computePaintInvalidationReason() { 510 ObjectPaintInvalidatorWithContext::computePaintInvalidationReason() {
472 // This is before any early return to ensure the background obscuration status 511 // This is before any early return to ensure the background obscuration status
473 // is saved. 512 // is saved.
474 bool backgroundObscurationChanged = false; 513 bool backgroundObscurationChanged = false;
475 bool backgroundObscured = m_object.backgroundIsKnownToBeObscured(); 514 bool backgroundObscured = m_object.backgroundIsKnownToBeObscured();
476 if (backgroundObscured != m_object.previousBackgroundObscured()) { 515 if (backgroundObscured != m_object.previousBackgroundObscured()) {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 650
612 m_context.paintingLayer->setNeedsRepaint(); 651 m_context.paintingLayer->setNeedsRepaint();
613 m_object.invalidateDisplayItemClients(reason); 652 m_object.invalidateDisplayItemClients(reason);
614 return reason; 653 return reason;
615 } 654 }
616 655
617 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() 656 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts()
618 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} 657 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {}
619 658
620 } // namespace blink 659 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.h ('k') | third_party/WebKit/Source/core/paint/PaintInvalidator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698