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

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

Issue 2540043002: Fix descendant-dependent PaintLayer flags update to not early-out when dirty. (Closed)
Patch Set: none Created 4 years 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 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@web.de> 10 * Christian Biesinger <cbiesinger@web.de>
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 // FIXME: remove this special-case code that works around the paint 633 // FIXME: remove this special-case code that works around the paint
634 // invalidation code structure. 634 // invalidation code structure.
635 layoutObject.mapToVisualRectInAncestorSpace(&paintInvalidationContainer, 635 layoutObject.mapToVisualRectInAncestorSpace(&paintInvalidationContainer,
636 rect); 636 rect);
637 637
638 mapRectInPaintInvalidationContainerToBacking(paintInvalidationContainer, 638 mapRectInPaintInvalidationContainerToBacking(paintInvalidationContainer,
639 rect); 639 rect);
640 } 640 }
641 641
642 void PaintLayer::dirtyVisibleContentStatus() { 642 void PaintLayer::dirtyVisibleContentStatus() {
643 compositor()->setNeedsUpdateDescendantDependentFlags();
644 m_isVisibleContentDirty = true; 643 m_isVisibleContentDirty = true;
645 if (parent()) 644 if (parent())
646 parent()->dirtyAncestorChainVisibleDescendantStatus(); 645 parent()->dirtyAncestorChainVisibleDescendantStatus();
647 // Non-self-painting layers paint into their ancestor layer, and count as part 646 // Non-self-painting layers paint into their ancestor layer, and count as part
648 // of the "visible contents" of the parent, so we need to dirty it. 647 // of the "visible contents" of the parent, so we need to dirty it.
649 if (!isSelfPaintingLayer()) 648 if (!isSelfPaintingLayer())
650 parent()->dirtyVisibleContentStatus(); 649 parent()->dirtyVisibleContentStatus();
651 } 650 }
652 651
653 void PaintLayer::potentiallyDirtyVisibleContentStatus(EVisibility visibility) { 652 void PaintLayer::potentiallyDirtyVisibleContentStatus(EVisibility visibility) {
654 if (m_isVisibleContentDirty) 653 if (m_isVisibleContentDirty)
655 return; 654 return;
656 if (hasVisibleContent() == (visibility == EVisibility::Visible)) 655 if (hasVisibleContent() == (visibility == EVisibility::Visible))
657 return; 656 return;
658 dirtyVisibleContentStatus(); 657 dirtyVisibleContentStatus();
659 } 658 }
660 659
661 void PaintLayer::dirtyAncestorChainVisibleDescendantStatus() { 660 void PaintLayer::dirtyAncestorChainVisibleDescendantStatus() {
662 compositor()->setNeedsUpdateDescendantDependentFlags();
663
664 for (PaintLayer* layer = this; layer; layer = layer->parent()) { 661 for (PaintLayer* layer = this; layer; layer = layer->parent()) {
665 if (layer->m_isVisibleDescendantDirty) 662 if (layer->m_isVisibleDescendantDirty)
666 break; 663 break;
667 layer->m_isVisibleDescendantDirty = true; 664 layer->m_isVisibleDescendantDirty = true;
668 } 665 }
669 } 666 }
670 667
671 // FIXME: this is quite brute-force. We could be more efficient if we were to 668 // FIXME: this is quite brute-force. We could be more efficient if we were to
672 // track state and update it as appropriate as changes are made in the layout 669 // track state and update it as appropriate as changes are made in the layout
673 // tree. 670 // tree.
(...skipping 23 matching lines...) Expand all
697 } 694 }
698 695
699 void PaintLayer::updateDescendantDependentFlags() { 696 void PaintLayer::updateDescendantDependentFlags() {
700 if (m_isVisibleDescendantDirty) { 697 if (m_isVisibleDescendantDirty) {
701 m_hasVisibleDescendant = false; 698 m_hasVisibleDescendant = false;
702 699
703 for (PaintLayer* child = firstChild(); child; 700 for (PaintLayer* child = firstChild(); child;
704 child = child->nextSibling()) { 701 child = child->nextSibling()) {
705 child->updateDescendantDependentFlags(); 702 child->updateDescendantDependentFlags();
706 703
707 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) { 704 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant)
708 m_hasVisibleDescendant = true; 705 m_hasVisibleDescendant = true;
709 break;
chrishtr 2016/11/30 15:26:38 Here is where it used to incorrectly early-out of
710 }
711 } 706 }
712 707
713 m_isVisibleDescendantDirty = false; 708 m_isVisibleDescendantDirty = false;
714 } 709 }
715 710
716 if (m_isVisibleContentDirty) { 711 if (m_isVisibleContentDirty) {
717 bool previouslyHasVisibleContent = m_hasVisibleContent; 712 bool previouslyHasVisibleContent = m_hasVisibleContent;
718 if (layoutObject()->style()->visibility() == EVisibility::Visible) { 713 if (layoutObject()->style()->visibility() == EVisibility::Visible) {
719 m_hasVisibleContent = true; 714 m_hasVisibleContent = true;
720 } else { 715 } else {
(...skipping 2548 matching lines...) Expand 10 before | Expand all | Expand 10 after
3269 } 3264 }
3270 3265
3271 void showLayerTree(const blink::LayoutObject* layoutObject) { 3266 void showLayerTree(const blink::LayoutObject* layoutObject) {
3272 if (!layoutObject) { 3267 if (!layoutObject) {
3273 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; 3268 LOG(INFO) << "Cannot showLayerTree. Root is (nil)";
3274 return; 3269 return;
3275 } 3270 }
3276 showLayerTree(layoutObject->enclosingLayer()); 3271 showLayerTree(layoutObject->enclosingLayer());
3277 } 3272 }
3278 #endif 3273 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698