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

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

Issue 58543002: Use a boolean hasCompositedLayerMapping() accessor instead of the pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 updateInternalHierarchy(); 462 updateInternalHierarchy();
463 463
464 if (updateMaskLayer(renderer->hasMask())) 464 if (updateMaskLayer(renderer->hasMask()))
465 m_graphicsLayer->setMaskLayer(m_maskLayer.get()); 465 m_graphicsLayer->setMaskLayer(m_maskLayer.get());
466 466
467 bool needsChildClippingMask = (renderer->style()->hasBorderRadius() || rende rer->style()->clipPath()) && isAcceleratedContents(renderer); 467 bool needsChildClippingMask = (renderer->style()->hasBorderRadius() || rende rer->style()->clipPath()) && isAcceleratedContents(renderer);
468 if (updateClippingMaskLayers(needsChildClippingMask)) 468 if (updateClippingMaskLayers(needsChildClippingMask))
469 m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLayer.g et()); 469 m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLayer.g et());
470 470
471 if (m_owningLayer->reflectionInfo()) { 471 if (m_owningLayer->reflectionInfo()) {
472 if (m_owningLayer->reflectionInfo()->reflectionLayer()->compositedLayerM apping()) { 472 if (m_owningLayer->reflectionInfo()->reflectionLayer()->hasCompositedLay erMapping()) {
473 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionInfo()->re flectionLayer()->compositedLayerMapping()->mainGraphicsLayer(); 473 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionInfo()->re flectionLayer()->compositedLayerMapping()->mainGraphicsLayer();
474 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); 474 m_graphicsLayer->setReplicatedByLayer(reflectionLayer);
475 } 475 }
476 } else { 476 } else {
477 m_graphicsLayer->setReplicatedByLayer(0); 477 m_graphicsLayer->setReplicatedByLayer(0);
478 } 478 }
479 479
480 updateBackgroundColor(isSimpleContainerCompositingLayer()); 480 updateBackgroundColor(isSimpleContainerCompositingLayer());
481 481
482 if (isDirectlyCompositedImage()) 482 if (isDirectlyCompositedImage())
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 // 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
550 bool preserves3D = style->transformStyle3D() == TransformStyle3DPreserve3D & & !renderer()->hasReflection(); 550 bool preserves3D = style->transformStyle3D() == TransformStyle3DPreserve3D & & !renderer()->hasReflection();
551 m_graphicsLayer->setPreserves3D(preserves3D); 551 m_graphicsLayer->setPreserves3D(preserves3D);
552 m_graphicsLayer->setBackfaceVisibility(style->backfaceVisibility() == Backfa ceVisibilityVisible); 552 m_graphicsLayer->setBackfaceVisibility(style->backfaceVisibility() == Backfa ceVisibilityVisible);
553 553
554 RenderLayer* compAncestor = m_owningLayer->ancestorCompositingLayer(); 554 RenderLayer* compAncestor = m_owningLayer->ancestorCompositingLayer();
555 555
556 // We compute everything relative to the enclosing compositing layer. 556 // We compute everything relative to the enclosing compositing layer.
557 IntRect ancestorCompositingBounds; 557 IntRect ancestorCompositingBounds;
558 if (compAncestor) { 558 if (compAncestor) {
559 ASSERT(compAncestor->compositedLayerMapping()); 559 ASSERT(compAncestor->hasCompositedLayerMapping());
560 ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->composited LayerMapping()->compositedBounds()); 560 ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->composited LayerMapping()->compositedBounds());
561 } 561 }
562 562
563 IntRect localCompositingBounds = pixelSnappedIntRect(compositedBounds()); 563 IntRect localCompositingBounds = pixelSnappedIntRect(compositedBounds());
564 564
565 IntRect relativeCompositingBounds(localCompositingBounds); 565 IntRect relativeCompositingBounds(localCompositingBounds);
566 IntPoint delta; 566 IntPoint delta;
567 m_owningLayer->convertToPixelSnappedLayerCoords(compAncestor, delta); 567 m_owningLayer->convertToPixelSnappedLayerCoords(compAncestor, delta);
568 relativeCompositingBounds.moveBy(delta); 568 relativeCompositingBounds.moveBy(delta);
569 569
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 backgroundSize = frameView->visibleContentRect().size(); 698 backgroundSize = frameView->visibleContentRect().size();
699 } 699 }
700 m_backgroundLayer->setPosition(backgroundPosition); 700 m_backgroundLayer->setPosition(backgroundPosition);
701 if (backgroundSize != m_backgroundLayer->size()) { 701 if (backgroundSize != m_backgroundLayer->size()) {
702 m_backgroundLayer->setSize(backgroundSize); 702 m_backgroundLayer->setSize(backgroundSize);
703 m_backgroundLayer->setNeedsDisplay(); 703 m_backgroundLayer->setNeedsDisplay();
704 } 704 }
705 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend erer()); 705 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend erer());
706 } 706 }
707 707
708 if (m_owningLayer->reflectionInfo() && m_owningLayer->reflectionInfo()->refl ectionLayer()->compositedLayerMapping()) { 708 if (m_owningLayer->reflectionInfo() && m_owningLayer->reflectionInfo()->refl ectionLayer()->hasCompositedLayerMapping()) {
709 CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer ->reflectionInfo()->reflectionLayer()->compositedLayerMapping(); 709 CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer ->reflectionInfo()->reflectionLayer()->compositedLayerMapping();
710 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(); 710 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry();
711 711
712 // The reflection layer has the bounds of m_owningLayer->reflectionLayer (), 712 // The reflection layer has the bounds of m_owningLayer->reflectionLayer (),
713 // 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.
714 FloatRect layerBounds = compositedBounds(); 714 FloatRect layerBounds = compositedBounds();
715 FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->comp ositedBounds(); 715 FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->comp ositedBounds();
716 reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLaye rPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location())) ; 716 reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLaye rPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location())) ;
717 } 717 }
718 718
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 parent->stackingNode()->updateLayerListsIfNeeded(); 1350 parent->stackingNode()->updateLayerListsIfNeeded();
1351 1351
1352 #if !ASSERT_DISABLED 1352 #if !ASSERT_DISABLED
1353 LayerListMutationDetector mutationChecker(parent->stackingNode()); 1353 LayerListMutationDetector mutationChecker(parent->stackingNode());
1354 #endif 1354 #endif
1355 1355
1356 if (Vector<RenderLayerStackingNode*>* normalFlowList = parent->stackingNode( )->normalFlowList()) { 1356 if (Vector<RenderLayerStackingNode*>* normalFlowList = parent->stackingNode( )->normalFlowList()) {
1357 size_t listSize = normalFlowList->size(); 1357 size_t listSize = normalFlowList->size();
1358 for (size_t i = 0; i < listSize; ++i) { 1358 for (size_t i = 0; i < listSize; ++i) {
1359 RenderLayer* curLayer = normalFlowList->at(i)->layer(); 1359 RenderLayer* curLayer = normalFlowList->at(i)->layer();
1360 if (!curLayer->compositedLayerMapping() 1360 if (!curLayer->hasCompositedLayerMapping()
1361 && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDes cendant(curLayer))) 1361 && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDes cendant(curLayer)))
1362 return true; 1362 return true;
1363 } 1363 }
1364 } 1364 }
1365 1365
1366 if (parent->stackingNode()->isStackingContainer()) { 1366 if (parent->stackingNode()->isStackingContainer()) {
1367 if (!parent->hasVisibleDescendant()) 1367 if (!parent->hasVisibleDescendant())
1368 return false; 1368 return false;
1369 1369
1370 // Use the m_hasCompositingDescendant bit to optimize? 1370 // Use the m_hasCompositingDescendant bit to optimize?
1371 if (Vector<RenderLayerStackingNode*>* negZOrderList = parent->stackingNo de()->negZOrderList()) { 1371 if (Vector<RenderLayerStackingNode*>* negZOrderList = parent->stackingNo de()->negZOrderList()) {
1372 size_t listSize = negZOrderList->size(); 1372 size_t listSize = negZOrderList->size();
1373 for (size_t i = 0; i < listSize; ++i) { 1373 for (size_t i = 0; i < listSize; ++i) {
1374 RenderLayer* curLayer = negZOrderList->at(i)->layer(); 1374 RenderLayer* curLayer = negZOrderList->at(i)->layer();
1375 if (!curLayer->compositedLayerMapping() 1375 if (!curLayer->hasCompositedLayerMapping()
1376 && (curLayer->hasVisibleContent() || hasVisibleNonCompositin gDescendant(curLayer))) 1376 && (curLayer->hasVisibleContent() || hasVisibleNonCompositin gDescendant(curLayer)))
1377 return true; 1377 return true;
1378 } 1378 }
1379 } 1379 }
1380 1380
1381 if (Vector<RenderLayerStackingNode*>* posZOrderList = parent->stackingNo de()->posZOrderList()) { 1381 if (Vector<RenderLayerStackingNode*>* posZOrderList = parent->stackingNo de()->posZOrderList()) {
1382 size_t listSize = posZOrderList->size(); 1382 size_t listSize = posZOrderList->size();
1383 for (size_t i = 0; i < listSize; ++i) { 1383 for (size_t i = 0; i < listSize; ++i) {
1384 RenderLayer* curLayer = posZOrderList->at(i)->layer(); 1384 RenderLayer* curLayer = posZOrderList->at(i)->layer();
1385 if (!curLayer->compositedLayerMapping() 1385 if (!curLayer->hasCompositedLayerMapping()
1386 && (curLayer->hasVisibleContent() || hasVisibleNonCompositin gDescendant(curLayer))) 1386 && (curLayer->hasVisibleContent() || hasVisibleNonCompositin gDescendant(curLayer)))
1387 return true; 1387 return true;
1388 } 1388 }
1389 } 1389 }
1390 } 1390 }
1391 1391
1392 return false; 1392 return false;
1393 } 1393 }
1394 1394
1395 // FIXME: By name the implementation is correct. But the code that uses this fun ction means something 1395 // FIXME: By name the implementation is correct. But the code that uses this fun ction means something
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
2025 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2025 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2026 name = "Scrolling Contents Layer"; 2026 name = "Scrolling Contents Layer";
2027 } else { 2027 } else {
2028 ASSERT_NOT_REACHED(); 2028 ASSERT_NOT_REACHED();
2029 } 2029 }
2030 2030
2031 return name; 2031 return name;
2032 } 2032 }
2033 2033
2034 } // namespace WebCore 2034 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698