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

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

Issue 2888253002: Skip both paint and raster invalidation for LayoutSVGHiddenContainer subtree (Closed)
Patch Set: Rebaseline-cl Created 3 years, 7 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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 // container vs scrolling contents). 492 // container vs scrolling contents).
493 return !context_.paint_invalidation_container->UsesCompositedScrolling(); 493 return !context_.paint_invalidation_container->UsesCompositedScrolling();
494 } 494 }
495 495
496 void ObjectPaintInvalidatorWithContext::InvalidatePaintRectangleWithContext( 496 void ObjectPaintInvalidatorWithContext::InvalidatePaintRectangleWithContext(
497 const LayoutRect& rect, 497 const LayoutRect& rect,
498 PaintInvalidationReason reason) { 498 PaintInvalidationReason reason) {
499 if (rect.IsEmpty()) 499 if (rect.IsEmpty())
500 return; 500 return;
501 501
502 if (context_.forced_subtree_invalidation_flags &
503 PaintInvalidatorContext::kForcedSubtreeNoRasterInvalidation)
504 return;
505
506 // If the parent has fully invalidated and its visual rect covers this object 502 // If the parent has fully invalidated and its visual rect covers this object
507 // on the same backing, skip the invalidation. 503 // on the same backing, skip the invalidation.
508 if (ParentFullyInvalidatedOnSameBacking() && 504 if (ParentFullyInvalidatedOnSameBacking() &&
509 (context_.parent_context->old_visual_rect.Contains(rect) || 505 (context_.parent_context->old_visual_rect.Contains(rect) ||
510 object_.Parent()->VisualRect().Contains(rect))) 506 object_.Parent()->VisualRect().Contains(rect)))
511 return; 507 return;
512 508
513 InvalidatePaintUsingContainer(*context_.paint_invalidation_container, rect, 509 InvalidatePaintUsingContainer(*context_.paint_invalidation_container, rect,
514 reason); 510 reason);
515 } 511 }
516 512
517 DISABLE_CFI_PERF 513 DISABLE_CFI_PERF
518 PaintInvalidationReason 514 PaintInvalidationReason
519 ObjectPaintInvalidatorWithContext::ComputePaintInvalidationReason() { 515 ObjectPaintInvalidatorWithContext::ComputePaintInvalidationReason() {
520 // This is before any early return to ensure the background obscuration status 516 // This is before any early return to ensure the background obscuration status
521 // is saved. 517 // is saved.
522 bool background_obscuration_changed = false; 518 bool background_obscuration_changed = false;
523 bool background_obscured = object_.BackgroundIsKnownToBeObscured(); 519 bool background_obscured = object_.BackgroundIsKnownToBeObscured();
524 if (background_obscured != object_.PreviousBackgroundObscured()) { 520 if (background_obscured != object_.PreviousBackgroundObscured()) {
525 object_.GetMutableForPainting().SetPreviousBackgroundObscured( 521 object_.GetMutableForPainting().SetPreviousBackgroundObscured(
526 background_obscured); 522 background_obscured);
527 background_obscuration_changed = true; 523 background_obscuration_changed = true;
528 } 524 }
529 525
530 if (context_.forced_subtree_invalidation_flags & 526 if (context_.subtree_flags &
531 PaintInvalidatorContext::kForcedSubtreeFullInvalidation) 527 PaintInvalidatorContext::kSubtreeFullInvalidation)
532 return PaintInvalidationReason::kSubtree; 528 return PaintInvalidationReason::kSubtree;
533 529
534 if (object_.ShouldDoFullPaintInvalidation()) 530 if (object_.ShouldDoFullPaintInvalidation())
535 return object_.FullPaintInvalidationReason(); 531 return object_.FullPaintInvalidationReason();
536 532
537 if (context_.old_visual_rect.IsEmpty() && object_.VisualRect().IsEmpty()) 533 if (context_.old_visual_rect.IsEmpty() && object_.VisualRect().IsEmpty())
538 return PaintInvalidationReason::kNone; 534 return PaintInvalidationReason::kNone;
539 535
540 if (background_obscuration_changed) 536 if (background_obscuration_changed)
541 return PaintInvalidationReason::kBackground; 537 return PaintInvalidationReason::kBackground;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 old_selection_rect, new_selection_rect); 615 old_selection_rect, new_selection_rect);
620 context_.painting_layer->SetNeedsRepaint(); 616 context_.painting_layer->SetNeedsRepaint();
621 object_.InvalidateDisplayItemClients(PaintInvalidationReason::kSelection); 617 object_.InvalidateDisplayItemClients(PaintInvalidationReason::kSelection);
622 } 618 }
623 } 619 }
624 620
625 DISABLE_CFI_PERF 621 DISABLE_CFI_PERF
626 PaintInvalidationReason 622 PaintInvalidationReason
627 ObjectPaintInvalidatorWithContext::InvalidatePaintWithComputedReason( 623 ObjectPaintInvalidatorWithContext::InvalidatePaintWithComputedReason(
628 PaintInvalidationReason reason) { 624 PaintInvalidationReason reason) {
625 DCHECK(!(context_.subtree_flags &
626 PaintInvalidatorContext::kSubtreeNoInvalidation));
627
629 // We need to invalidate the selection before checking for whether we are 628 // We need to invalidate the selection before checking for whether we are
630 // doing a full invalidation. This is because we need to update the previous 629 // doing a full invalidation. This is because we need to update the previous
631 // selection rect regardless. 630 // selection rect regardless.
632 InvalidateSelectionIfNeeded(reason); 631 InvalidateSelectionIfNeeded(reason);
633 632
634 switch (reason) { 633 switch (reason) {
635 case PaintInvalidationReason::kNone: 634 case PaintInvalidationReason::kNone:
636 // There are corner cases that the display items need to be invalidated 635 // There are corner cases that the display items need to be invalidated
637 // for paint offset mutation, but incurs no pixel difference (i.e. bounds 636 // for paint offset mutation, but incurs no pixel difference (i.e. bounds
638 // stay the same) so no rect-based invalidation is issued. See 637 // stay the same) so no rect-based invalidation is issued. See
639 // crbug.com/508383 and crbug.com/515977. 638 // crbug.com/508383 and crbug.com/515977.
640 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && 639 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() &&
641 (context_.forced_subtree_invalidation_flags & 640 (context_.subtree_flags &
642 PaintInvalidatorContext::kForcedSubtreeInvalidationChecking) && 641 PaintInvalidatorContext::kSubtreeInvalidationChecking) &&
643 !object_.IsSVGChild()) { 642 !object_.IsSVGChild()) {
644 // For SPv1, we conservatively assume the object changed paint offset 643 // For SPv1, we conservatively assume the object changed paint offset
645 // except for non-root SVG whose paint offset is always zero. 644 // except for non-root SVG whose paint offset is always zero.
646 reason = PaintInvalidationReason::kGeometry; 645 reason = PaintInvalidationReason::kGeometry;
647 break; 646 break;
648 } 647 }
649 648
650 if (object_.IsSVG() && 649 if (object_.IsSVG() &&
651 (context_.forced_subtree_invalidation_flags & 650 (context_.subtree_flags &
652 PaintInvalidatorContext::kForcedSubtreeSVGResourceChange)) { 651 PaintInvalidatorContext::kSubtreeSVGResourceChange)) {
653 reason = PaintInvalidationReason::kSVGResource; 652 reason = PaintInvalidationReason::kSVGResource;
654 break; 653 break;
655 } 654 }
656 return PaintInvalidationReason::kNone; 655 return PaintInvalidationReason::kNone;
657 case PaintInvalidationReason::kDelayedFull: 656 case PaintInvalidationReason::kDelayedFull:
658 return PaintInvalidationReason::kDelayedFull; 657 return PaintInvalidationReason::kDelayedFull;
659 default: 658 default:
660 DCHECK(IsImmediateFullPaintInvalidationReason(reason)); 659 DCHECK(IsImmediateFullPaintInvalidationReason(reason));
661 // This allows descendants to know the computed reason if it's different 660 // This allows descendants to know the computed reason if it's different
662 // from the original reason before paint invalidation. 661 // from the original reason before paint invalidation.
663 object_.GetMutableForPainting() 662 object_.GetMutableForPainting()
664 .SetShouldDoFullPaintInvalidationWithoutGeometryChange(reason); 663 .SetShouldDoFullPaintInvalidationWithoutGeometryChange(reason);
665 FullyInvalidatePaint(reason, context_.old_visual_rect, 664 FullyInvalidatePaint(reason, context_.old_visual_rect,
666 object_.VisualRect()); 665 object_.VisualRect());
667 } 666 }
668 667
669 context_.painting_layer->SetNeedsRepaint(); 668 context_.painting_layer->SetNeedsRepaint();
670 object_.InvalidateDisplayItemClients(reason); 669 object_.InvalidateDisplayItemClients(reason);
671 return reason; 670 return reason;
672 } 671 }
673 672
674 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() 673 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts()
675 : disabler_(&g_disable_paint_invalidation_state_asserts, true) {} 674 : disabler_(&g_disable_paint_invalidation_state_asserts, true) {}
676 675
677 } // namespace blink 676 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698