Chromium Code Reviews| 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 2316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2327 switch (compositingState()) { | 2327 switch (compositingState()) { |
| 2328 case NotComposited: | 2328 case NotComposited: |
| 2329 return 0; | 2329 return 0; |
| 2330 case PaintsIntoGroupedBacking: | 2330 case PaintsIntoGroupedBacking: |
| 2331 return groupedMapping()->squashingLayer(); | 2331 return groupedMapping()->squashingLayer(); |
| 2332 default: | 2332 default: |
| 2333 return compositedLayerMapping()->scrollingContentsLayer() ? compositedLa yerMapping()->scrollingContentsLayer() : compositedLayerMapping()->mainGraphicsL ayer(); | 2333 return compositedLayerMapping()->scrollingContentsLayer() ? compositedLa yerMapping()->scrollingContentsLayer() : compositedLayerMapping()->mainGraphicsL ayer(); |
| 2334 } | 2334 } |
| 2335 } | 2335 } |
| 2336 | 2336 |
| 2337 bool PaintLayer::shouldPaintBackgroundOntoScrollingContentsLayer() const | |
| 2338 { | |
| 2339 return !isRootLayer() | |
| 2340 && scrollsOverflow() | |
| 2341 && layoutObject()->style()->hasEntirelyLocalBackground() | |
| 2342 && !stackingNode()->hasNegativeZOrderList(); | |
| 2343 } | |
| 2344 | |
| 2337 void PaintLayer::ensureCompositedLayerMapping() | 2345 void PaintLayer::ensureCompositedLayerMapping() |
| 2338 { | 2346 { |
| 2339 if (m_rareData && m_rareData->compositedLayerMapping) | 2347 if (m_rareData && m_rareData->compositedLayerMapping) |
| 2340 return; | 2348 return; |
| 2341 | 2349 |
| 2342 ensureRareData().compositedLayerMapping = wrapUnique(new CompositedLayerMapp ing(*this)); | 2350 ensureRareData().compositedLayerMapping = wrapUnique(new CompositedLayerMapp ing(*this)); |
| 2343 m_rareData->compositedLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLaye rUpdateSubtree); | 2351 m_rareData->compositedLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLaye rUpdateSubtree); |
| 2344 | 2352 |
| 2345 updateOrRemoveFilterEffectBuilder(); | 2353 updateOrRemoveFilterEffectBuilder(); |
| 2346 } | 2354 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2390 return m_rareData && m_rareData->compositedLayerMapping && m_rareData->compo sitedLayerMapping->hasChildClippingMaskLayer(); | 2398 return m_rareData && m_rareData->compositedLayerMapping && m_rareData->compo sitedLayerMapping->hasChildClippingMaskLayer(); |
| 2391 } | 2399 } |
| 2392 | 2400 |
| 2393 bool PaintLayer::paintsWithTransform(GlobalPaintFlags globalPaintFlags) const | 2401 bool PaintLayer::paintsWithTransform(GlobalPaintFlags globalPaintFlags) const |
| 2394 { | 2402 { |
| 2395 return (transform() || layoutObject()->style()->position() == FixedPosition) && ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || compositingStat e() != PaintsIntoOwnBacking); | 2403 return (transform() || layoutObject()->style()->position() == FixedPosition) && ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || compositingStat e() != PaintsIntoOwnBacking); |
| 2396 } | 2404 } |
| 2397 | 2405 |
| 2398 bool PaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const | 2406 bool PaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const |
| 2399 { | 2407 { |
| 2400 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) | |
| 2401 return false; | |
|
Stephen Chennney
2016/08/29 20:49:52
This check is redundant in all pre-existing caller
| |
| 2402 | |
| 2403 if (paintsWithTransparency(GlobalPaintNormalPhase)) | 2408 if (paintsWithTransparency(GlobalPaintNormalPhase)) |
| 2404 return false; | 2409 return false; |
| 2405 | 2410 |
| 2406 // We can't use hasVisibleContent(), because that will be true if our layout Object is hidden, but some child | 2411 // 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. | 2412 // is visible and that child doesn't cover the entire rect. |
| 2408 if (layoutObject()->style()->visibility() != EVisibility::Visible) | 2413 if (layoutObject()->style()->visibility() != EVisibility::Visible) |
| 2409 return false; | 2414 return false; |
| 2410 | 2415 |
| 2411 if (paintsWithFilters() && layoutObject()->style()->filter().hasFilterThatAf fectsOpacity()) | 2416 if (paintsWithFilters() && layoutObject()->style()->filter().hasFilterThatAf fectsOpacity()) |
| 2412 return false; | 2417 return false; |
| 2413 | 2418 |
| 2414 // FIXME: Handle simple transforms. | 2419 // FIXME: Handle simple transforms. |
| 2415 if (paintsWithTransform(GlobalPaintNormalPhase)) | 2420 if (paintsWithTransform(GlobalPaintNormalPhase)) |
| 2416 return false; | 2421 return false; |
| 2417 | 2422 |
| 2418 // FIXME: Remove this check. | 2423 // FIXME: Remove this check. |
| 2419 // This function should not be called when layer-lists are dirty. | 2424 // This function should not be called when layer-lists are dirty. |
| 2420 // It is somehow getting triggered during style update. | 2425 // It is somehow getting triggered during style update. |
| 2421 if (m_stackingNode->zOrderListsDirty()) | 2426 if (m_stackingNode->zOrderListsDirty()) |
| 2422 return false; | 2427 return false; |
| 2423 | 2428 |
| 2424 // FIXME: We currently only check the immediate layoutObject, | |
| 2425 // which will miss many cases. | |
| 2426 if (layoutObject()->backgroundIsKnownToBeOpaqueInRect(localRect)) | 2429 if (layoutObject()->backgroundIsKnownToBeOpaqueInRect(localRect)) |
| 2427 return true; | 2430 return true; |
| 2428 | 2431 |
| 2429 // We can't consult child layers if we clip, since they might cover | 2432 // We can't consult child layers if we clip, since they might cover |
| 2430 // parts of the rect that are clipped out. | 2433 // parts of the rect that are clipped out. |
| 2431 if (layoutObject()->hasClipRelatedProperty()) | 2434 if (layoutObject()->hasClipRelatedProperty()) |
| 2432 return false; | 2435 return false; |
| 2433 | 2436 |
| 2437 // TODO(schenney): This could be improved by unioning the opaque regions of all the children. | |
| 2438 // That would require a refactoring because currently children just check th ey at least | |
| 2439 // cover the given rect, but a unioning method would require children to com pute and report | |
| 2440 // their rects. | |
| 2434 return childBackgroundIsKnownToBeOpaqueInRect(localRect); | 2441 return childBackgroundIsKnownToBeOpaqueInRect(localRect); |
| 2435 } | 2442 } |
| 2436 | 2443 |
| 2437 bool PaintLayer::childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR ect) const | 2444 bool PaintLayer::childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR ect) const |
| 2438 { | 2445 { |
| 2439 PaintLayerStackingNodeReverseIterator revertseIterator(*m_stackingNode, Posi tiveZOrderChildren | NormalFlowChildren | NegativeZOrderChildren); | 2446 PaintLayerStackingNodeReverseIterator reverseIterator(*m_stackingNode, Posit iveZOrderChildren | NormalFlowChildren | NegativeZOrderChildren); |
| 2440 while (PaintLayerStackingNode* child = revertseIterator.next()) { | 2447 while (PaintLayerStackingNode* child = reverseIterator.next()) { |
| 2441 const PaintLayer* childLayer = child->layer(); | 2448 const PaintLayer* childLayer = child->layer(); |
| 2442 // Stop at composited paint boundaries. | 2449 // Stop at composited paint boundaries. |
| 2443 if (childLayer->isPaintInvalidationContainer()) | 2450 if (childLayer->isPaintInvalidationContainer()) |
|
Stephen Chennney
2016/08/29 20:49:52
I think this means we do not need to check that th
| |
| 2444 continue; | 2451 continue; |
| 2445 | 2452 |
| 2446 if (!childLayer->canUseConvertToLayerCoords()) | 2453 if (!childLayer->canUseConvertToLayerCoords()) |
| 2447 continue; | 2454 continue; |
| 2448 | 2455 |
| 2449 LayoutPoint childOffset; | 2456 LayoutPoint childOffset; |
| 2450 LayoutRect childLocalRect(localRect); | 2457 LayoutRect childLocalRect(localRect); |
| 2451 childLayer->convertToLayerCoords(this, childOffset); | 2458 childLayer->convertToLayerCoords(this, childOffset); |
| 2452 childLocalRect.moveBy(-childOffset); | 2459 childLocalRect.moveBy(-childOffset); |
| 2453 | 2460 |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2948 | 2955 |
| 2949 void showLayerTree(const blink::LayoutObject* layoutObject) | 2956 void showLayerTree(const blink::LayoutObject* layoutObject) |
| 2950 { | 2957 { |
| 2951 if (!layoutObject) { | 2958 if (!layoutObject) { |
| 2952 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2959 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
| 2953 return; | 2960 return; |
| 2954 } | 2961 } |
| 2955 showLayerTree(layoutObject->enclosingLayer()); | 2962 showLayerTree(layoutObject->enclosingLayer()); |
| 2956 } | 2963 } |
| 2957 #endif | 2964 #endif |
| OLD | NEW |