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