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

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: . 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 bool hasAncestorClippingLayer = compositor()->clippedByAncestor(m_owningLaye r); 317 bool hasAncestorClippingLayer = compositor()->clippedByAncestor(m_owningLaye r);
317 bool clippingAncestorIsScrollParent = m_owningLayer->renderer()->containingB lock()->enclosingLayer() == m_owningLayer->ancestorScrollingLayer(); 318 bool clippingAncestorIsScrollParent = m_owningLayer->renderer()->containingB lock()->enclosingLayer() == m_owningLayer->ancestorScrollingLayer();
318 if (hasAncestorClippingLayer && clippingAncestorIsScrollParent) 319 if (hasAncestorClippingLayer && clippingAncestorIsScrollParent)
319 return false; 320 return false;
320 321
321 return true; 322 return true;
322 } 323 }
323 324
324 void CompositedLayerMapping::updateCompositedBounds() 325 void CompositedLayerMapping::updateCompositedBounds()
325 { 326 {
327 // We need to know if we draw content in order to update our bounds (this ha s an effect
328 // on whether or not descendands will paint into our backing). Update this v alue now.
329 updateDrawsContent(isSimpleContainerCompositingLayer());
hartmanng 2013/11/08 22:51:05 this seems out of place in this patch
330
326 IntRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer); 331 IntRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer);
327 332
328 // Clip to the size of the document or enclosing overflow-scroll layer. 333 // Clip to the size of the document or enclosing overflow-scroll layer.
329 // If this or an ancestor is transformed, we can't currently compute the cor rect rect to intersect with. 334 // If this or an ancestor is transformed, we can't currently compute the cor rect rect to intersect with.
330 // We'd need RenderObject::convertContainerToLocalQuad(), which doesn't yet exist. 335 // We'd need RenderObject::convertContainerToLocalQuad(), which doesn't yet exist.
331 if (shouldClipCompositedBounds()) { 336 if (shouldClipCompositedBounds()) {
332 RenderView* view = m_owningLayer->renderer()->view(); 337 RenderView* view = m_owningLayer->renderer()->view();
333 RenderLayer* rootLayer = view->layer(); 338 RenderLayer* rootLayer = view->layer();
334 339
335 LayoutRect clippingBounds; 340 LayoutRect clippingBounds;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 updateInternalHierarchy(); 462 updateInternalHierarchy();
458 463
459 if (updateMaskLayer(renderer->hasMask())) 464 if (updateMaskLayer(renderer->hasMask()))
460 m_graphicsLayer->setMaskLayer(m_maskLayer.get()); 465 m_graphicsLayer->setMaskLayer(m_maskLayer.get());
461 466
462 bool needsChildClippingMask = (renderer->style()->hasBorderRadius() || rende rer->style()->clipPath()) && isAcceleratedContents(renderer); 467 bool needsChildClippingMask = (renderer->style()->hasBorderRadius() || rende rer->style()->clipPath()) && isAcceleratedContents(renderer);
463 if (updateClippingMaskLayers(needsChildClippingMask)) 468 if (updateClippingMaskLayers(needsChildClippingMask))
464 m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLayer.g et()); 469 m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLayer.g et());
465 470
466 if (m_owningLayer->reflectionInfo()) { 471 if (m_owningLayer->reflectionInfo()) {
467 if (m_owningLayer->reflectionInfo()->reflectionLayer()->compositedLayerM apping()) { 472 if (m_owningLayer->reflectionInfo()->reflectionLayer()->hasCompositedLay erMapping()) {
468 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionInfo()->re flectionLayer()->compositedLayerMapping()->mainGraphicsLayer(); 473 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionInfo()->re flectionLayer()->compositedLayerMapping()->mainGraphicsLayer();
469 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); 474 m_graphicsLayer->setReplicatedByLayer(reflectionLayer);
470 } 475 }
471 } else { 476 } else {
472 m_graphicsLayer->setReplicatedByLayer(0); 477 m_graphicsLayer->setReplicatedByLayer(0);
473 } 478 }
474 479
475 updateBackgroundColor(isSimpleContainerCompositingLayer()); 480 updateBackgroundColor(isSimpleContainerCompositingLayer());
476 481
477 if (isDirectlyCompositedImage()) 482 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 549 // 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(); 550 bool preserves3D = style->transformStyle3D() == TransformStyle3DPreserve3D & & !renderer()->hasReflection();
546 m_graphicsLayer->setPreserves3D(preserves3D); 551 m_graphicsLayer->setPreserves3D(preserves3D);
547 m_graphicsLayer->setBackfaceVisibility(style->backfaceVisibility() == Backfa ceVisibilityVisible); 552 m_graphicsLayer->setBackfaceVisibility(style->backfaceVisibility() == Backfa ceVisibilityVisible);
548 553
549 RenderLayer* compAncestor = m_owningLayer->ancestorCompositingLayer(); 554 RenderLayer* compAncestor = m_owningLayer->ancestorCompositingLayer();
550 555
551 // We compute everything relative to the enclosing compositing layer. 556 // We compute everything relative to the enclosing compositing layer.
552 IntRect ancestorCompositingBounds; 557 IntRect ancestorCompositingBounds;
553 if (compAncestor) { 558 if (compAncestor) {
554 ASSERT(compAncestor->compositedLayerMapping()); 559 ASSERT(compAncestor->hasCompositedLayerMapping());
555 ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->composited LayerMapping()->compositedBounds()); 560 ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->composited LayerMapping()->compositedBounds());
556 } 561 }
557 562
558 IntRect localCompositingBounds = pixelSnappedIntRect(compositedBounds()); 563 IntRect localCompositingBounds = pixelSnappedIntRect(compositedBounds());
559 564
560 IntRect relativeCompositingBounds(localCompositingBounds); 565 IntRect relativeCompositingBounds(localCompositingBounds);
561 IntPoint delta; 566 IntPoint delta;
562 m_owningLayer->convertToPixelSnappedLayerCoords(compAncestor, delta); 567 m_owningLayer->convertToPixelSnappedLayerCoords(compAncestor, delta);
563 relativeCompositingBounds.moveBy(delta); 568 relativeCompositingBounds.moveBy(delta);
564 569
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 backgroundSize = frameView->visibleContentRect().size(); 698 backgroundSize = frameView->visibleContentRect().size();
694 } 699 }
695 m_backgroundLayer->setPosition(backgroundPosition); 700 m_backgroundLayer->setPosition(backgroundPosition);
696 if (backgroundSize != m_backgroundLayer->size()) { 701 if (backgroundSize != m_backgroundLayer->size()) {
697 m_backgroundLayer->setSize(backgroundSize); 702 m_backgroundLayer->setSize(backgroundSize);
698 m_backgroundLayer->setNeedsDisplay(); 703 m_backgroundLayer->setNeedsDisplay();
699 } 704 }
700 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend erer()); 705 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend erer());
701 } 706 }
702 707
703 if (m_owningLayer->reflectionInfo() && m_owningLayer->reflectionInfo()->refl ectionLayer()->compositedLayerMapping()) { 708 if (m_owningLayer->reflectionInfo() && m_owningLayer->reflectionInfo()->refl ectionLayer()->hasCompositedLayerMapping()) {
704 CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer ->reflectionInfo()->reflectionLayer()->compositedLayerMapping(); 709 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLay er->reflectionInfo()->reflectionLayer()->compositedLayerMapping();
705 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(); 710 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry();
706 711
707 // The reflection layer has the bounds of m_owningLayer->reflectionLayer (), 712 // 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. 713 // but the reflected layer is the bounds of this layer, so we need to po sition it appropriately.
709 FloatRect layerBounds = compositedBounds(); 714 FloatRect layerBounds = compositedBounds();
710 FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->comp ositedBounds(); 715 FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->comp ositedBounds();
711 reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLaye rPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location())) ; 716 reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLaye rPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location())) ;
712 } 717 }
713 718
714 if (m_scrollingLayer) { 719 if (m_scrollingLayer) {
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 1346
1342 static bool hasVisibleNonCompositingDescendant(RenderLayer* parent) 1347 static bool hasVisibleNonCompositingDescendant(RenderLayer* parent)
1343 { 1348 {
1344 // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512. 1349 // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512.
1345 parent->stackingNode()->updateLayerListsIfNeeded(); 1350 parent->stackingNode()->updateLayerListsIfNeeded();
1346 1351
1347 #if !ASSERT_DISABLED 1352 #if !ASSERT_DISABLED
1348 LayerListMutationDetector mutationChecker(parent->stackingNode()); 1353 LayerListMutationDetector mutationChecker(parent->stackingNode());
1349 #endif 1354 #endif
1350 1355
1351 if (Vector<RenderLayerStackingNode*>* normalFlowList = parent->stackingNode( )->normalFlowList()) { 1356 RenderLayerStackingNodeIterator normalFlowIterator(*parent->stackingNode(), NormalFlowChildren);
1352 size_t listSize = normalFlowList->size(); 1357 while (RenderLayerStackingNode* curNode = normalFlowIterator.next()) {
1353 for (size_t i = 0; i < listSize; ++i) { 1358 RenderLayer* curLayer = curNode->layer();
1354 RenderLayer* curLayer = normalFlowList->at(i)->layer(); 1359 if (!curLayer->hasCompositedLayerMapping()
1355 if (!curLayer->compositedLayerMapping() 1360 && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescend ant(curLayer)))
1356 && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDes cendant(curLayer))) 1361 return true;
1357 return true;
1358 }
1359 } 1362 }
1360 1363
1361 if (parent->stackingNode()->isStackingContainer()) { 1364 if (!parent->hasVisibleDescendant())
1362 if (!parent->hasVisibleDescendant()) 1365 return false;
1363 return false;
1364 1366
1365 // Use the m_hasCompositingDescendant bit to optimize? 1367 RenderLayerStackingNodeIterator zOrderIterator(*parent->stackingNode(), Nega tiveZOrderChildren | PositiveZOrderChildren);
1366 if (Vector<RenderLayerStackingNode*>* negZOrderList = parent->stackingNo de()->negZOrderList()) { 1368 while (RenderLayerStackingNode* curNode = zOrderIterator.next()) {
1367 size_t listSize = negZOrderList->size(); 1369 RenderLayer* curLayer = curNode->layer();
1368 for (size_t i = 0; i < listSize; ++i) { 1370 if (!curLayer->hasCompositedLayerMapping()
1369 RenderLayer* curLayer = negZOrderList->at(i)->layer(); 1371 && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescend ant(curLayer)))
1370 if (!curLayer->compositedLayerMapping() 1372 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 } 1373 }
1386 1374
1387 return false; 1375 return false;
1388 } 1376 }
1389 1377
1390 // FIXME: By name the implementation is correct. But the code that uses this fun ction means something 1378 // 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 1379 // 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. 1380 // don't paint into their own backing, and instead paint into this backing.
1393 bool CompositedLayerMapping::hasVisibleNonCompositingDescendantLayers() const 1381 bool CompositedLayerMapping::hasVisibleNonCompositingDescendantLayers() const
1394 { 1382 {
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2008 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2021 name = "Scrolling Contents Layer"; 2009 name = "Scrolling Contents Layer";
2022 } else { 2010 } else {
2023 ASSERT_NOT_REACHED(); 2011 ASSERT_NOT_REACHED();
2024 } 2012 }
2025 2013
2026 return name; 2014 return name;
2027 } 2015 }
2028 2016
2029 } // namespace WebCore 2017 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698