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