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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) | 636 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) |
637 scrollingCoordinator->frameViewFixedObjectsDidChange(m_renderVie
w->frameView()); | 637 scrollingCoordinator->frameViewFixedObjectsDidChange(m_renderVie
w->frameView()); |
638 } | 638 } |
639 } | 639 } |
640 | 640 |
641 return layerChanged; | 641 return layerChanged; |
642 } | 642 } |
643 | 643 |
644 bool RenderLayerCompositor::updateLayerCompositingState(RenderLayer* layer, Comp
ositingChangeRepaint shouldRepaint) | 644 bool RenderLayerCompositor::updateLayerCompositingState(RenderLayer* layer, Comp
ositingChangeRepaint shouldRepaint) |
645 { | 645 { |
| 646 CompositingState stateBeforeUpdating = layer->compositingState(); |
646 bool layerChanged = allocateOrClearCompositedLayerMapping(layer, shouldRepai
nt); | 647 bool layerChanged = allocateOrClearCompositedLayerMapping(layer, shouldRepai
nt); |
647 | 648 |
648 // See if we need content or clipping layers. Methods called here should ass
ume | 649 // See if we need content or clipping layers. Methods called here should ass
ume |
649 // that the compositing state of descendant layers has not been updated yet. | 650 // that the compositing state of descendant layers has not been updated yet. |
650 if (layer->compositedLayerMapping() && layer->compositedLayerMapping()->upda
teGraphicsLayerConfiguration()) | 651 if (layer->compositedLayerMapping() && layer->compositedLayerMapping()->upda
teGraphicsLayerConfiguration()) |
651 layerChanged = true; | 652 layerChanged = true; |
652 | 653 |
653 return layerChanged; | 654 // While this code is gradually evolving, this sanity check will help. |
| 655 CompositingState stateAfterUpdating = layer->compositingState(); |
| 656 bool compositingStateChanged = (stateBeforeUpdating != stateAfterUpdating); |
| 657 ASSERT(layerChanged == compositingStateChanged); |
| 658 |
| 659 // Return true for either condition to avoid bugs in production code. |
| 660 return layerChanged || compositingStateChanged; |
654 } | 661 } |
655 | 662 |
656 void RenderLayerCompositor::repaintOnCompositingChange(RenderLayer* layer) | 663 void RenderLayerCompositor::repaintOnCompositingChange(RenderLayer* layer) |
657 { | 664 { |
658 // If the renderer is not attached yet, no need to repaint. | 665 // If the renderer is not attached yet, no need to repaint. |
659 if (layer->renderer() != m_renderView && !layer->renderer()->parent()) | 666 if (layer->renderer() != m_renderView && !layer->renderer()->parent()) |
660 return; | 667 return; |
661 | 668 |
662 RenderLayerModelObject* repaintContainer = layer->renderer()->containerForRe
paint(); | 669 RenderLayerModelObject* repaintContainer = layer->renderer()->containerForRe
paint(); |
663 if (!repaintContainer) | 670 if (!repaintContainer) |
664 repaintContainer = m_renderView; | 671 repaintContainer = m_renderView; |
665 | 672 |
666 layer->repainter().repaintIncludingNonCompositingDescendants(repaintContaine
r); | 673 layer->repainter().repaintIncludingNonCompositingDescendants(repaintContaine
r); |
667 } | 674 } |
668 | 675 |
669 // This method assumes that layout is up-to-date, unlike repaintOnCompositingCha
nge(). | 676 // This method assumes that layout is up-to-date, unlike repaintOnCompositingCha
nge(). |
670 void RenderLayerCompositor::repaintInCompositedAncestor(RenderLayer* layer, cons
t LayoutRect& rect) | 677 void RenderLayerCompositor::repaintInCompositedAncestor(RenderLayer* layer, cons
t LayoutRect& rect) |
671 { | 678 { |
672 RenderLayer* compositedAncestor = layer->enclosingCompositingLayerForRepaint
(false /*exclude self*/); | 679 RenderLayer* compositedAncestor = layer->enclosingCompositingLayerForRepaint
(false /*exclude self*/); |
673 if (compositedAncestor) { | 680 if (compositedAncestor) { |
674 ASSERT(compositedAncestor->compositedLayerMapping()); | 681 ASSERT(compositedAncestor->compositingState() == PaintsIntoOwnBacking); |
675 | 682 |
676 LayoutPoint offset; | 683 LayoutPoint offset; |
677 layer->convertToLayerCoords(compositedAncestor, offset); | 684 layer->convertToLayerCoords(compositedAncestor, offset); |
678 | 685 |
679 LayoutRect repaintRect = rect; | 686 LayoutRect repaintRect = rect; |
680 repaintRect.moveBy(offset); | 687 repaintRect.moveBy(offset); |
681 | 688 |
682 compositedAncestor->setBackingNeedsRepaintInRect(repaintRect); | 689 compositedAncestor->setBackingNeedsRepaintInRect(repaintRect); |
683 } | 690 } |
684 } | 691 } |
(...skipping 14 matching lines...) Expand all Loading... |
699 return layer->calculateLayerBounds(ancestorLayer, 0, flags); | 706 return layer->calculateLayerBounds(ancestorLayer, 0, flags); |
700 } | 707 } |
701 | 708 |
702 void RenderLayerCompositor::layerWasAdded(RenderLayer* /*parent*/, RenderLayer*
/*child*/) | 709 void RenderLayerCompositor::layerWasAdded(RenderLayer* /*parent*/, RenderLayer*
/*child*/) |
703 { | 710 { |
704 setCompositingLayersNeedRebuild(); | 711 setCompositingLayersNeedRebuild(); |
705 } | 712 } |
706 | 713 |
707 void RenderLayerCompositor::layerWillBeRemoved(RenderLayer* parent, RenderLayer*
child) | 714 void RenderLayerCompositor::layerWillBeRemoved(RenderLayer* parent, RenderLayer*
child) |
708 { | 715 { |
709 if (!child->isComposited() || parent->renderer()->documentBeingDestroyed()) | 716 if (!child->compositedLayerMapping() || parent->renderer()->documentBeingDes
troyed()) |
710 return; | 717 return; |
711 | 718 |
712 removeViewportConstrainedLayer(child); | 719 removeViewportConstrainedLayer(child); |
713 repaintInCompositedAncestor(child, child->compositedLayerMapping()->composit
edBounds()); | 720 repaintInCompositedAncestor(child, child->compositedLayerMapping()->composit
edBounds()); |
714 | 721 |
715 setCompositingParent(child, 0); | 722 setCompositingParent(child, 0); |
716 setCompositingLayersNeedRebuild(); | 723 setCompositingLayersNeedRebuild(); |
717 } | 724 } |
718 | 725 |
719 RenderLayer* RenderLayerCompositor::enclosingNonStackingClippingLayer(const Rend
erLayer* layer) const | 726 RenderLayer* RenderLayerCompositor::enclosingNonStackingClippingLayer(const Rend
erLayer* layer) const |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 layer->reflectionLayer()->setCompositingReasons(layer->reflectionLayer()
->compositingReasons() | reflectionCompositingReason); | 1021 layer->reflectionLayer()->setCompositingReasons(layer->reflectionLayer()
->compositingReasons() | reflectionCompositingReason); |
1015 } | 1022 } |
1016 | 1023 |
1017 // Subsequent layers in the parent's stacking context may also need to compo
site. | 1024 // Subsequent layers in the parent's stacking context may also need to compo
site. |
1018 if (childRecursionData.m_subtreeIsCompositing) | 1025 if (childRecursionData.m_subtreeIsCompositing) |
1019 currentRecursionData.m_subtreeIsCompositing = true; | 1026 currentRecursionData.m_subtreeIsCompositing = true; |
1020 | 1027 |
1021 // Set the flag to say that this SC has compositing children. | 1028 // Set the flag to say that this SC has compositing children. |
1022 layer->setHasCompositingDescendant(childRecursionData.m_subtreeIsCompositing
); | 1029 layer->setHasCompositingDescendant(childRecursionData.m_subtreeIsCompositing
); |
1023 | 1030 |
1024 | |
1025 // Turn overlap testing off for later layers if it's already off, or if we h
ave an animating transform. | 1031 // 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 | 1032 // 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. | 1033 // 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); | 1034 bool isCompositedClippingLayer = canBeComposited(layer) && (reasonsToComposi
te & CompositingReasonClipsCompositingDescendants); |
1029 if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) ||
isRunningAcceleratedTransformAnimation(layer->renderer())) | 1035 if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) ||
isRunningAcceleratedTransformAnimation(layer->renderer())) |
1030 currentRecursionData.m_testingOverlap = false; | 1036 currentRecursionData.m_testingOverlap = false; |
1031 | 1037 |
1032 if (overlapMap && childRecursionData.m_compositingAncestor == layer && !laye
r->isRootLayer()) | 1038 if (overlapMap && childRecursionData.m_compositingAncestor == layer && !laye
r->isRootLayer()) |
1033 overlapMap->finishCurrentOverlapTestingContext(); | 1039 overlapMap->finishCurrentOverlapTestingContext(); |
1034 | 1040 |
(...skipping 19 matching lines...) Expand all Loading... |
1054 | 1060 |
1055 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTrans
form(); | 1061 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTrans
form(); |
1056 | 1062 |
1057 if (overlapMap) | 1063 if (overlapMap) |
1058 overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer); | 1064 overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer); |
1059 } | 1065 } |
1060 | 1066 |
1061 void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, Render
Layer* parentLayer) | 1067 void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, Render
Layer* parentLayer) |
1062 { | 1068 { |
1063 ASSERT(!parentLayer || childLayer->ancestorCompositingLayer() == parentLayer
); | 1069 ASSERT(!parentLayer || childLayer->ancestorCompositingLayer() == parentLayer
); |
1064 ASSERT(childLayer->isComposited()); | 1070 ASSERT(childLayer->compositedLayerMapping()); |
1065 | 1071 |
1066 // It's possible to be called with a parent that isn't yet composited when w
e're doing | 1072 // 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; | 1073 // partial updates as required by painting or hit testing. Just bail in that
case; |
1068 // we'll do a full layer update soon. | 1074 // we'll do a full layer update soon. |
1069 if (!parentLayer || !parentLayer->isComposited()) | 1075 if (!parentLayer || !parentLayer->compositedLayerMapping()) |
1070 return; | 1076 return; |
1071 | 1077 |
1072 if (parentLayer) { | 1078 if (parentLayer) { |
1073 GraphicsLayer* hostingLayer = parentLayer->compositedLayerMapping()->par
entForSublayers(); | 1079 GraphicsLayer* hostingLayer = parentLayer->compositedLayerMapping()->par
entForSublayers(); |
1074 GraphicsLayer* hostedLayer = childLayer->compositedLayerMapping()->child
ForSuperlayers(); | 1080 GraphicsLayer* hostedLayer = childLayer->compositedLayerMapping()->child
ForSuperlayers(); |
1075 | 1081 |
1076 hostingLayer->addChild(hostedLayer); | 1082 hostingLayer->addChild(hostedLayer); |
1077 } else { | 1083 } else { |
1078 childLayer->compositedLayerMapping()->childForSuperlayers()->removeFromP
arent(); | 1084 childLayer->compositedLayerMapping()->childForSuperlayers()->removeFromP
arent(); |
1079 } | 1085 } |
1080 } | 1086 } |
1081 | 1087 |
1082 void RenderLayerCompositor::removeCompositedChildren(RenderLayer* layer) | 1088 void RenderLayerCompositor::removeCompositedChildren(RenderLayer* layer) |
1083 { | 1089 { |
1084 ASSERT(layer->isComposited()); | 1090 ASSERT(layer->compositedLayerMapping()); |
1085 | 1091 |
1086 GraphicsLayer* hostingLayer = layer->compositedLayerMapping()->parentForSubl
ayers(); | 1092 GraphicsLayer* hostingLayer = layer->compositedLayerMapping()->parentForSubl
ayers(); |
1087 hostingLayer->removeAllChildren(); | 1093 hostingLayer->removeAllChildren(); |
1088 } | 1094 } |
1089 | 1095 |
1090 bool RenderLayerCompositor::canAccelerateVideoRendering(RenderVideo* o) const | 1096 bool RenderLayerCompositor::canAccelerateVideoRendering(RenderVideo* o) const |
1091 { | 1097 { |
1092 if (!m_hasAcceleratedCompositing) | 1098 if (!m_hasAcceleratedCompositing) |
1093 return false; | 1099 return false; |
1094 | 1100 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 return 0; | 1369 return 0; |
1364 } | 1370 } |
1365 | 1371 |
1366 bool RenderLayerCompositor::parentFrameContentLayers(RenderPart* renderer) | 1372 bool RenderLayerCompositor::parentFrameContentLayers(RenderPart* renderer) |
1367 { | 1373 { |
1368 RenderLayerCompositor* innerCompositor = frameContentsCompositor(renderer); | 1374 RenderLayerCompositor* innerCompositor = frameContentsCompositor(renderer); |
1369 if (!innerCompositor || !innerCompositor->inCompositingMode() || innerCompos
itor->rootLayerAttachment() != RootLayerAttachedViaEnclosingFrame) | 1375 if (!innerCompositor || !innerCompositor->inCompositingMode() || innerCompos
itor->rootLayerAttachment() != RootLayerAttachedViaEnclosingFrame) |
1370 return false; | 1376 return false; |
1371 | 1377 |
1372 RenderLayer* layer = renderer->layer(); | 1378 RenderLayer* layer = renderer->layer(); |
1373 if (!layer->isComposited()) | 1379 if (!layer->compositedLayerMapping()) |
1374 return false; | 1380 return false; |
1375 | 1381 |
1376 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); | 1382 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); |
1377 GraphicsLayer* hostingLayer = compositedLayerMapping->parentForSublayers(); | 1383 GraphicsLayer* hostingLayer = compositedLayerMapping->parentForSublayers(); |
1378 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer(); | 1384 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer(); |
1379 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r
ootLayer) { | 1385 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r
ootLayer) { |
1380 hostingLayer->removeAllChildren(); | 1386 hostingLayer->removeAllChildren(); |
1381 hostingLayer->addChild(rootLayer); | 1387 hostingLayer->addChild(rootLayer); |
1382 } | 1388 } |
1383 return true; | 1389 return true; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1489 | 1495 |
1490 | 1496 |
1491 void RenderLayerCompositor::repaintCompositedLayers(const IntRect* absRect) | 1497 void RenderLayerCompositor::repaintCompositedLayers(const IntRect* absRect) |
1492 { | 1498 { |
1493 recursiveRepaintLayer(rootRenderLayer(), absRect); | 1499 recursiveRepaintLayer(rootRenderLayer(), absRect); |
1494 } | 1500 } |
1495 | 1501 |
1496 void RenderLayerCompositor::recursiveRepaintLayer(RenderLayer* layer, const IntR
ect* rect) | 1502 void RenderLayerCompositor::recursiveRepaintLayer(RenderLayer* layer, const IntR
ect* rect) |
1497 { | 1503 { |
1498 // FIXME: This method does not work correctly with transforms. | 1504 // FIXME: This method does not work correctly with transforms. |
1499 if (layer->isComposited() && !layer->compositedLayerMapping()->paintsIntoCom
positedAncestor()) { | 1505 if (layer->compositingState() == PaintsIntoOwnBacking) { |
1500 if (rect) | 1506 if (rect) |
1501 layer->setBackingNeedsRepaintInRect(*rect); | 1507 layer->setBackingNeedsRepaintInRect(*rect); |
1502 else | 1508 else |
1503 layer->setBackingNeedsRepaint(); | 1509 layer->setBackingNeedsRepaint(); |
1504 } | 1510 } |
1505 | 1511 |
1506 #if !ASSERT_DISABLED | 1512 #if !ASSERT_DISABLED |
1507 LayerListMutationDetector mutationChecker(layer); | 1513 LayerListMutationDetector mutationChecker(layer); |
1508 #endif | 1514 #endif |
1509 | 1515 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 | 1588 |
1583 detachRootLayer(); | 1589 detachRootLayer(); |
1584 } | 1590 } |
1585 } | 1591 } |
1586 | 1592 |
1587 void RenderLayerCompositor::clearMappingForRenderLayerIncludingDescendants(Rende
rLayer* layer) | 1593 void RenderLayerCompositor::clearMappingForRenderLayerIncludingDescendants(Rende
rLayer* layer) |
1588 { | 1594 { |
1589 if (!layer) | 1595 if (!layer) |
1590 return; | 1596 return; |
1591 | 1597 |
1592 if (layer->isComposited()) { | 1598 if (layer->compositedLayerMapping()) { |
1593 removeViewportConstrainedLayer(layer); | 1599 removeViewportConstrainedLayer(layer); |
1594 layer->clearCompositedLayerMapping(); | 1600 layer->clearCompositedLayerMapping(); |
1595 } | 1601 } |
1596 | 1602 |
1597 for (RenderLayer* currLayer = layer->firstChild(); currLayer; currLayer = cu
rrLayer->nextSibling()) | 1603 for (RenderLayer* currLayer = layer->firstChild(); currLayer; currLayer = cu
rrLayer->nextSibling()) |
1598 clearMappingForRenderLayerIncludingDescendants(currLayer); | 1604 clearMappingForRenderLayerIncludingDescendants(currLayer); |
1599 } | 1605 } |
1600 | 1606 |
1601 void RenderLayerCompositor::clearMappingForAllRenderLayers() | 1607 void RenderLayerCompositor::clearMappingForAllRenderLayers() |
1602 { | 1608 { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 bool RenderLayerCompositor::canBeComposited(const RenderLayer* layer) const | 1642 bool RenderLayerCompositor::canBeComposited(const RenderLayer* layer) const |
1637 { | 1643 { |
1638 // FIXME: We disable accelerated compositing for elements in a RenderFlowThr
ead as it doesn't work properly. | 1644 // 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. | 1645 // See http://webkit.org/b/84900 to re-enable it. |
1640 return m_hasAcceleratedCompositing && layer->isSelfPaintingLayer() && layer-
>renderer()->flowThreadState() == RenderObject::NotInsideFlowThread; | 1646 return m_hasAcceleratedCompositing && layer->isSelfPaintingLayer() && layer-
>renderer()->flowThreadState() == RenderObject::NotInsideFlowThread; |
1641 } | 1647 } |
1642 | 1648 |
1643 bool RenderLayerCompositor::requiresOwnBackingStore(const RenderLayer* layer, co
nst RenderLayer* compositingAncestorLayer) const | 1649 bool RenderLayerCompositor::requiresOwnBackingStore(const RenderLayer* layer, co
nst RenderLayer* compositingAncestorLayer) const |
1644 { | 1650 { |
1645 RenderObject* renderer = layer->renderer(); | 1651 RenderObject* renderer = layer->renderer(); |
| 1652 |
| 1653 // A layer definitely needs its own backing if we cannot paint into the comp
osited ancestor. |
1646 if (compositingAncestorLayer | 1654 if (compositingAncestorLayer |
1647 && !(compositingAncestorLayer->compositedLayerMapping()->mainGraphicsLay
er()->drawsContent() | 1655 && !(compositingAncestorLayer->compositedLayerMapping()->mainGraphicsLay
er()->drawsContent() |
1648 || compositingAncestorLayer->compositedLayerMapping()->paintsIntoCom
positedAncestor())) | 1656 || compositingAncestorLayer->compositedLayerMapping()->paintsIntoCom
positedAncestor())) |
1649 return true; | 1657 return true; |
1650 | 1658 |
1651 if (layer->isRootLayer() | 1659 if (layer->isRootLayer() |
1652 || layer->transform() // note: excludes perspective and transformStyle3D
. | 1660 || layer->transform() // note: excludes perspective and transformStyle3D
. |
1653 || requiresCompositingForVideo(renderer) | 1661 || requiresCompositingForVideo(renderer) |
1654 || requiresCompositingForCanvas(renderer) | 1662 || requiresCompositingForCanvas(renderer) |
1655 || requiresCompositingForPlugin(renderer) | 1663 || requiresCompositingForPlugin(renderer) |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 if (requiresCompositingForOutOfFlowClipping(layer)) | 1734 if (requiresCompositingForOutOfFlowClipping(layer)) |
1727 directReasons |= CompositingReasonOutOfFlowClipping; | 1735 directReasons |= CompositingReasonOutOfFlowClipping; |
1728 | 1736 |
1729 return directReasons; | 1737 return directReasons; |
1730 } | 1738 } |
1731 | 1739 |
1732 CompositingReasons RenderLayerCompositor::reasonsForCompositing(const RenderLaye
r* layer) const | 1740 CompositingReasons RenderLayerCompositor::reasonsForCompositing(const RenderLaye
r* layer) const |
1733 { | 1741 { |
1734 CompositingReasons reasons = CompositingReasonNone; | 1742 CompositingReasons reasons = CompositingReasonNone; |
1735 | 1743 |
1736 if (!layer || !layer->isComposited()) | 1744 if (!layer || !layer->compositedLayerMapping()) |
1737 return reasons; | 1745 return reasons; |
1738 | 1746 |
1739 return layer->compositingReasons(); | 1747 return layer->compositingReasons(); |
1740 } | 1748 } |
1741 | 1749 |
1742 #if !LOG_DISABLED | 1750 #if !LOG_DISABLED |
1743 const char* RenderLayerCompositor::logReasonsForCompositing(const RenderLayer* l
ayer) | 1751 const char* RenderLayerCompositor::logReasonsForCompositing(const RenderLayer* l
ayer) |
1744 { | 1752 { |
1745 CompositingReasons reasons = reasonsForCompositing(layer); | 1753 CompositingReasons reasons = reasonsForCompositing(layer); |
1746 | 1754 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1817 } | 1825 } |
1818 #endif | 1826 #endif |
1819 | 1827 |
1820 // Return true if the given layer has some ancestor in the RenderLayer hierarchy
that clips, | 1828 // Return true if the given layer has some ancestor in the RenderLayer hierarchy
that clips, |
1821 // up to the enclosing compositing ancestor. This is required because compositin
g layers are parented | 1829 // up to the enclosing compositing ancestor. This is required because compositin
g layers are parented |
1822 // according to the z-order hierarchy, yet clipping goes down the renderer hiera
rchy. | 1830 // according to the z-order hierarchy, yet clipping goes down the renderer hiera
rchy. |
1823 // Thus, a RenderLayer can be clipped by a RenderLayer that is an ancestor in th
e renderer hierarchy, | 1831 // Thus, a RenderLayer can be clipped by a RenderLayer that is an ancestor in th
e renderer hierarchy, |
1824 // but a sibling in the z-order hierarchy. | 1832 // but a sibling in the z-order hierarchy. |
1825 bool RenderLayerCompositor::clippedByAncestor(const RenderLayer* layer) const | 1833 bool RenderLayerCompositor::clippedByAncestor(const RenderLayer* layer) const |
1826 { | 1834 { |
1827 if (!layer->isComposited() || !layer->parent()) | 1835 if (!layer->compositedLayerMapping() || !layer->parent()) |
1828 return false; | 1836 return false; |
1829 | 1837 |
1830 const RenderLayer* compositingAncestor = layer->ancestorCompositingLayer(); | 1838 const RenderLayer* compositingAncestor = layer->ancestorCompositingLayer(); |
1831 if (!compositingAncestor) | 1839 if (!compositingAncestor) |
1832 return false; | 1840 return false; |
1833 | 1841 |
1834 // If the compositingAncestor clips, that will be taken care of by clipsComp
ositingDescendants(), | 1842 // If the compositingAncestor clips, that will be taken care of by clipsComp
ositingDescendants(), |
1835 // so we only care about clipping between its first child that is our ancest
or (the computeClipRoot), | 1843 // so we only care about clipping between its first child that is our ancest
or (the computeClipRoot), |
1836 // and layer. | 1844 // and layer. |
1837 const RenderLayer* computeClipRoot = 0; | 1845 const RenderLayer* computeClipRoot = 0; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1926 | 1934 |
1927 bool composite = renderer->isEmbeddedObject() && toRenderEmbeddedObject(rend
erer)->allowsAcceleratedCompositing(); | 1935 bool composite = renderer->isEmbeddedObject() && toRenderEmbeddedObject(rend
erer)->allowsAcceleratedCompositing(); |
1928 if (!composite) | 1936 if (!composite) |
1929 return false; | 1937 return false; |
1930 | 1938 |
1931 m_reevaluateCompositingAfterLayout = true; | 1939 m_reevaluateCompositingAfterLayout = true; |
1932 | 1940 |
1933 RenderWidget* pluginRenderer = toRenderWidget(renderer); | 1941 RenderWidget* pluginRenderer = toRenderWidget(renderer); |
1934 // If we can't reliably know the size of the plugin yet, don't change compos
iting state. | 1942 // If we can't reliably know the size of the plugin yet, don't change compos
iting state. |
1935 if (pluginRenderer->needsLayout()) | 1943 if (pluginRenderer->needsLayout()) |
1936 return pluginRenderer->hasLayer() && pluginRenderer->layer()->isComposit
ed(); | 1944 return pluginRenderer->hasLayer() && pluginRenderer->layer()->composited
LayerMapping(); |
1937 | 1945 |
1938 // Don't go into compositing mode if height or width are zero, or size is 1x
1. | 1946 // Don't go into compositing mode if height or width are zero, or size is 1x
1. |
1939 IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect()); | 1947 IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect()); |
1940 return contentBox.height() * contentBox.width() > 1; | 1948 return contentBox.height() * contentBox.width() > 1; |
1941 } | 1949 } |
1942 | 1950 |
1943 bool RenderLayerCompositor::requiresCompositingForFrame(RenderObject* renderer)
const | 1951 bool RenderLayerCompositor::requiresCompositingForFrame(RenderObject* renderer)
const |
1944 { | 1952 { |
1945 if (!renderer->isRenderPart()) | 1953 if (!renderer->isRenderPart()) |
1946 return false; | 1954 return false; |
1947 | 1955 |
1948 RenderPart* frameRenderer = toRenderPart(renderer); | 1956 RenderPart* frameRenderer = toRenderPart(renderer); |
1949 | 1957 |
1950 if (!frameRenderer->requiresAcceleratedCompositing()) | 1958 if (!frameRenderer->requiresAcceleratedCompositing()) |
1951 return false; | 1959 return false; |
1952 | 1960 |
1953 m_reevaluateCompositingAfterLayout = true; | 1961 m_reevaluateCompositingAfterLayout = true; |
1954 | 1962 |
1955 RenderLayerCompositor* innerCompositor = frameContentsCompositor(frameRender
er); | 1963 RenderLayerCompositor* innerCompositor = frameContentsCompositor(frameRender
er); |
1956 if (!innerCompositor) | 1964 if (!innerCompositor) |
1957 return false; | 1965 return false; |
1958 | 1966 |
1959 // If we can't reliably know the size of the iframe yet, don't change compos
iting state. | 1967 // If we can't reliably know the size of the iframe yet, don't change compos
iting state. |
1960 if (renderer->needsLayout()) | 1968 if (renderer->needsLayout()) |
1961 return frameRenderer->hasLayer() && frameRenderer->layer()->isComposited
(); | 1969 return frameRenderer->hasLayer() && frameRenderer->layer()->compositedLa
yerMapping(); |
1962 | 1970 |
1963 // Don't go into compositing mode if height or width are zero. | 1971 // Don't go into compositing mode if height or width are zero. |
1964 IntRect contentBox = pixelSnappedIntRect(frameRenderer->contentBoxRect()); | 1972 IntRect contentBox = pixelSnappedIntRect(frameRenderer->contentBoxRect()); |
1965 return contentBox.height() * contentBox.width() > 0; | 1973 return contentBox.height() * contentBox.width() > 0; |
1966 } | 1974 } |
1967 | 1975 |
1968 bool RenderLayerCompositor::requiresCompositingForBackfaceVisibilityHidden(Rende
rObject* renderer) const | 1976 bool RenderLayerCompositor::requiresCompositingForBackfaceVisibilityHidden(Rende
rObject* renderer) const |
1969 { | 1977 { |
1970 return canRender3DTransforms() && renderer->style()->backfaceVisibility() ==
BackfaceVisibilityHidden; | 1978 return canRender3DTransforms() && renderer->style()->backfaceVisibility() ==
BackfaceVisibilityHidden; |
1971 } | 1979 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2126 | 2134 |
2127 if (!hasScrollableAncestor) { | 2135 if (!hasScrollableAncestor) { |
2128 if (viewportConstrainedNotCompositedReason) | 2136 if (viewportConstrainedNotCompositedReason) |
2129 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
ForUnscrollableAncestors; | 2137 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
ForUnscrollableAncestors; |
2130 return false; | 2138 return false; |
2131 } | 2139 } |
2132 | 2140 |
2133 // Subsequent tests depend on layout. If we can't tell now, just keep things
the way they are until layout is done. | 2141 // Subsequent tests depend on layout. If we can't tell now, just keep things
the way they are until layout is done. |
2134 if (!m_inPostLayoutUpdate) { | 2142 if (!m_inPostLayoutUpdate) { |
2135 m_reevaluateCompositingAfterLayout = true; | 2143 m_reevaluateCompositingAfterLayout = true; |
2136 return layer->isComposited(); | 2144 return layer->compositedLayerMapping(); |
2137 } | 2145 } |
2138 | 2146 |
2139 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend
ant(); | 2147 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend
ant(); |
2140 if (!paintsContent) { | 2148 if (!paintsContent) { |
2141 if (viewportConstrainedNotCompositedReason) | 2149 if (viewportConstrainedNotCompositedReason) |
2142 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
ForNoVisibleContent; | 2150 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
ForNoVisibleContent; |
2143 return false; | 2151 return false; |
2144 } | 2152 } |
2145 | 2153 |
2146 // Fixed position elements that are invisible in the current view don't get
their own layer. | 2154 // 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... |
2237 return supportsFixedRootBackgroundCompositing() && m_renderView->rootBackgro
undIsEntirelyFixed(); | 2245 return supportsFixedRootBackgroundCompositing() && m_renderView->rootBackgro
undIsEntirelyFixed(); |
2238 } | 2246 } |
2239 | 2247 |
2240 GraphicsLayer* RenderLayerCompositor::fixedRootBackgroundLayer() const | 2248 GraphicsLayer* RenderLayerCompositor::fixedRootBackgroundLayer() const |
2241 { | 2249 { |
2242 // Get the fixed root background from the RenderView layer's compositedLayer
Mapping. | 2250 // Get the fixed root background from the RenderView layer's compositedLayer
Mapping. |
2243 RenderLayer* viewLayer = m_renderView->layer(); | 2251 RenderLayer* viewLayer = m_renderView->layer(); |
2244 if (!viewLayer) | 2252 if (!viewLayer) |
2245 return 0; | 2253 return 0; |
2246 | 2254 |
2247 if (viewLayer->isComposited() && viewLayer->compositedLayerMapping()->backgr
oundLayerPaintsFixedRootBackground()) | 2255 if (viewLayer->compositingState() == PaintsIntoOwnBacking && viewLayer->comp
ositedLayerMapping()->backgroundLayerPaintsFixedRootBackground()) |
2248 return viewLayer->compositedLayerMapping()->backgroundLayer(); | 2256 return viewLayer->compositedLayerMapping()->backgroundLayer(); |
2249 | 2257 |
2250 return 0; | 2258 return 0; |
2251 } | 2259 } |
2252 | 2260 |
2253 static void resetTrackedRepaintRectsRecursive(GraphicsLayer* graphicsLayer) | 2261 static void resetTrackedRepaintRectsRecursive(GraphicsLayer* graphicsLayer) |
2254 { | 2262 { |
2255 if (!graphicsLayer) | 2263 if (!graphicsLayer) |
2256 return; | 2264 return; |
2257 | 2265 |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2650 | 2658 |
2651 static bool isRootmostFixedOrStickyLayer(RenderLayer* layer) | 2659 static bool isRootmostFixedOrStickyLayer(RenderLayer* layer) |
2652 { | 2660 { |
2653 if (layer->renderer()->isStickyPositioned()) | 2661 if (layer->renderer()->isStickyPositioned()) |
2654 return true; | 2662 return true; |
2655 | 2663 |
2656 if (layer->renderer()->style()->position() != FixedPosition) | 2664 if (layer->renderer()->style()->position() != FixedPosition) |
2657 return false; | 2665 return false; |
2658 | 2666 |
2659 for (RenderLayer* stackingContainer = layer->ancestorStackingContainer(); st
ackingContainer; stackingContainer = stackingContainer->ancestorStackingContaine
r()) { | 2667 for (RenderLayer* stackingContainer = layer->ancestorStackingContainer(); st
ackingContainer; stackingContainer = stackingContainer->ancestorStackingContaine
r()) { |
2660 if (stackingContainer->isComposited() && stackingContainer->renderer()->
style()->position() == FixedPosition) | 2668 if (stackingContainer->compositedLayerMapping() && stackingContainer->re
nderer()->style()->position() == FixedPosition) |
2661 return false; | 2669 return false; |
2662 } | 2670 } |
2663 | 2671 |
2664 return true; | 2672 return true; |
2665 } | 2673 } |
2666 | 2674 |
2667 void RenderLayerCompositor::updateViewportConstraintStatus(RenderLayer* layer) | 2675 void RenderLayerCompositor::updateViewportConstraintStatus(RenderLayer* layer) |
2668 { | 2676 { |
2669 if (isRootmostFixedOrStickyLayer(layer)) | 2677 if (isRootmostFixedOrStickyLayer(layer)) |
2670 addViewportConstrainedLayer(layer); | 2678 addViewportConstrainedLayer(layer); |
2671 else | 2679 else |
2672 removeViewportConstrainedLayer(layer); | 2680 removeViewportConstrainedLayer(layer); |
2673 } | 2681 } |
2674 | 2682 |
2675 void RenderLayerCompositor::addViewportConstrainedLayer(RenderLayer* layer) | 2683 void RenderLayerCompositor::addViewportConstrainedLayer(RenderLayer* layer) |
2676 { | 2684 { |
2677 m_viewportConstrainedLayers.add(layer); | 2685 m_viewportConstrainedLayers.add(layer); |
2678 } | 2686 } |
2679 | 2687 |
2680 void RenderLayerCompositor::removeViewportConstrainedLayer(RenderLayer* layer) | 2688 void RenderLayerCompositor::removeViewportConstrainedLayer(RenderLayer* layer) |
2681 { | 2689 { |
2682 if (!m_viewportConstrainedLayers.contains(layer)) | 2690 if (!m_viewportConstrainedLayers.contains(layer)) |
2683 return; | 2691 return; |
2684 | 2692 |
2685 m_viewportConstrainedLayers.remove(layer); | 2693 m_viewportConstrainedLayers.remove(layer); |
2686 } | 2694 } |
2687 | 2695 |
2688 FixedPositionViewportConstraints RenderLayerCompositor::computeFixedViewportCons
traints(RenderLayer* layer) const | 2696 FixedPositionViewportConstraints RenderLayerCompositor::computeFixedViewportCons
traints(RenderLayer* layer) const |
2689 { | 2697 { |
2690 ASSERT(layer->isComposited()); | 2698 ASSERT(layer->compositedLayerMapping()); |
2691 | 2699 |
2692 FrameView* frameView = m_renderView->frameView(); | 2700 FrameView* frameView = m_renderView->frameView(); |
2693 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect()
; | 2701 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect()
; |
2694 | 2702 |
2695 FixedPositionViewportConstraints constraints; | 2703 FixedPositionViewportConstraints constraints; |
2696 | 2704 |
2697 GraphicsLayer* graphicsLayer = layer->compositedLayerMapping()->mainGraphics
Layer(); | 2705 GraphicsLayer* graphicsLayer = layer->compositedLayerMapping()->mainGraphics
Layer(); |
2698 | 2706 |
2699 constraints.setLayerPositionAtLastLayout(graphicsLayer->position()); | 2707 constraints.setLayerPositionAtLastLayout(graphicsLayer->position()); |
2700 constraints.setViewportRectAtLastLayout(viewportRect); | 2708 constraints.setViewportRectAtLastLayout(viewportRect); |
(...skipping 17 matching lines...) Expand all Loading... |
2718 | 2726 |
2719 // If top and bottom are auto, use top. | 2727 // If top and bottom are auto, use top. |
2720 if (style->top().isAuto() && style->bottom().isAuto()) | 2728 if (style->top().isAuto() && style->bottom().isAuto()) |
2721 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeTop); | 2729 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeTop); |
2722 | 2730 |
2723 return constraints; | 2731 return constraints; |
2724 } | 2732 } |
2725 | 2733 |
2726 StickyPositionViewportConstraints RenderLayerCompositor::computeStickyViewportCo
nstraints(RenderLayer* layer) const | 2734 StickyPositionViewportConstraints RenderLayerCompositor::computeStickyViewportCo
nstraints(RenderLayer* layer) const |
2727 { | 2735 { |
2728 ASSERT(layer->isComposited()); | 2736 ASSERT(layer->compositedLayerMapping()); |
2729 | 2737 |
2730 FrameView* frameView = m_renderView->frameView(); | 2738 FrameView* frameView = m_renderView->frameView(); |
2731 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect()
; | 2739 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect()
; |
2732 | 2740 |
2733 StickyPositionViewportConstraints constraints; | 2741 StickyPositionViewportConstraints constraints; |
2734 | 2742 |
2735 RenderBoxModelObject* renderer = toRenderBoxModelObject(layer->renderer()); | 2743 RenderBoxModelObject* renderer = toRenderBoxModelObject(layer->renderer()); |
2736 | 2744 |
2737 renderer->computeStickyPositionConstraints(constraints, viewportRect); | 2745 renderer->computeStickyPositionConstraints(constraints, viewportRect); |
2738 | 2746 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2788 } else if (graphicsLayer == m_scrollLayer.get()) { | 2796 } else if (graphicsLayer == m_scrollLayer.get()) { |
2789 name = "Frame Scrolling Layer"; | 2797 name = "Frame Scrolling Layer"; |
2790 } else { | 2798 } else { |
2791 ASSERT_NOT_REACHED(); | 2799 ASSERT_NOT_REACHED(); |
2792 } | 2800 } |
2793 | 2801 |
2794 return name; | 2802 return name; |
2795 } | 2803 } |
2796 | 2804 |
2797 } // namespace WebCore | 2805 } // namespace WebCore |
OLD | NEW |