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

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

Issue 24921002: Make compositingState explicit (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: path for re-landing try #2 with removed unnecessary comment Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderLayer.cpp ('k') | Source/core/rendering/RenderLayerRepainter.cpp » ('j') | 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) 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 317
318 IntRect visibleRect = m_containerLayer ? IntRect(IntPoint(), frameView->cont entsSize()) : frameView->visibleContentRect(); 318 IntRect visibleRect = m_containerLayer ? IntRect(IntPoint(), frameView->cont entsSize()) : frameView->visibleContentRect();
319 if (rootLayer->visibleRectChangeRequiresFlush(visibleRect)) { 319 if (rootLayer->visibleRectChangeRequiresFlush(visibleRect)) {
320 if (Page* page = this->page()) 320 if (Page* page = this->page())
321 page->chrome().client().scheduleCompositingLayerFlush(); 321 page->chrome().client().scheduleCompositingLayerFlush();
322 } 322 }
323 } 323 }
324 324
325 bool RenderLayerCompositor::hasAnyAdditionalCompositedLayers(const RenderLayer* rootLayer) const 325 bool RenderLayerCompositor::hasAnyAdditionalCompositedLayers(const RenderLayer* rootLayer) const
326 { 326 {
327 return m_compositedLayerCount > (rootLayer->isComposited() ? 1 : 0); 327 return m_compositedLayerCount > (rootLayer->compositedLayerMapping() ? 1 : 0 );
328 } 328 }
329 329
330 void RenderLayerCompositor::updateCompositingRequirementsState() 330 void RenderLayerCompositor::updateCompositingRequirementsState()
331 { 331 {
332 if (!m_needsUpdateCompositingRequirementsState) 332 if (!m_needsUpdateCompositingRequirementsState)
333 return; 333 return;
334 334
335 TRACE_EVENT0("blink_rendering,comp-scroll", "RenderLayerCompositor::updateCo mpositingRequirementsState"); 335 TRACE_EVENT0("blink_rendering,comp-scroll", "RenderLayerCompositor::updateCo mpositingRequirementsState");
336 336
337 m_needsUpdateCompositingRequirementsState = false; 337 m_needsUpdateCompositingRequirementsState = false;
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 repaintContainer = m_renderView; 664 repaintContainer = m_renderView;
665 665
666 layer->repainter().repaintIncludingNonCompositingDescendants(repaintContaine r); 666 layer->repainter().repaintIncludingNonCompositingDescendants(repaintContaine r);
667 } 667 }
668 668
669 // This method assumes that layout is up-to-date, unlike repaintOnCompositingCha nge(). 669 // This method assumes that layout is up-to-date, unlike repaintOnCompositingCha nge().
670 void RenderLayerCompositor::repaintInCompositedAncestor(RenderLayer* layer, cons t LayoutRect& rect) 670 void RenderLayerCompositor::repaintInCompositedAncestor(RenderLayer* layer, cons t LayoutRect& rect)
671 { 671 {
672 RenderLayer* compositedAncestor = layer->enclosingCompositingLayerForRepaint (false /*exclude self*/); 672 RenderLayer* compositedAncestor = layer->enclosingCompositingLayerForRepaint (false /*exclude self*/);
673 if (compositedAncestor) { 673 if (compositedAncestor) {
674 ASSERT(compositedAncestor->compositedLayerMapping()); 674 ASSERT(compositedAncestor->compositingState() == PaintsIntoOwnBacking);
675 675
676 LayoutPoint offset; 676 LayoutPoint offset;
677 layer->convertToLayerCoords(compositedAncestor, offset); 677 layer->convertToLayerCoords(compositedAncestor, offset);
678 678
679 LayoutRect repaintRect = rect; 679 LayoutRect repaintRect = rect;
680 repaintRect.moveBy(offset); 680 repaintRect.moveBy(offset);
681 681
682 compositedAncestor->setBackingNeedsRepaintInRect(repaintRect); 682 compositedAncestor->setBackingNeedsRepaintInRect(repaintRect);
683 } 683 }
684 } 684 }
(...skipping 14 matching lines...) Expand all
699 return layer->calculateLayerBounds(ancestorLayer, 0, flags); 699 return layer->calculateLayerBounds(ancestorLayer, 0, flags);
700 } 700 }
701 701
702 void RenderLayerCompositor::layerWasAdded(RenderLayer* /*parent*/, RenderLayer* /*child*/) 702 void RenderLayerCompositor::layerWasAdded(RenderLayer* /*parent*/, RenderLayer* /*child*/)
703 { 703 {
704 setCompositingLayersNeedRebuild(); 704 setCompositingLayersNeedRebuild();
705 } 705 }
706 706
707 void RenderLayerCompositor::layerWillBeRemoved(RenderLayer* parent, RenderLayer* child) 707 void RenderLayerCompositor::layerWillBeRemoved(RenderLayer* parent, RenderLayer* child)
708 { 708 {
709 if (!child->isComposited() || parent->renderer()->documentBeingDestroyed()) 709 if (!child->compositedLayerMapping() || parent->renderer()->documentBeingDes troyed())
710 return; 710 return;
711 711
712 removeViewportConstrainedLayer(child); 712 removeViewportConstrainedLayer(child);
713 repaintInCompositedAncestor(child, child->compositedLayerMapping()->composit edBounds()); 713 repaintInCompositedAncestor(child, child->compositedLayerMapping()->composit edBounds());
714 714
715 setCompositingParent(child, 0); 715 setCompositingParent(child, 0);
716 setCompositingLayersNeedRebuild(); 716 setCompositingLayersNeedRebuild();
717 } 717 }
718 718
719 RenderLayer* RenderLayerCompositor::enclosingNonStackingClippingLayer(const Rend erLayer* layer) const 719 RenderLayer* RenderLayerCompositor::enclosingNonStackingClippingLayer(const Rend erLayer* layer) const
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 layer->reflectionLayer()->setCompositingReasons(layer->reflectionLayer() ->compositingReasons() | reflectionCompositingReason); 1014 layer->reflectionLayer()->setCompositingReasons(layer->reflectionLayer() ->compositingReasons() | reflectionCompositingReason);
1015 } 1015 }
1016 1016
1017 // Subsequent layers in the parent's stacking context may also need to compo site. 1017 // Subsequent layers in the parent's stacking context may also need to compo site.
1018 if (childRecursionData.m_subtreeIsCompositing) 1018 if (childRecursionData.m_subtreeIsCompositing)
1019 currentRecursionData.m_subtreeIsCompositing = true; 1019 currentRecursionData.m_subtreeIsCompositing = true;
1020 1020
1021 // Set the flag to say that this SC has compositing children. 1021 // Set the flag to say that this SC has compositing children.
1022 layer->setHasCompositingDescendant(childRecursionData.m_subtreeIsCompositing ); 1022 layer->setHasCompositingDescendant(childRecursionData.m_subtreeIsCompositing );
1023 1023
1024
1025 // Turn overlap testing off for later layers if it's already off, or if we h ave an animating transform. 1024 // Turn overlap testing off for later layers if it's already off, or if we h ave an animating transform.
1026 // Note that if the layer clips its descendants, there's no reason to propag ate the child animation to the parent layers. That's because 1025 // Note that if the layer clips its descendants, there's no reason to propag ate the child animation to the parent layers. That's because
1027 // we know for sure the animation is contained inside the clipping rectangle , which is already added to the overlap map. 1026 // we know for sure the animation is contained inside the clipping rectangle , which is already added to the overlap map.
1028 bool isCompositedClippingLayer = canBeComposited(layer) && (reasonsToComposi te & CompositingReasonClipsCompositingDescendants); 1027 bool isCompositedClippingLayer = canBeComposited(layer) && (reasonsToComposi te & CompositingReasonClipsCompositingDescendants);
1029 if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) || isRunningAcceleratedTransformAnimation(layer->renderer())) 1028 if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) || isRunningAcceleratedTransformAnimation(layer->renderer()))
1030 currentRecursionData.m_testingOverlap = false; 1029 currentRecursionData.m_testingOverlap = false;
1031 1030
1032 if (overlapMap && childRecursionData.m_compositingAncestor == layer && !laye r->isRootLayer()) 1031 if (overlapMap && childRecursionData.m_compositingAncestor == layer && !laye r->isRootLayer())
1033 overlapMap->finishCurrentOverlapTestingContext(); 1032 overlapMap->finishCurrentOverlapTestingContext();
1034 1033
1035 // If we're back at the root, and no other layers need to be composited, and the root layer itself doesn't need 1034 // If we're back at the root, and no other layers need to be composited, and the root layer itself doesn't need
1036 // to be composited, then we can drop out of compositing mode altogether. Ho wever, don't drop out of compositing mode 1035 // to be composited, then we can drop out of compositing mode altogether. Ho wever, don't drop out of compositing mode
1037 // if there are composited layers that we didn't hit in our traversal (e.g. because of visibility:hidden). 1036 // if there are composited layers that we didn't hit in our traversal (e.g. because of visibility:hidden).
1038 // FIXME: hasAnyAdditionalCompositedLayers() code seems fishy. We need to ma ke root layer logic more obvious. 1037 // FIXME: hasAnyAdditionalCompositedLayers() code seems fishy. We need to ma ke root layer logic more obvious.
1039 if (layer->isRootLayer() && !childRecursionData.m_subtreeIsCompositing && !r equiresCompositing(directReasons) && !m_forceCompositingMode && !hasAnyAdditiona lCompositedLayers(layer)) { 1038 if (layer->isRootLayer() && !childRecursionData.m_subtreeIsCompositing && !r equiresCompositing(directReasons) && !m_forceCompositingMode && !hasAnyAdditiona lCompositedLayers(layer)) {
1040 enableCompositingMode(false); 1039 enableCompositingMode(false);
1041 willBeComposited = false; 1040 willBeComposited = false;
1042 reasonsToComposite = CompositingReasonNone; 1041 reasonsToComposite = CompositingReasonNone;
1043 } 1042 }
1044 1043
1045 // At this point we have finished collecting all reasons to composite this l ayer. 1044 // At this point we have finished collecting all reasons to composite this l ayer.
1046 layer->setCompositingReasons(reasonsToComposite); 1045 layer->setCompositingReasons(reasonsToComposite);
1047 1046
1048 // Allocate or deallocate the compositedLayerMapping now, so that we can use isComposited() reliably during tree traversal in rebuildCompositingLayerTree(). 1047 // Allocate or deallocate the compositedLayerMapping now, so that we can kno w the layer's compositing state reliably during tree traversal in rebuildComposi tingLayerTree().
1049 if (allocateOrClearCompositedLayerMapping(layer, CompositingChangeRepaintNow )) 1048 if (allocateOrClearCompositedLayerMapping(layer, CompositingChangeRepaintNow ))
1050 layersChanged = true; 1049 layersChanged = true;
1051 1050
1052 if (layer->reflectionLayer() && updateLayerCompositingState(layer->reflectio nLayer(), CompositingChangeRepaintNow)) 1051 if (layer->reflectionLayer() && updateLayerCompositingState(layer->reflectio nLayer(), CompositingChangeRepaintNow))
1053 layersChanged = true; 1052 layersChanged = true;
1054 1053
1055 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTrans form(); 1054 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTrans form();
1056 1055
1057 if (overlapMap) 1056 if (overlapMap)
1058 overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer); 1057 overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer);
1059 } 1058 }
1060 1059
1061 void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, Render Layer* parentLayer) 1060 void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, Render Layer* parentLayer)
1062 { 1061 {
1063 ASSERT(!parentLayer || childLayer->ancestorCompositingLayer() == parentLayer ); 1062 ASSERT(!parentLayer || childLayer->ancestorCompositingLayer() == parentLayer );
1064 ASSERT(childLayer->isComposited()); 1063 ASSERT(childLayer->compositedLayerMapping());
1065 1064
1066 // It's possible to be called with a parent that isn't yet composited when w e're doing 1065 // It's possible to be called with a parent that isn't yet composited when w e're doing
1067 // partial updates as required by painting or hit testing. Just bail in that case; 1066 // partial updates as required by painting or hit testing. Just bail in that case;
1068 // we'll do a full layer update soon. 1067 // we'll do a full layer update soon.
1069 if (!parentLayer || !parentLayer->isComposited()) 1068 if (!parentLayer || !parentLayer->compositedLayerMapping())
1070 return; 1069 return;
1071 1070
1072 if (parentLayer) { 1071 if (parentLayer) {
1073 GraphicsLayer* hostingLayer = parentLayer->compositedLayerMapping()->par entForSublayers(); 1072 GraphicsLayer* hostingLayer = parentLayer->compositedLayerMapping()->par entForSublayers();
1074 GraphicsLayer* hostedLayer = childLayer->compositedLayerMapping()->child ForSuperlayers(); 1073 GraphicsLayer* hostedLayer = childLayer->compositedLayerMapping()->child ForSuperlayers();
1075 1074
1076 hostingLayer->addChild(hostedLayer); 1075 hostingLayer->addChild(hostedLayer);
1077 } else { 1076 } else {
1078 childLayer->compositedLayerMapping()->childForSuperlayers()->removeFromP arent(); 1077 childLayer->compositedLayerMapping()->childForSuperlayers()->removeFromP arent();
1079 } 1078 }
1080 } 1079 }
1081 1080
1082 void RenderLayerCompositor::removeCompositedChildren(RenderLayer* layer) 1081 void RenderLayerCompositor::removeCompositedChildren(RenderLayer* layer)
1083 { 1082 {
1084 ASSERT(layer->isComposited()); 1083 ASSERT(layer->compositedLayerMapping());
1085 1084
1086 GraphicsLayer* hostingLayer = layer->compositedLayerMapping()->parentForSubl ayers(); 1085 GraphicsLayer* hostingLayer = layer->compositedLayerMapping()->parentForSubl ayers();
1087 hostingLayer->removeAllChildren(); 1086 hostingLayer->removeAllChildren();
1088 } 1087 }
1089 1088
1090 bool RenderLayerCompositor::canAccelerateVideoRendering(RenderVideo* o) const 1089 bool RenderLayerCompositor::canAccelerateVideoRendering(RenderVideo* o) const
1091 { 1090 {
1092 if (!m_hasAcceleratedCompositing) 1091 if (!m_hasAcceleratedCompositing)
1093 return false; 1092 return false;
1094 1093
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 return 0; 1362 return 0;
1364 } 1363 }
1365 1364
1366 bool RenderLayerCompositor::parentFrameContentLayers(RenderPart* renderer) 1365 bool RenderLayerCompositor::parentFrameContentLayers(RenderPart* renderer)
1367 { 1366 {
1368 RenderLayerCompositor* innerCompositor = frameContentsCompositor(renderer); 1367 RenderLayerCompositor* innerCompositor = frameContentsCompositor(renderer);
1369 if (!innerCompositor || !innerCompositor->inCompositingMode() || innerCompos itor->rootLayerAttachment() != RootLayerAttachedViaEnclosingFrame) 1368 if (!innerCompositor || !innerCompositor->inCompositingMode() || innerCompos itor->rootLayerAttachment() != RootLayerAttachedViaEnclosingFrame)
1370 return false; 1369 return false;
1371 1370
1372 RenderLayer* layer = renderer->layer(); 1371 RenderLayer* layer = renderer->layer();
1373 if (!layer->isComposited()) 1372 if (!layer->compositedLayerMapping())
1374 return false; 1373 return false;
1375 1374
1376 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi ng(); 1375 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi ng();
1377 GraphicsLayer* hostingLayer = compositedLayerMapping->parentForSublayers(); 1376 GraphicsLayer* hostingLayer = compositedLayerMapping->parentForSublayers();
1378 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer(); 1377 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer();
1379 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r ootLayer) { 1378 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r ootLayer) {
1380 hostingLayer->removeAllChildren(); 1379 hostingLayer->removeAllChildren();
1381 hostingLayer->addChild(rootLayer); 1380 hostingLayer->addChild(rootLayer);
1382 } 1381 }
1383 return true; 1382 return true;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 1488
1490 1489
1491 void RenderLayerCompositor::repaintCompositedLayers(const IntRect* absRect) 1490 void RenderLayerCompositor::repaintCompositedLayers(const IntRect* absRect)
1492 { 1491 {
1493 recursiveRepaintLayer(rootRenderLayer(), absRect); 1492 recursiveRepaintLayer(rootRenderLayer(), absRect);
1494 } 1493 }
1495 1494
1496 void RenderLayerCompositor::recursiveRepaintLayer(RenderLayer* layer, const IntR ect* rect) 1495 void RenderLayerCompositor::recursiveRepaintLayer(RenderLayer* layer, const IntR ect* rect)
1497 { 1496 {
1498 // FIXME: This method does not work correctly with transforms. 1497 // FIXME: This method does not work correctly with transforms.
1499 if (layer->isComposited() && !layer->compositedLayerMapping()->paintsIntoCom positedAncestor()) { 1498 if (layer->compositingState() == PaintsIntoOwnBacking) {
1500 if (rect) 1499 if (rect)
1501 layer->setBackingNeedsRepaintInRect(*rect); 1500 layer->setBackingNeedsRepaintInRect(*rect);
1502 else 1501 else
1503 layer->setBackingNeedsRepaint(); 1502 layer->setBackingNeedsRepaint();
1504 } 1503 }
1505 1504
1506 #if !ASSERT_DISABLED 1505 #if !ASSERT_DISABLED
1507 LayerListMutationDetector mutationChecker(layer); 1506 LayerListMutationDetector mutationChecker(layer);
1508 #endif 1507 #endif
1509 1508
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 1581
1583 detachRootLayer(); 1582 detachRootLayer();
1584 } 1583 }
1585 } 1584 }
1586 1585
1587 void RenderLayerCompositor::clearMappingForRenderLayerIncludingDescendants(Rende rLayer* layer) 1586 void RenderLayerCompositor::clearMappingForRenderLayerIncludingDescendants(Rende rLayer* layer)
1588 { 1587 {
1589 if (!layer) 1588 if (!layer)
1590 return; 1589 return;
1591 1590
1592 if (layer->isComposited()) { 1591 if (layer->compositedLayerMapping()) {
1593 removeViewportConstrainedLayer(layer); 1592 removeViewportConstrainedLayer(layer);
1594 layer->clearCompositedLayerMapping(); 1593 layer->clearCompositedLayerMapping();
1595 } 1594 }
1596 1595
1597 for (RenderLayer* currLayer = layer->firstChild(); currLayer; currLayer = cu rrLayer->nextSibling()) 1596 for (RenderLayer* currLayer = layer->firstChild(); currLayer; currLayer = cu rrLayer->nextSibling())
1598 clearMappingForRenderLayerIncludingDescendants(currLayer); 1597 clearMappingForRenderLayerIncludingDescendants(currLayer);
1599 } 1598 }
1600 1599
1601 void RenderLayerCompositor::clearMappingForAllRenderLayers() 1600 void RenderLayerCompositor::clearMappingForAllRenderLayers()
1602 { 1601 {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 bool RenderLayerCompositor::canBeComposited(const RenderLayer* layer) const 1635 bool RenderLayerCompositor::canBeComposited(const RenderLayer* layer) const
1637 { 1636 {
1638 // FIXME: We disable accelerated compositing for elements in a RenderFlowThr ead as it doesn't work properly. 1637 // FIXME: We disable accelerated compositing for elements in a RenderFlowThr ead as it doesn't work properly.
1639 // See http://webkit.org/b/84900 to re-enable it. 1638 // See http://webkit.org/b/84900 to re-enable it.
1640 return m_hasAcceleratedCompositing && layer->isSelfPaintingLayer() && layer- >renderer()->flowThreadState() == RenderObject::NotInsideFlowThread; 1639 return m_hasAcceleratedCompositing && layer->isSelfPaintingLayer() && layer- >renderer()->flowThreadState() == RenderObject::NotInsideFlowThread;
1641 } 1640 }
1642 1641
1643 bool RenderLayerCompositor::requiresOwnBackingStore(const RenderLayer* layer, co nst RenderLayer* compositingAncestorLayer) const 1642 bool RenderLayerCompositor::requiresOwnBackingStore(const RenderLayer* layer, co nst RenderLayer* compositingAncestorLayer) const
1644 { 1643 {
1645 RenderObject* renderer = layer->renderer(); 1644 RenderObject* renderer = layer->renderer();
1645
1646 // A layer definitely needs its own backing if we cannot paint into the comp osited ancestor.
1646 if (compositingAncestorLayer 1647 if (compositingAncestorLayer
1647 && !(compositingAncestorLayer->compositedLayerMapping()->mainGraphicsLay er()->drawsContent() 1648 && !(compositingAncestorLayer->compositedLayerMapping()->mainGraphicsLay er()->drawsContent()
1648 || compositingAncestorLayer->compositedLayerMapping()->paintsIntoCom positedAncestor())) 1649 || compositingAncestorLayer->compositedLayerMapping()->paintsIntoCom positedAncestor()))
1649 return true; 1650 return true;
1650 1651
1651 if (layer->isRootLayer() 1652 if (layer->isRootLayer()
1652 || layer->transform() // note: excludes perspective and transformStyle3D . 1653 || layer->transform() // note: excludes perspective and transformStyle3D .
1653 || requiresCompositingForVideo(renderer) 1654 || requiresCompositingForVideo(renderer)
1654 || requiresCompositingForCanvas(renderer) 1655 || requiresCompositingForCanvas(renderer)
1655 || requiresCompositingForPlugin(renderer) 1656 || requiresCompositingForPlugin(renderer)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 if (requiresCompositingForOutOfFlowClipping(layer)) 1723 if (requiresCompositingForOutOfFlowClipping(layer))
1723 directReasons |= CompositingReasonOutOfFlowClipping; 1724 directReasons |= CompositingReasonOutOfFlowClipping;
1724 1725
1725 return directReasons; 1726 return directReasons;
1726 } 1727 }
1727 1728
1728 CompositingReasons RenderLayerCompositor::reasonsForCompositing(const RenderLaye r* layer) const 1729 CompositingReasons RenderLayerCompositor::reasonsForCompositing(const RenderLaye r* layer) const
1729 { 1730 {
1730 CompositingReasons reasons = CompositingReasonNone; 1731 CompositingReasons reasons = CompositingReasonNone;
1731 1732
1732 if (!layer || !layer->isComposited()) 1733 if (!layer || !layer->compositedLayerMapping())
1733 return reasons; 1734 return reasons;
1734 1735
1735 return layer->compositingReasons(); 1736 return layer->compositingReasons();
1736 } 1737 }
1737 1738
1738 #if !LOG_DISABLED 1739 #if !LOG_DISABLED
1739 const char* RenderLayerCompositor::logReasonsForCompositing(const RenderLayer* l ayer) 1740 const char* RenderLayerCompositor::logReasonsForCompositing(const RenderLayer* l ayer)
1740 { 1741 {
1741 CompositingReasons reasons = reasonsForCompositing(layer); 1742 CompositingReasons reasons = reasonsForCompositing(layer);
1742 1743
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1813 } 1814 }
1814 #endif 1815 #endif
1815 1816
1816 // Return true if the given layer has some ancestor in the RenderLayer hierarchy that clips, 1817 // Return true if the given layer has some ancestor in the RenderLayer hierarchy that clips,
1817 // up to the enclosing compositing ancestor. This is required because compositin g layers are parented 1818 // up to the enclosing compositing ancestor. This is required because compositin g layers are parented
1818 // according to the z-order hierarchy, yet clipping goes down the renderer hiera rchy. 1819 // according to the z-order hierarchy, yet clipping goes down the renderer hiera rchy.
1819 // Thus, a RenderLayer can be clipped by a RenderLayer that is an ancestor in th e renderer hierarchy, 1820 // Thus, a RenderLayer can be clipped by a RenderLayer that is an ancestor in th e renderer hierarchy,
1820 // but a sibling in the z-order hierarchy. 1821 // but a sibling in the z-order hierarchy.
1821 bool RenderLayerCompositor::clippedByAncestor(const RenderLayer* layer) const 1822 bool RenderLayerCompositor::clippedByAncestor(const RenderLayer* layer) const
1822 { 1823 {
1823 if (!layer->isComposited() || !layer->parent()) 1824 if (!layer->compositedLayerMapping() || !layer->parent())
1824 return false; 1825 return false;
1825 1826
1826 const RenderLayer* compositingAncestor = layer->ancestorCompositingLayer(); 1827 const RenderLayer* compositingAncestor = layer->ancestorCompositingLayer();
1827 if (!compositingAncestor) 1828 if (!compositingAncestor)
1828 return false; 1829 return false;
1829 1830
1830 // If the compositingAncestor clips, that will be taken care of by clipsComp ositingDescendants(), 1831 // If the compositingAncestor clips, that will be taken care of by clipsComp ositingDescendants(),
1831 // so we only care about clipping between its first child that is our ancest or (the computeClipRoot), 1832 // so we only care about clipping between its first child that is our ancest or (the computeClipRoot),
1832 // and layer. 1833 // and layer.
1833 const RenderLayer* computeClipRoot = 0; 1834 const RenderLayer* computeClipRoot = 0;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 1923
1923 bool composite = renderer->isEmbeddedObject() && toRenderEmbeddedObject(rend erer)->allowsAcceleratedCompositing(); 1924 bool composite = renderer->isEmbeddedObject() && toRenderEmbeddedObject(rend erer)->allowsAcceleratedCompositing();
1924 if (!composite) 1925 if (!composite)
1925 return false; 1926 return false;
1926 1927
1927 m_reevaluateCompositingAfterLayout = true; 1928 m_reevaluateCompositingAfterLayout = true;
1928 1929
1929 RenderWidget* pluginRenderer = toRenderWidget(renderer); 1930 RenderWidget* pluginRenderer = toRenderWidget(renderer);
1930 // If we can't reliably know the size of the plugin yet, don't change compos iting state. 1931 // If we can't reliably know the size of the plugin yet, don't change compos iting state.
1931 if (pluginRenderer->needsLayout()) 1932 if (pluginRenderer->needsLayout())
1932 return pluginRenderer->hasLayer() && pluginRenderer->layer()->isComposit ed(); 1933 return pluginRenderer->hasLayer() && pluginRenderer->layer()->composited LayerMapping();
1933 1934
1934 // Don't go into compositing mode if height or width are zero, or size is 1x 1. 1935 // Don't go into compositing mode if height or width are zero, or size is 1x 1.
1935 IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect()); 1936 IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect());
1936 return contentBox.height() * contentBox.width() > 1; 1937 return contentBox.height() * contentBox.width() > 1;
1937 } 1938 }
1938 1939
1939 bool RenderLayerCompositor::requiresCompositingForFrame(RenderObject* renderer) const 1940 bool RenderLayerCompositor::requiresCompositingForFrame(RenderObject* renderer) const
1940 { 1941 {
1941 if (!renderer->isRenderPart()) 1942 if (!renderer->isRenderPart())
1942 return false; 1943 return false;
1943 1944
1944 RenderPart* frameRenderer = toRenderPart(renderer); 1945 RenderPart* frameRenderer = toRenderPart(renderer);
1945 1946
1946 if (!frameRenderer->requiresAcceleratedCompositing()) 1947 if (!frameRenderer->requiresAcceleratedCompositing())
1947 return false; 1948 return false;
1948 1949
1949 m_reevaluateCompositingAfterLayout = true; 1950 m_reevaluateCompositingAfterLayout = true;
1950 1951
1951 RenderLayerCompositor* innerCompositor = frameContentsCompositor(frameRender er); 1952 RenderLayerCompositor* innerCompositor = frameContentsCompositor(frameRender er);
1952 if (!innerCompositor) 1953 if (!innerCompositor)
1953 return false; 1954 return false;
1954 1955
1955 // If we can't reliably know the size of the iframe yet, don't change compos iting state. 1956 // If we can't reliably know the size of the iframe yet, don't change compos iting state.
1956 if (renderer->needsLayout()) 1957 if (renderer->needsLayout())
1957 return frameRenderer->hasLayer() && frameRenderer->layer()->isComposited (); 1958 return frameRenderer->hasLayer() && frameRenderer->layer()->compositedLa yerMapping();
1958 1959
1959 // Don't go into compositing mode if height or width are zero. 1960 // Don't go into compositing mode if height or width are zero.
1960 IntRect contentBox = pixelSnappedIntRect(frameRenderer->contentBoxRect()); 1961 IntRect contentBox = pixelSnappedIntRect(frameRenderer->contentBoxRect());
1961 return contentBox.height() * contentBox.width() > 0; 1962 return contentBox.height() * contentBox.width() > 0;
1962 } 1963 }
1963 1964
1964 bool RenderLayerCompositor::requiresCompositingForBackfaceVisibilityHidden(Rende rObject* renderer) const 1965 bool RenderLayerCompositor::requiresCompositingForBackfaceVisibilityHidden(Rende rObject* renderer) const
1965 { 1966 {
1966 return canRender3DTransforms() && renderer->style()->backfaceVisibility() == BackfaceVisibilityHidden; 1967 return canRender3DTransforms() && renderer->style()->backfaceVisibility() == BackfaceVisibilityHidden;
1967 } 1968 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 2118
2118 if (!hasScrollableAncestor) { 2119 if (!hasScrollableAncestor) {
2119 if (viewportConstrainedNotCompositedReason) 2120 if (viewportConstrainedNotCompositedReason)
2120 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForUnscrollableAncestors; 2121 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForUnscrollableAncestors;
2121 return false; 2122 return false;
2122 } 2123 }
2123 2124
2124 // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done. 2125 // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done.
2125 if (!m_inPostLayoutUpdate) { 2126 if (!m_inPostLayoutUpdate) {
2126 m_reevaluateCompositingAfterLayout = true; 2127 m_reevaluateCompositingAfterLayout = true;
2127 return layer->isComposited(); 2128 return layer->compositedLayerMapping();
2128 } 2129 }
2129 2130
2130 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend ant(); 2131 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend ant();
2131 if (!paintsContent) { 2132 if (!paintsContent) {
2132 if (viewportConstrainedNotCompositedReason) 2133 if (viewportConstrainedNotCompositedReason)
2133 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNoVisibleContent; 2134 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited ForNoVisibleContent;
2134 return false; 2135 return false;
2135 } 2136 }
2136 2137
2137 // Fixed position elements that are invisible in the current view don't get their own layer. 2138 // Fixed position elements that are invisible in the current view don't get their own layer.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
2228 return supportsFixedRootBackgroundCompositing() && m_renderView->rootBackgro undIsEntirelyFixed(); 2229 return supportsFixedRootBackgroundCompositing() && m_renderView->rootBackgro undIsEntirelyFixed();
2229 } 2230 }
2230 2231
2231 GraphicsLayer* RenderLayerCompositor::fixedRootBackgroundLayer() const 2232 GraphicsLayer* RenderLayerCompositor::fixedRootBackgroundLayer() const
2232 { 2233 {
2233 // Get the fixed root background from the RenderView layer's compositedLayer Mapping. 2234 // Get the fixed root background from the RenderView layer's compositedLayer Mapping.
2234 RenderLayer* viewLayer = m_renderView->layer(); 2235 RenderLayer* viewLayer = m_renderView->layer();
2235 if (!viewLayer) 2236 if (!viewLayer)
2236 return 0; 2237 return 0;
2237 2238
2238 if (viewLayer->isComposited() && viewLayer->compositedLayerMapping()->backgr oundLayerPaintsFixedRootBackground()) 2239 if (viewLayer->compositingState() == PaintsIntoOwnBacking && viewLayer->comp ositedLayerMapping()->backgroundLayerPaintsFixedRootBackground())
2239 return viewLayer->compositedLayerMapping()->backgroundLayer(); 2240 return viewLayer->compositedLayerMapping()->backgroundLayer();
2240 2241
2241 return 0; 2242 return 0;
2242 } 2243 }
2243 2244
2244 static void resetTrackedRepaintRectsRecursive(GraphicsLayer* graphicsLayer) 2245 static void resetTrackedRepaintRectsRecursive(GraphicsLayer* graphicsLayer)
2245 { 2246 {
2246 if (!graphicsLayer) 2247 if (!graphicsLayer)
2247 return; 2248 return;
2248 2249
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
2645 2646
2646 static bool isRootmostFixedOrStickyLayer(RenderLayer* layer) 2647 static bool isRootmostFixedOrStickyLayer(RenderLayer* layer)
2647 { 2648 {
2648 if (layer->renderer()->isStickyPositioned()) 2649 if (layer->renderer()->isStickyPositioned())
2649 return true; 2650 return true;
2650 2651
2651 if (layer->renderer()->style()->position() != FixedPosition) 2652 if (layer->renderer()->style()->position() != FixedPosition)
2652 return false; 2653 return false;
2653 2654
2654 for (RenderLayer* stackingContainer = layer->ancestorStackingContainer(); st ackingContainer; stackingContainer = stackingContainer->ancestorStackingContaine r()) { 2655 for (RenderLayer* stackingContainer = layer->ancestorStackingContainer(); st ackingContainer; stackingContainer = stackingContainer->ancestorStackingContaine r()) {
2655 if (stackingContainer->isComposited() && stackingContainer->renderer()-> style()->position() == FixedPosition) 2656 if (stackingContainer->compositedLayerMapping() && stackingContainer->re nderer()->style()->position() == FixedPosition)
2656 return false; 2657 return false;
2657 } 2658 }
2658 2659
2659 return true; 2660 return true;
2660 } 2661 }
2661 2662
2662 void RenderLayerCompositor::updateViewportConstraintStatus(RenderLayer* layer) 2663 void RenderLayerCompositor::updateViewportConstraintStatus(RenderLayer* layer)
2663 { 2664 {
2664 if (isRootmostFixedOrStickyLayer(layer)) 2665 if (isRootmostFixedOrStickyLayer(layer))
2665 addViewportConstrainedLayer(layer); 2666 addViewportConstrainedLayer(layer);
2666 else 2667 else
2667 removeViewportConstrainedLayer(layer); 2668 removeViewportConstrainedLayer(layer);
2668 } 2669 }
2669 2670
2670 void RenderLayerCompositor::addViewportConstrainedLayer(RenderLayer* layer) 2671 void RenderLayerCompositor::addViewportConstrainedLayer(RenderLayer* layer)
2671 { 2672 {
2672 m_viewportConstrainedLayers.add(layer); 2673 m_viewportConstrainedLayers.add(layer);
2673 } 2674 }
2674 2675
2675 void RenderLayerCompositor::removeViewportConstrainedLayer(RenderLayer* layer) 2676 void RenderLayerCompositor::removeViewportConstrainedLayer(RenderLayer* layer)
2676 { 2677 {
2677 if (!m_viewportConstrainedLayers.contains(layer)) 2678 if (!m_viewportConstrainedLayers.contains(layer))
2678 return; 2679 return;
2679 2680
2680 m_viewportConstrainedLayers.remove(layer); 2681 m_viewportConstrainedLayers.remove(layer);
2681 } 2682 }
2682 2683
2683 FixedPositionViewportConstraints RenderLayerCompositor::computeFixedViewportCons traints(RenderLayer* layer) const 2684 FixedPositionViewportConstraints RenderLayerCompositor::computeFixedViewportCons traints(RenderLayer* layer) const
2684 { 2685 {
2685 ASSERT(layer->isComposited()); 2686 ASSERT(layer->compositedLayerMapping());
2686 2687
2687 FrameView* frameView = m_renderView->frameView(); 2688 FrameView* frameView = m_renderView->frameView();
2688 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect() ; 2689 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect() ;
2689 2690
2690 FixedPositionViewportConstraints constraints; 2691 FixedPositionViewportConstraints constraints;
2691 2692
2692 GraphicsLayer* graphicsLayer = layer->compositedLayerMapping()->mainGraphics Layer(); 2693 GraphicsLayer* graphicsLayer = layer->compositedLayerMapping()->mainGraphics Layer();
2693 2694
2694 constraints.setLayerPositionAtLastLayout(graphicsLayer->position()); 2695 constraints.setLayerPositionAtLastLayout(graphicsLayer->position());
2695 constraints.setViewportRectAtLastLayout(viewportRect); 2696 constraints.setViewportRectAtLastLayout(viewportRect);
(...skipping 17 matching lines...) Expand all
2713 2714
2714 // If top and bottom are auto, use top. 2715 // If top and bottom are auto, use top.
2715 if (style->top().isAuto() && style->bottom().isAuto()) 2716 if (style->top().isAuto() && style->bottom().isAuto())
2716 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeTop); 2717 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeTop);
2717 2718
2718 return constraints; 2719 return constraints;
2719 } 2720 }
2720 2721
2721 StickyPositionViewportConstraints RenderLayerCompositor::computeStickyViewportCo nstraints(RenderLayer* layer) const 2722 StickyPositionViewportConstraints RenderLayerCompositor::computeStickyViewportCo nstraints(RenderLayer* layer) const
2722 { 2723 {
2723 ASSERT(layer->isComposited()); 2724 ASSERT(layer->compositedLayerMapping());
2724 2725
2725 FrameView* frameView = m_renderView->frameView(); 2726 FrameView* frameView = m_renderView->frameView();
2726 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect() ; 2727 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect() ;
2727 2728
2728 StickyPositionViewportConstraints constraints; 2729 StickyPositionViewportConstraints constraints;
2729 2730
2730 RenderBoxModelObject* renderer = toRenderBoxModelObject(layer->renderer()); 2731 RenderBoxModelObject* renderer = toRenderBoxModelObject(layer->renderer());
2731 2732
2732 renderer->computeStickyPositionConstraints(constraints, viewportRect); 2733 renderer->computeStickyPositionConstraints(constraints, viewportRect);
2733 2734
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2783 } else if (graphicsLayer == m_scrollLayer.get()) { 2784 } else if (graphicsLayer == m_scrollLayer.get()) {
2784 name = "Frame Scrolling Layer"; 2785 name = "Frame Scrolling Layer";
2785 } else { 2786 } else {
2786 ASSERT_NOT_REACHED(); 2787 ASSERT_NOT_REACHED();
2787 } 2788 }
2788 2789
2789 return name; 2790 return name;
2790 } 2791 }
2791 2792
2792 } // namespace WebCore 2793 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayer.cpp ('k') | Source/core/rendering/RenderLayerRepainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698