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

Side by Side Diff: Source/core/rendering/CompositedLayerMapping.cpp

Issue 59063003: Don't coerce pointers to compositor layer mappings to booleans. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Respond to reviewer feedback. Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "core/platform/graphics/GraphicsLayer.h" 46 #include "core/platform/graphics/GraphicsLayer.h"
47 #include "core/platform/graphics/filters/custom/CustomFilterOperation.h" 47 #include "core/platform/graphics/filters/custom/CustomFilterOperation.h"
48 #include "core/plugins/PluginView.h" 48 #include "core/plugins/PluginView.h"
49 #include "core/rendering/FilterEffectRenderer.h" 49 #include "core/rendering/FilterEffectRenderer.h"
50 #include "core/rendering/RenderApplet.h" 50 #include "core/rendering/RenderApplet.h"
51 #include "core/rendering/RenderEmbeddedObject.h" 51 #include "core/rendering/RenderEmbeddedObject.h"
52 #include "core/rendering/RenderIFrame.h" 52 #include "core/rendering/RenderIFrame.h"
53 #include "core/rendering/RenderImage.h" 53 #include "core/rendering/RenderImage.h"
54 #include "core/rendering/RenderLayer.h" 54 #include "core/rendering/RenderLayer.h"
55 #include "core/rendering/RenderLayerCompositor.h" 55 #include "core/rendering/RenderLayerCompositor.h"
56 #include "core/rendering/RenderLayerStackingNodeIterator.h"
56 #include "core/rendering/RenderVideo.h" 57 #include "core/rendering/RenderVideo.h"
57 #include "core/rendering/RenderView.h" 58 #include "core/rendering/RenderView.h"
58 #include "core/rendering/animation/WebAnimationProvider.h" 59 #include "core/rendering/animation/WebAnimationProvider.h"
59 #include "core/rendering/style/KeyframeList.h" 60 #include "core/rendering/style/KeyframeList.h"
60 #include "platform/LengthFunctions.h" 61 #include "platform/LengthFunctions.h"
61 #include "wtf/CurrentTime.h" 62 #include "wtf/CurrentTime.h"
62 #include "wtf/text/StringBuilder.h" 63 #include "wtf/text/StringBuilder.h"
63 64
64 using namespace std; 65 using namespace std;
65 66
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 updateInternalHierarchy(); 458 updateInternalHierarchy();
458 459
459 if (updateMaskLayer(renderer->hasMask())) 460 if (updateMaskLayer(renderer->hasMask()))
460 m_graphicsLayer->setMaskLayer(m_maskLayer.get()); 461 m_graphicsLayer->setMaskLayer(m_maskLayer.get());
461 462
462 bool needsChildClippingMask = (renderer->style()->hasBorderRadius() || rende rer->style()->clipPath()) && isAcceleratedContents(renderer); 463 bool needsChildClippingMask = (renderer->style()->hasBorderRadius() || rende rer->style()->clipPath()) && isAcceleratedContents(renderer);
463 if (updateClippingMaskLayers(needsChildClippingMask)) 464 if (updateClippingMaskLayers(needsChildClippingMask))
464 m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLayer.g et()); 465 m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLayer.g et());
465 466
466 if (m_owningLayer->reflectionInfo()) { 467 if (m_owningLayer->reflectionInfo()) {
467 if (m_owningLayer->reflectionInfo()->reflectionLayer()->compositedLayerM apping()) { 468 if (m_owningLayer->reflectionInfo()->reflectionLayer()->hasCompositedLay erMapping()) {
468 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionInfo()->re flectionLayer()->compositedLayerMapping()->mainGraphicsLayer(); 469 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionInfo()->re flectionLayer()->compositedLayerMapping()->mainGraphicsLayer();
469 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); 470 m_graphicsLayer->setReplicatedByLayer(reflectionLayer);
470 } 471 }
471 } else { 472 } else {
472 m_graphicsLayer->setReplicatedByLayer(0); 473 m_graphicsLayer->setReplicatedByLayer(0);
473 } 474 }
474 475
475 updateBackgroundColor(isSimpleContainerCompositingLayer()); 476 updateBackgroundColor(isSimpleContainerCompositingLayer());
476 477
477 if (isDirectlyCompositedImage()) 478 if (isDirectlyCompositedImage())
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 // FIXME: reflections should force transform-style to be flat in the style: https://bugs.webkit.org/show_bug.cgi?id=106959 545 // FIXME: reflections should force transform-style to be flat in the style: https://bugs.webkit.org/show_bug.cgi?id=106959
545 bool preserves3D = style->transformStyle3D() == TransformStyle3DPreserve3D & & !renderer()->hasReflection(); 546 bool preserves3D = style->transformStyle3D() == TransformStyle3DPreserve3D & & !renderer()->hasReflection();
546 m_graphicsLayer->setPreserves3D(preserves3D); 547 m_graphicsLayer->setPreserves3D(preserves3D);
547 m_graphicsLayer->setBackfaceVisibility(style->backfaceVisibility() == Backfa ceVisibilityVisible); 548 m_graphicsLayer->setBackfaceVisibility(style->backfaceVisibility() == Backfa ceVisibilityVisible);
548 549
549 RenderLayer* compAncestor = m_owningLayer->ancestorCompositingLayer(); 550 RenderLayer* compAncestor = m_owningLayer->ancestorCompositingLayer();
550 551
551 // We compute everything relative to the enclosing compositing layer. 552 // We compute everything relative to the enclosing compositing layer.
552 IntRect ancestorCompositingBounds; 553 IntRect ancestorCompositingBounds;
553 if (compAncestor) { 554 if (compAncestor) {
554 ASSERT(compAncestor->compositedLayerMapping()); 555 ASSERT(compAncestor->hasCompositedLayerMapping());
555 ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->composited LayerMapping()->compositedBounds()); 556 ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->composited LayerMapping()->compositedBounds());
556 } 557 }
557 558
558 IntRect localCompositingBounds = pixelSnappedIntRect(compositedBounds()); 559 IntRect localCompositingBounds = pixelSnappedIntRect(compositedBounds());
559 560
560 IntRect relativeCompositingBounds(localCompositingBounds); 561 IntRect relativeCompositingBounds(localCompositingBounds);
561 IntPoint delta; 562 IntPoint delta;
562 m_owningLayer->convertToPixelSnappedLayerCoords(compAncestor, delta); 563 m_owningLayer->convertToPixelSnappedLayerCoords(compAncestor, delta);
563 relativeCompositingBounds.moveBy(delta); 564 relativeCompositingBounds.moveBy(delta);
564 565
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 backgroundSize = frameView->visibleContentRect().size(); 694 backgroundSize = frameView->visibleContentRect().size();
694 } 695 }
695 m_backgroundLayer->setPosition(backgroundPosition); 696 m_backgroundLayer->setPosition(backgroundPosition);
696 if (backgroundSize != m_backgroundLayer->size()) { 697 if (backgroundSize != m_backgroundLayer->size()) {
697 m_backgroundLayer->setSize(backgroundSize); 698 m_backgroundLayer->setSize(backgroundSize);
698 m_backgroundLayer->setNeedsDisplay(); 699 m_backgroundLayer->setNeedsDisplay();
699 } 700 }
700 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend erer()); 701 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend erer());
701 } 702 }
702 703
703 if (m_owningLayer->reflectionInfo() && m_owningLayer->reflectionInfo()->refl ectionLayer()->compositedLayerMapping()) { 704 if (m_owningLayer->reflectionInfo() && m_owningLayer->reflectionInfo()->refl ectionLayer()->hasCompositedLayerMapping()) {
704 CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer ->reflectionInfo()->reflectionLayer()->compositedLayerMapping(); 705 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLay er->reflectionInfo()->reflectionLayer()->compositedLayerMapping();
705 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(); 706 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry();
706 707
707 // The reflection layer has the bounds of m_owningLayer->reflectionLayer (), 708 // The reflection layer has the bounds of m_owningLayer->reflectionLayer (),
708 // but the reflected layer is the bounds of this layer, so we need to po sition it appropriately. 709 // but the reflected layer is the bounds of this layer, so we need to po sition it appropriately.
709 FloatRect layerBounds = compositedBounds(); 710 FloatRect layerBounds = compositedBounds();
710 FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->comp ositedBounds(); 711 FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->comp ositedBounds();
711 reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLaye rPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location())) ; 712 reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLaye rPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location())) ;
712 } 713 }
713 714
714 if (m_scrollingLayer) { 715 if (m_scrollingLayer) {
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 1342
1342 static bool hasVisibleNonCompositingDescendant(RenderLayer* parent) 1343 static bool hasVisibleNonCompositingDescendant(RenderLayer* parent)
1343 { 1344 {
1344 // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512. 1345 // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512.
1345 parent->stackingNode()->updateLayerListsIfNeeded(); 1346 parent->stackingNode()->updateLayerListsIfNeeded();
1346 1347
1347 #if !ASSERT_DISABLED 1348 #if !ASSERT_DISABLED
1348 LayerListMutationDetector mutationChecker(parent->stackingNode()); 1349 LayerListMutationDetector mutationChecker(parent->stackingNode());
1349 #endif 1350 #endif
1350 1351
1351 if (Vector<RenderLayerStackingNode*>* normalFlowList = parent->stackingNode( )->normalFlowList()) { 1352 RenderLayerStackingNodeIterator normalFlowIterator(*parent->stackingNode(), NormalFlowChildren);
1352 size_t listSize = normalFlowList->size(); 1353 while (RenderLayerStackingNode* curNode = normalFlowIterator.next()) {
1353 for (size_t i = 0; i < listSize; ++i) { 1354 RenderLayer* curLayer = curNode->layer();
1354 RenderLayer* curLayer = normalFlowList->at(i)->layer(); 1355 if (!curLayer->hasCompositedLayerMapping()
1355 if (!curLayer->compositedLayerMapping() 1356 && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescend ant(curLayer)))
1356 && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDes cendant(curLayer))) 1357 return true;
1357 return true;
1358 }
1359 } 1358 }
1360 1359
1361 if (parent->stackingNode()->isStackingContainer()) { 1360 if (!parent->hasVisibleDescendant())
1362 if (!parent->hasVisibleDescendant()) 1361 return false;
1363 return false;
1364 1362
1365 // Use the m_hasCompositingDescendant bit to optimize? 1363 RenderLayerStackingNodeIterator zOrderIterator(*parent->stackingNode(), Nega tiveZOrderChildren | PositiveZOrderChildren);
1366 if (Vector<RenderLayerStackingNode*>* negZOrderList = parent->stackingNo de()->negZOrderList()) { 1364 while (RenderLayerStackingNode* curNode = zOrderIterator.next()) {
1367 size_t listSize = negZOrderList->size(); 1365 RenderLayer* curLayer = curNode->layer();
1368 for (size_t i = 0; i < listSize; ++i) { 1366 if (!curLayer->hasCompositedLayerMapping()
1369 RenderLayer* curLayer = negZOrderList->at(i)->layer(); 1367 && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescend ant(curLayer)))
1370 if (!curLayer->compositedLayerMapping() 1368 return true;
1371 && (curLayer->hasVisibleContent() || hasVisibleNonCompositin gDescendant(curLayer)))
1372 return true;
1373 }
1374 }
1375
1376 if (Vector<RenderLayerStackingNode*>* posZOrderList = parent->stackingNo de()->posZOrderList()) {
1377 size_t listSize = posZOrderList->size();
1378 for (size_t i = 0; i < listSize; ++i) {
1379 RenderLayer* curLayer = posZOrderList->at(i)->layer();
1380 if (!curLayer->compositedLayerMapping()
1381 && (curLayer->hasVisibleContent() || hasVisibleNonCompositin gDescendant(curLayer)))
1382 return true;
1383 }
1384 }
1385 } 1369 }
1386 1370
1387 return false; 1371 return false;
1388 } 1372 }
1389 1373
1390 // FIXME: By name the implementation is correct. But the code that uses this fun ction means something 1374 // FIXME: By name the implementation is correct. But the code that uses this fun ction means something
1391 // very slightly different - the implementation needs to also include composited descendants that 1375 // very slightly different - the implementation needs to also include composited descendants that
1392 // don't paint into their own backing, and instead paint into this backing. 1376 // don't paint into their own backing, and instead paint into this backing.
1393 bool CompositedLayerMapping::hasVisibleNonCompositingDescendantLayers() const 1377 bool CompositedLayerMapping::hasVisibleNonCompositingDescendantLayers() const
1394 { 1378 {
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2004 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2021 name = "Scrolling Contents Layer"; 2005 name = "Scrolling Contents Layer";
2022 } else { 2006 } else {
2023 ASSERT_NOT_REACHED(); 2007 ASSERT_NOT_REACHED();
2024 } 2008 }
2025 2009
2026 return name; 2010 return name;
2027 } 2011 }
2028 2012
2029 } // namespace WebCore 2013 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698