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 2389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2400 return m_rareData && m_rareData->compositedLayerMapping && m_rareData->compo
sitedLayerMapping->hasChildClippingMaskLayer(); | 2400 return m_rareData && m_rareData->compositedLayerMapping && m_rareData->compo
sitedLayerMapping->hasChildClippingMaskLayer(); |
2401 } | 2401 } |
2402 | 2402 |
2403 bool PaintLayer::paintsWithTransform(GlobalPaintFlags globalPaintFlags) const | 2403 bool PaintLayer::paintsWithTransform(GlobalPaintFlags globalPaintFlags) const |
2404 { | 2404 { |
2405 return (transform() || layoutObject()->style()->position() == FixedPosition)
&& ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || compositingStat
e() != PaintsIntoOwnBacking); | 2405 return (transform() || layoutObject()->style()->position() == FixedPosition)
&& ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || compositingStat
e() != PaintsIntoOwnBacking); |
2406 } | 2406 } |
2407 | 2407 |
2408 bool PaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const | 2408 bool PaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const |
2409 { | 2409 { |
| 2410 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) |
| 2411 return false; |
| 2412 |
2410 if (paintsWithTransparency(GlobalPaintNormalPhase)) | 2413 if (paintsWithTransparency(GlobalPaintNormalPhase)) |
2411 return false; | 2414 return false; |
2412 | 2415 |
2413 // We can't use hasVisibleContent(), because that will be true if our layout
Object is hidden, but some child | 2416 // We can't use hasVisibleContent(), because that will be true if our layout
Object is hidden, but some child |
2414 // is visible and that child doesn't cover the entire rect. | 2417 // is visible and that child doesn't cover the entire rect. |
2415 if (layoutObject()->style()->visibility() != EVisibility::Visible) | 2418 if (layoutObject()->style()->visibility() != EVisibility::Visible) |
2416 return false; | 2419 return false; |
2417 | 2420 |
2418 if (paintsWithFilters() && layoutObject()->style()->filter().hasFilterThatAf
fectsOpacity()) | 2421 if (paintsWithFilters() && layoutObject()->style()->filter().hasFilterThatAf
fectsOpacity()) |
2419 return false; | 2422 return false; |
2420 | 2423 |
2421 // FIXME: Handle simple transforms. | 2424 // FIXME: Handle simple transforms. |
2422 if (paintsWithTransform(GlobalPaintNormalPhase)) | 2425 if (paintsWithTransform(GlobalPaintNormalPhase)) |
2423 return false; | 2426 return false; |
2424 | 2427 |
| 2428 // FIXME: Remove this check. |
2425 // This function should not be called when layer-lists are dirty. | 2429 // This function should not be called when layer-lists are dirty. |
2426 DCHECK(!m_stackingNode->zOrderListsDirty()); | 2430 // It is somehow getting triggered during style update. |
| 2431 if (m_stackingNode->zOrderListsDirty()) |
| 2432 return false; |
2427 | 2433 |
2428 // FIXME: We currently only check the immediate layoutObject, | 2434 // FIXME: We currently only check the immediate layoutObject, |
2429 // which will miss many cases where additional layout objects paint | 2435 // which will miss many cases. |
2430 // into this layer. | |
2431 if (layoutObject()->backgroundIsKnownToBeOpaqueInRect(localRect)) | 2436 if (layoutObject()->backgroundIsKnownToBeOpaqueInRect(localRect)) |
2432 return true; | 2437 return true; |
2433 | 2438 |
2434 // We can't consult child layers if we clip, since they might cover | 2439 // We can't consult child layers if we clip, since they might cover |
2435 // parts of the rect that are clipped out. | 2440 // parts of the rect that are clipped out. |
2436 if (layoutObject()->hasClipRelatedProperty()) | 2441 if (layoutObject()->hasClipRelatedProperty()) |
2437 return false; | 2442 return false; |
2438 | 2443 |
2439 // TODO(schenney): This could be improved by unioning the opaque regions of
all the children. | |
2440 // That would require a refactoring because currently children just check th
ey at least | |
2441 // cover the given rect, but a unioning method would require children to com
pute and report | |
2442 // their rects. | |
2443 return childBackgroundIsKnownToBeOpaqueInRect(localRect); | 2444 return childBackgroundIsKnownToBeOpaqueInRect(localRect); |
2444 } | 2445 } |
2445 | 2446 |
2446 bool PaintLayer::childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR
ect) const | 2447 bool PaintLayer::childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR
ect) const |
2447 { | 2448 { |
2448 PaintLayerStackingNodeReverseIterator reverseIterator(*m_stackingNode, Posit
iveZOrderChildren | NormalFlowChildren | NegativeZOrderChildren); | 2449 PaintLayerStackingNodeReverseIterator revertseIterator(*m_stackingNode, Posi
tiveZOrderChildren | NormalFlowChildren | NegativeZOrderChildren); |
2449 while (PaintLayerStackingNode* child = reverseIterator.next()) { | 2450 while (PaintLayerStackingNode* child = revertseIterator.next()) { |
2450 const PaintLayer* childLayer = child->layer(); | 2451 const PaintLayer* childLayer = child->layer(); |
2451 // Stop at composited paint boundaries. | 2452 // Stop at composited paint boundaries. |
2452 if (childLayer->isPaintInvalidationContainer()) | 2453 if (childLayer->isPaintInvalidationContainer()) |
2453 continue; | 2454 continue; |
2454 | 2455 |
2455 if (!childLayer->canUseConvertToLayerCoords()) | 2456 if (!childLayer->canUseConvertToLayerCoords()) |
2456 continue; | 2457 continue; |
2457 | 2458 |
2458 LayoutPoint childOffset; | 2459 LayoutPoint childOffset; |
2459 LayoutRect childLocalRect(localRect); | 2460 LayoutRect childLocalRect(localRect); |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2957 | 2958 |
2958 void showLayerTree(const blink::LayoutObject* layoutObject) | 2959 void showLayerTree(const blink::LayoutObject* layoutObject) |
2959 { | 2960 { |
2960 if (!layoutObject) { | 2961 if (!layoutObject) { |
2961 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2962 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
2962 return; | 2963 return; |
2963 } | 2964 } |
2964 showLayerTree(layoutObject->enclosingLayer()); | 2965 showLayerTree(layoutObject->enclosingLayer()); |
2965 } | 2966 } |
2966 #endif | 2967 #endif |
OLD | NEW |