OLD | NEW |
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 , m_staticInlinePosition(0) | 169 , m_staticInlinePosition(0) |
170 , m_staticBlockPosition(0) | 170 , m_staticBlockPosition(0) |
171 , m_ancestorOverflowLayer(nullptr) | 171 , m_ancestorOverflowLayer(nullptr) |
172 { | 172 { |
173 updateStackingNode(); | 173 updateStackingNode(); |
174 | 174 |
175 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); | 175 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); |
176 | 176 |
177 if (!layoutObject->slowFirstChild() && layoutObject->style()) { | 177 if (!layoutObject->slowFirstChild() && layoutObject->style()) { |
178 m_visibleContentStatusDirty = false; | 178 m_visibleContentStatusDirty = false; |
179 m_hasVisibleContent = layoutObject->style()->visibility() == VISIBLE; | 179 m_hasVisibleContent = layoutObject->style()->visibility() == EVisibility
::Visible; |
180 } | 180 } |
181 | 181 |
182 updateScrollableArea(); | 182 updateScrollableArea(); |
183 } | 183 } |
184 | 184 |
185 PaintLayer::~PaintLayer() | 185 PaintLayer::~PaintLayer() |
186 { | 186 { |
187 if (m_rareData && m_rareData->filterInfo) | 187 if (m_rareData && m_rareData->filterInfo) |
188 m_rareData->filterInfo->clearLayer(); | 188 m_rareData->filterInfo->clearLayer(); |
189 if (layoutObject()->frame() && layoutObject()->frame()->page()) { | 189 if (layoutObject()->frame() && layoutObject()->frame()->page()) { |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 parent()->dirtyAncestorChainVisibleDescendantStatus(); | 605 parent()->dirtyAncestorChainVisibleDescendantStatus(); |
606 // 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. | 606 // 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. |
607 if (!isSelfPaintingLayer()) | 607 if (!isSelfPaintingLayer()) |
608 parent()->dirtyVisibleContentStatus(); | 608 parent()->dirtyVisibleContentStatus(); |
609 } | 609 } |
610 | 610 |
611 void PaintLayer::potentiallyDirtyVisibleContentStatus(EVisibility visibility) | 611 void PaintLayer::potentiallyDirtyVisibleContentStatus(EVisibility visibility) |
612 { | 612 { |
613 if (m_visibleContentStatusDirty) | 613 if (m_visibleContentStatusDirty) |
614 return; | 614 return; |
615 if (hasVisibleContent() == (visibility == VISIBLE)) | 615 if (hasVisibleContent() == (visibility == EVisibility::Visible)) |
616 return; | 616 return; |
617 dirtyVisibleContentStatus(); | 617 dirtyVisibleContentStatus(); |
618 } | 618 } |
619 | 619 |
620 void PaintLayer::dirtyAncestorChainVisibleDescendantStatus() | 620 void PaintLayer::dirtyAncestorChainVisibleDescendantStatus() |
621 { | 621 { |
622 compositor()->setNeedsUpdateDescendantDependentFlags(); | 622 compositor()->setNeedsUpdateDescendantDependentFlags(); |
623 | 623 |
624 for (PaintLayer* layer = this; layer; layer = layer->parent()) { | 624 for (PaintLayer* layer = this; layer; layer = layer->parent()) { |
625 if (layer->m_visibleDescendantStatusDirty) | 625 if (layer->m_visibleDescendantStatusDirty) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 m_hasVisibleDescendant = true; | 666 m_hasVisibleDescendant = true; |
667 break; | 667 break; |
668 } | 668 } |
669 } | 669 } |
670 | 670 |
671 m_visibleDescendantStatusDirty = false; | 671 m_visibleDescendantStatusDirty = false; |
672 } | 672 } |
673 | 673 |
674 if (m_visibleContentStatusDirty) { | 674 if (m_visibleContentStatusDirty) { |
675 bool previouslyHasVisibleContent = m_hasVisibleContent; | 675 bool previouslyHasVisibleContent = m_hasVisibleContent; |
676 if (layoutObject()->style()->visibility() == VISIBLE) { | 676 if (layoutObject()->style()->visibility() == EVisibility::Visible) { |
677 m_hasVisibleContent = true; | 677 m_hasVisibleContent = true; |
678 } else { | 678 } else { |
679 // layer may be hidden but still have some visible content, check fo
r this | 679 // layer may be hidden but still have some visible content, check fo
r this |
680 m_hasVisibleContent = false; | 680 m_hasVisibleContent = false; |
681 LayoutObject* r = layoutObject()->slowFirstChild(); | 681 LayoutObject* r = layoutObject()->slowFirstChild(); |
682 while (r) { | 682 while (r) { |
683 if (r->style()->visibility() == VISIBLE && (!r->hasLayer() || !r
->enclosingLayer()->isSelfPaintingLayer())) { | 683 if (r->style()->visibility() == EVisibility::Visible && (!r->has
Layer() || !r->enclosingLayer()->isSelfPaintingLayer())) { |
684 m_hasVisibleContent = true; | 684 m_hasVisibleContent = true; |
685 break; | 685 break; |
686 } | 686 } |
687 LayoutObject* layoutObjectFirstChild = r->slowFirstChild(); | 687 LayoutObject* layoutObjectFirstChild = r->slowFirstChild(); |
688 if (layoutObjectFirstChild && (!r->hasLayer() || !r->enclosingLa
yer()->isSelfPaintingLayer())) { | 688 if (layoutObjectFirstChild && (!r->hasLayer() || !r->enclosingLa
yer()->isSelfPaintingLayer())) { |
689 r = layoutObjectFirstChild; | 689 r = layoutObjectFirstChild; |
690 } else if (r->nextSibling()) { | 690 } else if (r->nextSibling()) { |
691 r = r->nextSibling(); | 691 r = r->nextSibling(); |
692 } else { | 692 } else { |
693 do { | 693 do { |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree); | 1207 compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree); |
1208 | 1208 |
1209 if (oldChild->stackingNode()->isStacked() || oldChild->firstChild()) { | 1209 if (oldChild->stackingNode()->isStacked() || oldChild->firstChild()) { |
1210 // Dirty the z-order list in which we are contained. When called via th
e | 1210 // Dirty the z-order list in which we are contained. When called via th
e |
1211 // reattachment process in removeOnlyThisLayer, the layer may already be
disconnected | 1211 // reattachment process in removeOnlyThisLayer, the layer may already be
disconnected |
1212 // from the main layer tree, so we need to null-check the | 1212 // from the main layer tree, so we need to null-check the |
1213 // |stackingContext| value. | 1213 // |stackingContext| value. |
1214 oldChild->stackingNode()->dirtyStackingContextZOrderLists(); | 1214 oldChild->stackingNode()->dirtyStackingContextZOrderLists(); |
1215 } | 1215 } |
1216 | 1216 |
1217 if (layoutObject()->style()->visibility() != VISIBLE) | 1217 if (layoutObject()->style()->visibility() != EVisibility::Visible) |
1218 dirtyVisibleContentStatus(); | 1218 dirtyVisibleContentStatus(); |
1219 | 1219 |
1220 oldChild->setPreviousSibling(0); | 1220 oldChild->setPreviousSibling(0); |
1221 oldChild->setNextSibling(0); | 1221 oldChild->setNextSibling(0); |
1222 oldChild->m_parent = 0; | 1222 oldChild->m_parent = 0; |
1223 | 1223 |
1224 // Remove any ancestor overflow layers which descended into the removed chil
d. | 1224 // Remove any ancestor overflow layers which descended into the removed chil
d. |
1225 if (oldChild->ancestorOverflowLayer()) | 1225 if (oldChild->ancestorOverflowLayer()) |
1226 oldChild->removeAncestorOverflowLayer(oldChild->ancestorOverflowLayer())
; | 1226 oldChild->removeAncestorOverflowLayer(oldChild->ancestorOverflowLayer())
; |
1227 | 1227 |
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2384 bool PaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const | 2384 bool PaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const |
2385 { | 2385 { |
2386 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) | 2386 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) |
2387 return false; | 2387 return false; |
2388 | 2388 |
2389 if (paintsWithTransparency(GlobalPaintNormalPhase)) | 2389 if (paintsWithTransparency(GlobalPaintNormalPhase)) |
2390 return false; | 2390 return false; |
2391 | 2391 |
2392 // We can't use hasVisibleContent(), because that will be true if our layout
Object is hidden, but some child | 2392 // We can't use hasVisibleContent(), because that will be true if our layout
Object is hidden, but some child |
2393 // is visible and that child doesn't cover the entire rect. | 2393 // is visible and that child doesn't cover the entire rect. |
2394 if (layoutObject()->style()->visibility() != VISIBLE) | 2394 if (layoutObject()->style()->visibility() != EVisibility::Visible) |
2395 return false; | 2395 return false; |
2396 | 2396 |
2397 if (paintsWithFilters() && layoutObject()->style()->filter().hasFilterThatAf
fectsOpacity()) | 2397 if (paintsWithFilters() && layoutObject()->style()->filter().hasFilterThatAf
fectsOpacity()) |
2398 return false; | 2398 return false; |
2399 | 2399 |
2400 // FIXME: Handle simple transforms. | 2400 // FIXME: Handle simple transforms. |
2401 if (paintsWithTransform(GlobalPaintNormalPhase)) | 2401 if (paintsWithTransform(GlobalPaintNormalPhase)) |
2402 return false; | 2402 return false; |
2403 | 2403 |
2404 // FIXME: Remove this check. | 2404 // FIXME: Remove this check. |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2924 | 2924 |
2925 void showLayerTree(const blink::LayoutObject* layoutObject) | 2925 void showLayerTree(const blink::LayoutObject* layoutObject) |
2926 { | 2926 { |
2927 if (!layoutObject) { | 2927 if (!layoutObject) { |
2928 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2928 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
2929 return; | 2929 return; |
2930 } | 2930 } |
2931 showLayerTree(layoutObject->enclosingLayer()); | 2931 showLayerTree(layoutObject->enclosingLayer()); |
2932 } | 2932 } |
2933 #endif | 2933 #endif |
OLD | NEW |