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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 2297873002: Remove unnecessary checks in PaintLayer::backgroundIsKnownToBeOpaqueInRect (Closed)
Patch Set: Rebased. Created 4 years, 3 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
« no previous file with comments | « no previous file | 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 2389 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
2413 if (paintsWithTransparency(GlobalPaintNormalPhase)) 2410 if (paintsWithTransparency(GlobalPaintNormalPhase))
2414 return false; 2411 return false;
2415 2412
2416 // We can't use hasVisibleContent(), because that will be true if our layout Object is hidden, but some child 2413 // We can't use hasVisibleContent(), because that will be true if our layout Object is hidden, but some child
2417 // is visible and that child doesn't cover the entire rect. 2414 // is visible and that child doesn't cover the entire rect.
2418 if (layoutObject()->style()->visibility() != EVisibility::Visible) 2415 if (layoutObject()->style()->visibility() != EVisibility::Visible)
2419 return false; 2416 return false;
2420 2417
2421 if (paintsWithFilters() && layoutObject()->style()->filter().hasFilterThatAf fectsOpacity()) 2418 if (paintsWithFilters() && layoutObject()->style()->filter().hasFilterThatAf fectsOpacity())
2422 return false; 2419 return false;
2423 2420
2424 // FIXME: Handle simple transforms. 2421 // FIXME: Handle simple transforms.
2425 if (paintsWithTransform(GlobalPaintNormalPhase)) 2422 if (paintsWithTransform(GlobalPaintNormalPhase))
2426 return false; 2423 return false;
2427 2424
2428 // FIXME: Remove this check.
2429 // This function should not be called when layer-lists are dirty. 2425 // This function should not be called when layer-lists are dirty.
2430 // It is somehow getting triggered during style update. 2426 DCHECK(!m_stackingNode->zOrderListsDirty());
2431 if (m_stackingNode->zOrderListsDirty())
2432 return false;
2433 2427
2434 // FIXME: We currently only check the immediate layoutObject, 2428 // FIXME: We currently only check the immediate layoutObject,
2435 // which will miss many cases. 2429 // which will miss many cases where additional layout objects paint
2430 // into this layer.
2436 if (layoutObject()->backgroundIsKnownToBeOpaqueInRect(localRect)) 2431 if (layoutObject()->backgroundIsKnownToBeOpaqueInRect(localRect))
2437 return true; 2432 return true;
2438 2433
2439 // We can't consult child layers if we clip, since they might cover 2434 // We can't consult child layers if we clip, since they might cover
2440 // parts of the rect that are clipped out. 2435 // parts of the rect that are clipped out.
2441 if (layoutObject()->hasClipRelatedProperty()) 2436 if (layoutObject()->hasClipRelatedProperty())
2442 return false; 2437 return false;
2443 2438
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.
2444 return childBackgroundIsKnownToBeOpaqueInRect(localRect); 2443 return childBackgroundIsKnownToBeOpaqueInRect(localRect);
2445 } 2444 }
2446 2445
2447 bool PaintLayer::childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR ect) const 2446 bool PaintLayer::childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR ect) const
2448 { 2447 {
2449 PaintLayerStackingNodeReverseIterator revertseIterator(*m_stackingNode, Posi tiveZOrderChildren | NormalFlowChildren | NegativeZOrderChildren); 2448 PaintLayerStackingNodeReverseIterator reverseIterator(*m_stackingNode, Posit iveZOrderChildren | NormalFlowChildren | NegativeZOrderChildren);
2450 while (PaintLayerStackingNode* child = revertseIterator.next()) { 2449 while (PaintLayerStackingNode* child = reverseIterator.next()) {
2451 const PaintLayer* childLayer = child->layer(); 2450 const PaintLayer* childLayer = child->layer();
2452 // Stop at composited paint boundaries. 2451 // Stop at composited paint boundaries.
2453 if (childLayer->isPaintInvalidationContainer()) 2452 if (childLayer->isPaintInvalidationContainer())
2454 continue; 2453 continue;
2455 2454
2456 if (!childLayer->canUseConvertToLayerCoords()) 2455 if (!childLayer->canUseConvertToLayerCoords())
2457 continue; 2456 continue;
2458 2457
2459 LayoutPoint childOffset; 2458 LayoutPoint childOffset;
2460 LayoutRect childLocalRect(localRect); 2459 LayoutRect childLocalRect(localRect);
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
2958 2957
2959 void showLayerTree(const blink::LayoutObject* layoutObject) 2958 void showLayerTree(const blink::LayoutObject* layoutObject)
2960 { 2959 {
2961 if (!layoutObject) { 2960 if (!layoutObject) {
2962 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2961 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2963 return; 2962 return;
2964 } 2963 }
2965 showLayerTree(layoutObject->enclosingLayer()); 2964 showLayerTree(layoutObject->enclosingLayer());
2966 } 2965 }
2967 #endif 2966 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698