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

Side by Side Diff: Source/core/paint/DeprecatedPaintLayer.cpp

Issue 1179403002: Update hasVisibleContent() to include visibility of non-self-painting layers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/paint/deprecatedpaintlayer/non-self-painting-layer-overrides-visibility-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 mapRectToPaintBackingCoordinates(paintInvalidationContainer->layoutObject(), rect); 587 mapRectToPaintBackingCoordinates(paintInvalidationContainer->layoutObject(), rect);
588 return rect; 588 return rect;
589 } 589 }
590 590
591 void DeprecatedPaintLayer::dirtyVisibleContentStatus() 591 void DeprecatedPaintLayer::dirtyVisibleContentStatus()
592 { 592 {
593 compositor()->setNeedsUpdateDescendantDependentFlags(); 593 compositor()->setNeedsUpdateDescendantDependentFlags();
594 m_visibleContentStatusDirty = true; 594 m_visibleContentStatusDirty = true;
595 if (parent()) 595 if (parent())
596 parent()->dirtyAncestorChainVisibleDescendantStatus(); 596 parent()->dirtyAncestorChainVisibleDescendantStatus();
597 // Non-self-painting layers paint into their ancestor layer, and count as pa rt of the "visible contents" of the parent, so we need to dirty it.
598 if (!isSelfPaintingLayer())
599 parent()->dirtyVisibleContentStatus();
597 } 600 }
598 601
599 void DeprecatedPaintLayer::potentiallyDirtyVisibleContentStatus(EVisibility visi bility) 602 void DeprecatedPaintLayer::potentiallyDirtyVisibleContentStatus(EVisibility visi bility)
600 { 603 {
601 if (m_visibleContentStatusDirty) 604 if (m_visibleContentStatusDirty)
602 return; 605 return;
603 if (hasVisibleContent() == (visibility == VISIBLE)) 606 if (hasVisibleContent() == (visibility == VISIBLE))
604 return; 607 return;
605 dirtyVisibleContentStatus(); 608 dirtyVisibleContentStatus();
606 } 609 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 660
658 if (m_visibleContentStatusDirty) { 661 if (m_visibleContentStatusDirty) {
659 bool previouslyHasVisibleContent = m_hasVisibleContent; 662 bool previouslyHasVisibleContent = m_hasVisibleContent;
660 if (layoutObject()->style()->visibility() == VISIBLE) { 663 if (layoutObject()->style()->visibility() == VISIBLE) {
661 m_hasVisibleContent = true; 664 m_hasVisibleContent = true;
662 } else { 665 } else {
663 // layer may be hidden but still have some visible content, check fo r this 666 // layer may be hidden but still have some visible content, check fo r this
664 m_hasVisibleContent = false; 667 m_hasVisibleContent = false;
665 LayoutObject* r = layoutObject()->slowFirstChild(); 668 LayoutObject* r = layoutObject()->slowFirstChild();
666 while (r) { 669 while (r) {
667 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { 670 if (r->style()->visibility() == VISIBLE && (!r->hasLayer() || !r ->enclosingLayer()->isSelfPaintingLayer())) {
668 m_hasVisibleContent = true; 671 m_hasVisibleContent = true;
669 break; 672 break;
670 } 673 }
671 LayoutObject* layoutObjectFirstChild = r->slowFirstChild(); 674 LayoutObject* layoutObjectFirstChild = r->slowFirstChild();
672 if (layoutObjectFirstChild && !r->hasLayer()) { 675 if (layoutObjectFirstChild && (!r->hasLayer() || !r->enclosingLa yer()->isSelfPaintingLayer())) {
673 r = layoutObjectFirstChild; 676 r = layoutObjectFirstChild;
674 } else if (r->nextSibling()) { 677 } else if (r->nextSibling()) {
675 r = r->nextSibling(); 678 r = r->nextSibling();
676 } else { 679 } else {
677 do { 680 do {
678 r = r->parent(); 681 r = r->parent();
679 if (r == layoutObject()) 682 if (r == layoutObject())
680 r = 0; 683 r = 0;
681 } while (r && !r->nextSibling()); 684 } while (r && !r->nextSibling());
682 if (r) 685 if (r)
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 if (!child->stackingNode()->isTreatedAsStackingContextForPainting()) 1146 if (!child->stackingNode()->isTreatedAsStackingContextForPainting())
1144 m_stackingNode->dirtyNormalFlowList(); 1147 m_stackingNode->dirtyNormalFlowList();
1145 1148
1146 if (child->stackingNode()->isTreatedAsStackingContextForPainting() || child- >firstChild()) { 1149 if (child->stackingNode()->isTreatedAsStackingContextForPainting() || child- >firstChild()) {
1147 // Dirty the z-order list in which we are contained. The ancestorStackin gContextNode() can be null in the 1150 // Dirty the z-order list in which we are contained. The ancestorStackin gContextNode() can be null in the
1148 // case where we're building up generated content layers. This is ok, si nce the lists will start 1151 // case where we're building up generated content layers. This is ok, si nce the lists will start
1149 // off dirty in that case anyway. 1152 // off dirty in that case anyway.
1150 child->stackingNode()->dirtyStackingContextZOrderLists(); 1153 child->stackingNode()->dirtyStackingContextZOrderLists();
1151 } 1154 }
1152 1155
1156 // Non-self-painting children paint into this layer, so the visible contents status of this layer is affected.
1157 if (!child->isSelfPaintingLayer())
1158 dirtyVisibleContentStatus();
1159
1153 dirtyAncestorChainVisibleDescendantStatus(); 1160 dirtyAncestorChainVisibleDescendantStatus();
1154 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 1161 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
1155 1162
1156 child->updateDescendantDependentFlags(); 1163 child->updateDescendantDependentFlags();
1157 } 1164 }
1158 1165
1159 DeprecatedPaintLayer* DeprecatedPaintLayer::removeChild(DeprecatedPaintLayer* ol dChild) 1166 DeprecatedPaintLayer* DeprecatedPaintLayer::removeChild(DeprecatedPaintLayer* ol dChild)
1160 { 1167 {
1161 if (oldChild->previousSibling()) 1168 if (oldChild->previousSibling())
1162 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); 1169 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling());
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after
2740 2747
2741 void showLayerTree(const blink::LayoutObject* layoutObject) 2748 void showLayerTree(const blink::LayoutObject* layoutObject)
2742 { 2749 {
2743 if (!layoutObject) { 2750 if (!layoutObject) {
2744 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2751 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2745 return; 2752 return;
2746 } 2753 }
2747 showLayerTree(layoutObject->enclosingLayer()); 2754 showLayerTree(layoutObject->enclosingLayer());
2748 } 2755 }
2749 #endif 2756 #endif
OLDNEW
« no previous file with comments | « LayoutTests/paint/deprecatedpaintlayer/non-self-painting-layer-overrides-visibility-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698