| 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 | 295 |
| 296 IntRect visibleRect = m_containerLayer ? IntRect(IntPoint(), frameView->cont
entsSize()) : frameView->visibleContentRect(); | 296 IntRect visibleRect = m_containerLayer ? IntRect(IntPoint(), frameView->cont
entsSize()) : frameView->visibleContentRect(); |
| 297 if (rootLayer->visibleRectChangeRequiresFlush(visibleRect)) { | 297 if (rootLayer->visibleRectChangeRequiresFlush(visibleRect)) { |
| 298 if (Page* page = this->page()) | 298 if (Page* page = this->page()) |
| 299 page->chrome().client().scheduleCompositingLayerFlush(); | 299 page->chrome().client().scheduleCompositingLayerFlush(); |
| 300 } | 300 } |
| 301 } | 301 } |
| 302 | 302 |
| 303 bool RenderLayerCompositor::hasAnyAdditionalCompositedLayers(const RenderLayer*
rootLayer) const | 303 bool RenderLayerCompositor::hasAnyAdditionalCompositedLayers(const RenderLayer*
rootLayer) const |
| 304 { | 304 { |
| 305 return m_compositedLayerCount > (rootLayer->compositedLayerMapping() ? 1 : 0
); | 305 return m_compositedLayerCount > (rootLayer->hasCompositedLayerMapping() ? 1
: 0); |
| 306 } | 306 } |
| 307 | 307 |
| 308 void RenderLayerCompositor::updateCompositingRequirementsState() | 308 void RenderLayerCompositor::updateCompositingRequirementsState() |
| 309 { | 309 { |
| 310 if (!m_needsUpdateCompositingRequirementsState) | 310 if (!m_needsUpdateCompositingRequirementsState) |
| 311 return; | 311 return; |
| 312 | 312 |
| 313 TRACE_EVENT0("blink_rendering,comp-scroll", "RenderLayerCompositor::updateCo
mpositingRequirementsState"); | 313 TRACE_EVENT0("blink_rendering,comp-scroll", "RenderLayerCompositor::updateCo
mpositingRequirementsState"); |
| 314 | 314 |
| 315 m_needsUpdateCompositingRequirementsState = false; | 315 m_needsUpdateCompositingRequirementsState = false; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 // Update the hierarchy of the compositing layers. | 446 // Update the hierarchy of the compositing layers. |
| 447 Vector<GraphicsLayer*> childList; | 447 Vector<GraphicsLayer*> childList; |
| 448 { | 448 { |
| 449 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo
sitingLayerTree"); | 449 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo
sitingLayerTree"); |
| 450 rebuildCompositingLayerTree(updateRoot, childList, 0); | 450 rebuildCompositingLayerTree(updateRoot, childList, 0); |
| 451 } | 451 } |
| 452 | 452 |
| 453 // Host the document layer in the RenderView's root layer. | 453 // Host the document layer in the RenderView's root layer. |
| 454 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMainFra
me()) { | 454 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMainFra
me()) { |
| 455 RenderVideo* video = findFullscreenVideoRenderer(&m_renderView->docu
ment()); | 455 RenderVideo* video = findFullscreenVideoRenderer(&m_renderView->docu
ment()); |
| 456 if (video) { | 456 if (video && video->hasCompositedLayerMapping()) { |
| 457 CompositedLayerMapping* compositedLayerMapping = video->composit
edLayerMapping(); | 457 childList.clear(); |
| 458 if (compositedLayerMapping) { | 458 childList.append(video->compositedLayerMapping()->mainGraphicsLa
yer()); |
| 459 childList.clear(); | |
| 460 childList.append(compositedLayerMapping->mainGraphicsLayer()
); | |
| 461 } | |
| 462 } | 459 } |
| 463 } | 460 } |
| 464 // Even when childList is empty, don't drop out of compositing mode if t
here are | 461 // Even when childList is empty, don't drop out of compositing mode if t
here are |
| 465 // composited layers that we didn't hit in our traversal (e.g. because o
f visibility:hidden). | 462 // composited layers that we didn't hit in our traversal (e.g. because o
f visibility:hidden). |
| 466 if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(updateRoot)
) | 463 if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(updateRoot)
) |
| 467 destroyRootLayer(); | 464 destroyRootLayer(); |
| 468 else | 465 else |
| 469 m_rootContentLayer->setChildren(childList); | 466 m_rootContentLayer->setChildren(childList); |
| 470 } else if (needGeometryUpdate) { | 467 } else if (needGeometryUpdate) { |
| 471 // We just need to do a geometry update. This is only used for position:
fixed scrolling; | 468 // We just need to do a geometry update. This is only used for position:
fixed scrolling; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 bool compositedLayerMappingChanged = false; | 511 bool compositedLayerMappingChanged = false; |
| 515 RenderLayer::ViewportConstrainedNotCompositedReason viewportConstrainedNotCo
mpositedReason = RenderLayer::NoNotCompositedReason; | 512 RenderLayer::ViewportConstrainedNotCompositedReason viewportConstrainedNotCo
mpositedReason = RenderLayer::NoNotCompositedReason; |
| 516 requiresCompositingForPosition(layer->renderer(), layer, &viewportConstraine
dNotCompositedReason); | 513 requiresCompositingForPosition(layer->renderer(), layer, &viewportConstraine
dNotCompositedReason); |
| 517 | 514 |
| 518 // FIXME: It would be nice to directly use the layer's compositing reason, | 515 // FIXME: It would be nice to directly use the layer's compositing reason, |
| 519 // but allocateOrClearCompositedLayerMapping also gets called without having
updated compositing | 516 // but allocateOrClearCompositedLayerMapping also gets called without having
updated compositing |
| 520 // requirements fully. | 517 // requirements fully. |
| 521 if (needsToBeComposited(layer)) { | 518 if (needsToBeComposited(layer)) { |
| 522 enableCompositingMode(); | 519 enableCompositingMode(); |
| 523 | 520 |
| 524 if (!layer->compositedLayerMapping()) { | 521 if (!layer->hasCompositedLayerMapping()) { |
| 525 // If we need to repaint, do so before allocating the compositedLaye
rMapping | 522 // If we need to repaint, do so before allocating the compositedLaye
rMapping |
| 526 repaintOnCompositingChange(layer); | 523 repaintOnCompositingChange(layer); |
| 527 | 524 |
| 528 layer->ensureCompositedLayerMapping(); | 525 layer->ensureCompositedLayerMapping(); |
| 529 compositedLayerMappingChanged = true; | 526 compositedLayerMappingChanged = true; |
| 530 | 527 |
| 531 // At this time, the ScrollingCooridnator only supports the top-leve
l frame. | 528 // At this time, the ScrollingCooridnator only supports the top-leve
l frame. |
| 532 if (layer->isRootLayer() && isMainFrame()) { | 529 if (layer->isRootLayer() && isMainFrame()) { |
| 533 if (ScrollingCoordinator* scrollingCoordinator = this->scrolling
Coordinator()) | 530 if (ScrollingCoordinator* scrollingCoordinator = this->scrolling
Coordinator()) |
| 534 scrollingCoordinator->frameViewRootLayerDidChange(m_renderVi
ew->frameView()); | 531 scrollingCoordinator->frameViewRootLayerDidChange(m_renderVi
ew->frameView()); |
| 535 } | 532 } |
| 536 | 533 |
| 537 // This layer and all of its descendants have cached repaints rects
that are relative to | 534 // This layer and all of its descendants have cached repaints rects
that are relative to |
| 538 // the repaint container, so change when compositing changes; we nee
d to update them here. | 535 // the repaint container, so change when compositing changes; we nee
d to update them here. |
| 539 if (layer->parent()) | 536 if (layer->parent()) |
| 540 layer->repainter().computeRepaintRectsIncludingDescendants(); | 537 layer->repainter().computeRepaintRectsIncludingDescendants(); |
| 541 } | 538 } |
| 542 | 539 |
| 543 if (layer->compositedLayerMapping()->updateRequiresOwnBackingStoreForInt
rinsicReasons()) | 540 if (layer->compositedLayerMapping()->updateRequiresOwnBackingStoreForInt
rinsicReasons()) |
| 544 compositedLayerMappingChanged = true; | 541 compositedLayerMappingChanged = true; |
| 545 } else { | 542 } else { |
| 546 if (layer->compositedLayerMapping()) { | 543 if (layer->hasCompositedLayerMapping()) { |
| 547 // If we're removing the compositedLayerMapping from a reflection, c
lear the source GraphicsLayer's pointer to | 544 // If we're removing the compositedLayerMapping from a reflection, c
lear the source GraphicsLayer's pointer to |
| 548 // its replica GraphicsLayer. In practice this should never happen b
ecause reflectee and reflection | 545 // its replica GraphicsLayer. In practice this should never happen b
ecause reflectee and reflection |
| 549 // are both either composited, or not composited. | 546 // are both either composited, or not composited. |
| 550 if (layer->isReflection()) { | 547 if (layer->isReflection()) { |
| 551 RenderLayer* sourceLayer = toRenderLayerModelObject(layer->rende
rer()->parent())->layer(); | 548 RenderLayer* sourceLayer = toRenderLayerModelObject(layer->rende
rer()->parent())->layer(); |
| 552 if (CompositedLayerMapping* compositedLayerMapping = sourceLayer
->compositedLayerMapping()) { | 549 if (sourceLayer->hasCompositedLayerMapping()) { |
| 553 ASSERT(compositedLayerMapping->mainGraphicsLayer()->replicaL
ayer() == layer->compositedLayerMapping()->mainGraphicsLayer()); | 550 ASSERT(sourceLayer->compositedLayerMapping()->mainGraphicsLa
yer()->replicaLayer() == layer->compositedLayerMapping()->mainGraphicsLayer()); |
| 554 compositedLayerMapping->mainGraphicsLayer()->setReplicatedBy
Layer(0); | 551 sourceLayer->compositedLayerMapping()->mainGraphicsLayer()->
setReplicatedByLayer(0); |
| 555 } | 552 } |
| 556 } | 553 } |
| 557 | 554 |
| 558 removeViewportConstrainedLayer(layer); | 555 removeViewportConstrainedLayer(layer); |
| 559 | 556 |
| 560 layer->clearCompositedLayerMapping(); | 557 layer->clearCompositedLayerMapping(); |
| 561 compositedLayerMappingChanged = true; | 558 compositedLayerMappingChanged = true; |
| 562 | 559 |
| 563 // This layer and all of its descendants have cached repaints rects
that are relative to | 560 // This layer and all of its descendants have cached repaints rects
that are relative to |
| 564 // the repaint container, so change when compositing changes; we nee
d to update them here. | 561 // the repaint container, so change when compositing changes; we nee
d to update them here. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 595 return compositedLayerMappingChanged || nonCompositedReasonChanged; | 592 return compositedLayerMappingChanged || nonCompositedReasonChanged; |
| 596 } | 593 } |
| 597 | 594 |
| 598 bool RenderLayerCompositor::updateLayerCompositingState(RenderLayer* layer) | 595 bool RenderLayerCompositor::updateLayerCompositingState(RenderLayer* layer) |
| 599 { | 596 { |
| 600 updateDirectCompositingReasons(layer); | 597 updateDirectCompositingReasons(layer); |
| 601 bool layerChanged = allocateOrClearCompositedLayerMapping(layer); | 598 bool layerChanged = allocateOrClearCompositedLayerMapping(layer); |
| 602 | 599 |
| 603 // See if we need content or clipping layers. Methods called here should ass
ume | 600 // See if we need content or clipping layers. Methods called here should ass
ume |
| 604 // that the compositing state of descendant layers has not been updated yet. | 601 // that the compositing state of descendant layers has not been updated yet. |
| 605 if (layer->compositedLayerMapping() && layer->compositedLayerMapping()->upda
teGraphicsLayerConfiguration()) | 602 if (layer->hasCompositedLayerMapping() && layer->compositedLayerMapping()->u
pdateGraphicsLayerConfiguration()) |
| 606 layerChanged = true; | 603 layerChanged = true; |
| 607 | 604 |
| 608 return layerChanged; | 605 return layerChanged; |
| 609 } | 606 } |
| 610 | 607 |
| 611 void RenderLayerCompositor::repaintOnCompositingChange(RenderLayer* layer) | 608 void RenderLayerCompositor::repaintOnCompositingChange(RenderLayer* layer) |
| 612 { | 609 { |
| 613 // If the renderer is not attached yet, no need to repaint. | 610 // If the renderer is not attached yet, no need to repaint. |
| 614 if (layer->renderer() != m_renderView && !layer->renderer()->parent()) | 611 if (layer->renderer() != m_renderView && !layer->renderer()->parent()) |
| 615 return; | 612 return; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 return layer->calculateLayerBounds(ancestorLayer, 0, flags); | 651 return layer->calculateLayerBounds(ancestorLayer, 0, flags); |
| 655 } | 652 } |
| 656 | 653 |
| 657 void RenderLayerCompositor::layerWasAdded(RenderLayer* /*parent*/, RenderLayer*
/*child*/) | 654 void RenderLayerCompositor::layerWasAdded(RenderLayer* /*parent*/, RenderLayer*
/*child*/) |
| 658 { | 655 { |
| 659 setCompositingLayersNeedRebuild(); | 656 setCompositingLayersNeedRebuild(); |
| 660 } | 657 } |
| 661 | 658 |
| 662 void RenderLayerCompositor::layerWillBeRemoved(RenderLayer* parent, RenderLayer*
child) | 659 void RenderLayerCompositor::layerWillBeRemoved(RenderLayer* parent, RenderLayer*
child) |
| 663 { | 660 { |
| 664 if (!child->compositedLayerMapping() || parent->renderer()->documentBeingDes
troyed()) | 661 if (!child->hasCompositedLayerMapping() || parent->renderer()->documentBeing
Destroyed()) |
| 665 return; | 662 return; |
| 666 | 663 |
| 667 removeViewportConstrainedLayer(child); | 664 removeViewportConstrainedLayer(child); |
| 668 repaintInCompositedAncestor(child, child->compositedLayerMapping()->composit
edBounds()); | 665 repaintInCompositedAncestor(child, child->compositedLayerMapping()->composit
edBounds()); |
| 669 | 666 |
| 670 setCompositingParent(child, 0); | 667 setCompositingParent(child, 0); |
| 671 setCompositingLayersNeedRebuild(); | 668 setCompositingLayersNeedRebuild(); |
| 672 } | 669 } |
| 673 | 670 |
| 674 RenderLayer* RenderLayerCompositor::enclosingNonStackingClippingLayer(const Rend
erLayer* layer) const | 671 RenderLayer* RenderLayerCompositor::enclosingNonStackingClippingLayer(const Rend
erLayer* layer) const |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 | 968 |
| 972 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTrans
form(); | 969 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTrans
form(); |
| 973 | 970 |
| 974 if (overlapMap) | 971 if (overlapMap) |
| 975 overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer); | 972 overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer); |
| 976 } | 973 } |
| 977 | 974 |
| 978 void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, Render
Layer* parentLayer) | 975 void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, Render
Layer* parentLayer) |
| 979 { | 976 { |
| 980 ASSERT(!parentLayer || childLayer->ancestorCompositingLayer() == parentLayer
); | 977 ASSERT(!parentLayer || childLayer->ancestorCompositingLayer() == parentLayer
); |
| 981 ASSERT(childLayer->compositedLayerMapping()); | 978 ASSERT(childLayer->hasCompositedLayerMapping()); |
| 982 | 979 |
| 983 // It's possible to be called with a parent that isn't yet composited when w
e're doing | 980 // It's possible to be called with a parent that isn't yet composited when w
e're doing |
| 984 // partial updates as required by painting or hit testing. Just bail in that
case; | 981 // partial updates as required by painting or hit testing. Just bail in that
case; |
| 985 // we'll do a full layer update soon. | 982 // we'll do a full layer update soon. |
| 986 if (!parentLayer || !parentLayer->compositedLayerMapping()) | 983 if (!parentLayer || !parentLayer->hasCompositedLayerMapping()) |
| 987 return; | 984 return; |
| 988 | 985 |
| 989 if (parentLayer) { | 986 if (parentLayer) { |
| 990 GraphicsLayer* hostingLayer = parentLayer->compositedLayerMapping()->par
entForSublayers(); | 987 GraphicsLayer* hostingLayer = parentLayer->compositedLayerMapping()->par
entForSublayers(); |
| 991 GraphicsLayer* hostedLayer = childLayer->compositedLayerMapping()->child
ForSuperlayers(); | 988 GraphicsLayer* hostedLayer = childLayer->compositedLayerMapping()->child
ForSuperlayers(); |
| 992 | 989 |
| 993 hostingLayer->addChild(hostedLayer); | 990 hostingLayer->addChild(hostedLayer); |
| 994 } else { | 991 } else { |
| 995 childLayer->compositedLayerMapping()->childForSuperlayers()->removeFromP
arent(); | 992 childLayer->compositedLayerMapping()->childForSuperlayers()->removeFromP
arent(); |
| 996 } | 993 } |
| 997 } | 994 } |
| 998 | 995 |
| 999 void RenderLayerCompositor::removeCompositedChildren(RenderLayer* layer) | 996 void RenderLayerCompositor::removeCompositedChildren(RenderLayer* layer) |
| 1000 { | 997 { |
| 1001 ASSERT(layer->compositedLayerMapping()); | 998 ASSERT(layer->hasCompositedLayerMapping()); |
| 1002 | 999 |
| 1003 GraphicsLayer* hostingLayer = layer->compositedLayerMapping()->parentForSubl
ayers(); | 1000 GraphicsLayer* hostingLayer = layer->compositedLayerMapping()->parentForSubl
ayers(); |
| 1004 hostingLayer->removeAllChildren(); | 1001 hostingLayer->removeAllChildren(); |
| 1005 } | 1002 } |
| 1006 | 1003 |
| 1007 bool RenderLayerCompositor::canAccelerateVideoRendering(RenderVideo* o) const | 1004 bool RenderLayerCompositor::canAccelerateVideoRendering(RenderVideo* o) const |
| 1008 { | 1005 { |
| 1009 if (!m_hasAcceleratedCompositing) | 1006 if (!m_hasAcceleratedCompositing) |
| 1010 return false; | 1007 return false; |
| 1011 | 1008 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1023 // Used for gathering UMA data about the effect on memory usage of promoting
all layers | 1020 // Used for gathering UMA data about the effect on memory usage of promoting
all layers |
| 1024 // that have a webkit-transition on opacity or transform and intersect the v
iewport. | 1021 // that have a webkit-transition on opacity or transform and intersect the v
iewport. |
| 1025 static double pixelsWithoutPromotingAllTransitions = 0.0; | 1022 static double pixelsWithoutPromotingAllTransitions = 0.0; |
| 1026 static double pixelsAddedByPromotingAllTransitions = 0.0; | 1023 static double pixelsAddedByPromotingAllTransitions = 0.0; |
| 1027 | 1024 |
| 1028 if (!depth) { | 1025 if (!depth) { |
| 1029 pixelsWithoutPromotingAllTransitions = 0.0; | 1026 pixelsWithoutPromotingAllTransitions = 0.0; |
| 1030 pixelsAddedByPromotingAllTransitions = 0.0; | 1027 pixelsAddedByPromotingAllTransitions = 0.0; |
| 1031 } | 1028 } |
| 1032 | 1029 |
| 1033 CompositedLayerMapping* currentCompositedLayerMapping = layer->compositedLay
erMapping(); | 1030 const bool hasCompositedLayerMapping = layer->hasCompositedLayerMapping(); |
| 1034 if (currentCompositedLayerMapping) { | 1031 CompositedLayerMappingPtr currentCompositedLayerMapping = layer->compositedL
ayerMapping(); |
| 1032 if (hasCompositedLayerMapping) { |
| 1035 // The compositing state of all our children has been updated already, s
o now | 1033 // The compositing state of all our children has been updated already, s
o now |
| 1036 // we can compute and cache the composited bounds for this layer. | 1034 // we can compute and cache the composited bounds for this layer. |
| 1037 currentCompositedLayerMapping->updateCompositedBounds(); | 1035 currentCompositedLayerMapping->updateCompositedBounds(); |
| 1038 | 1036 |
| 1039 if (layer->reflectionInfo()) { | 1037 if (layer->reflectionInfo()) { |
| 1040 RenderLayer* reflectionLayer = layer->reflectionInfo()->reflectionLa
yer(); | 1038 RenderLayer* reflectionLayer = layer->reflectionInfo()->reflectionLa
yer(); |
| 1041 if (reflectionLayer->compositedLayerMapping()) | 1039 if (reflectionLayer->hasCompositedLayerMapping()) |
| 1042 reflectionLayer->compositedLayerMapping()->updateCompositedBound
s(); | 1040 reflectionLayer->compositedLayerMapping()->updateCompositedBound
s(); |
| 1043 } | 1041 } |
| 1044 | 1042 |
| 1045 currentCompositedLayerMapping->updateGraphicsLayerConfiguration(); | 1043 currentCompositedLayerMapping->updateGraphicsLayerConfiguration(); |
| 1046 currentCompositedLayerMapping->updateGraphicsLayerGeometry(); | 1044 currentCompositedLayerMapping->updateGraphicsLayerGeometry(); |
| 1047 | 1045 |
| 1048 if (!layer->parent()) | 1046 if (!layer->parent()) |
| 1049 updateRootLayerPosition(); | 1047 updateRootLayerPosition(); |
| 1050 | 1048 |
| 1051 if (currentCompositedLayerMapping->hasUnpositionedOverflowControlsLayers
()) | 1049 if (currentCompositedLayerMapping->hasUnpositionedOverflowControlsLayers
()) |
| 1052 layer->scrollableArea()->positionOverflowControls(); | 1050 layer->scrollableArea()->positionOverflowControls(); |
| 1053 | 1051 |
| 1054 pixelsWithoutPromotingAllTransitions += layer->size().height() * layer->
size().width(); | 1052 pixelsWithoutPromotingAllTransitions += layer->size().height() * layer->
size().width(); |
| 1055 } else { | 1053 } else { |
| 1056 if ((layer->renderer()->style()->transitionForProperty(CSSPropertyOpacit
y) || | 1054 if ((layer->renderer()->style()->transitionForProperty(CSSPropertyOpacit
y) || |
| 1057 layer->renderer()->style()->transitionForProperty(CSSPropertyWebkit
Transform)) && | 1055 layer->renderer()->style()->transitionForProperty(CSSPropertyWebkit
Transform)) && |
| 1058 m_renderView->viewRect().intersects(layer->absoluteBoundingBox())) | 1056 m_renderView->viewRect().intersects(layer->absoluteBoundingBox())) |
| 1059 pixelsAddedByPromotingAllTransitions += layer->size().height() * lay
er->size().width(); | 1057 pixelsAddedByPromotingAllTransitions += layer->size().height() * lay
er->size().width(); |
| 1060 } | 1058 } |
| 1061 | 1059 |
| 1062 // If this layer has a compositedLayerMapping, then that is where we place s
ubsequent children GraphicsLayers. | 1060 // If this layer has a compositedLayerMapping, then that is where we place s
ubsequent children GraphicsLayers. |
| 1063 // Otherwise children continue to append to the child list of the enclosing
layer. | 1061 // Otherwise children continue to append to the child list of the enclosing
layer. |
| 1064 Vector<GraphicsLayer*> layerChildren; | 1062 Vector<GraphicsLayer*> layerChildren; |
| 1065 Vector<GraphicsLayer*>& childList = currentCompositedLayerMapping ? layerChi
ldren : childLayersOfEnclosingLayer; | 1063 Vector<GraphicsLayer*>& childList = hasCompositedLayerMapping ? layerChildre
n : childLayersOfEnclosingLayer; |
| 1066 | 1064 |
| 1067 #if !ASSERT_DISABLED | 1065 #if !ASSERT_DISABLED |
| 1068 LayerListMutationDetector mutationChecker(layer->stackingNode()); | 1066 LayerListMutationDetector mutationChecker(layer->stackingNode()); |
| 1069 #endif | 1067 #endif |
| 1070 | 1068 |
| 1071 if (layer->stackingNode()->isStackingContainer()) { | 1069 if (layer->stackingNode()->isStackingContainer()) { |
| 1072 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), Negativ
eZOrderChildren); | 1070 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), Negativ
eZOrderChildren); |
| 1073 while (RenderLayerStackingNode* curNode = iterator.next()) | 1071 while (RenderLayerStackingNode* curNode = iterator.next()) |
| 1074 rebuildCompositingLayerTree(curNode->layer(), childList, depth + 1); | 1072 rebuildCompositingLayerTree(curNode->layer(), childList, depth + 1); |
| 1075 | 1073 |
| 1076 // If a negative z-order child is compositing, we get a foreground layer
which needs to get parented. | 1074 // If a negative z-order child is compositing, we get a foreground layer
which needs to get parented. |
| 1077 if (currentCompositedLayerMapping && currentCompositedLayerMapping->fore
groundLayer()) | 1075 if (hasCompositedLayerMapping && currentCompositedLayerMapping->foregrou
ndLayer()) |
| 1078 childList.append(currentCompositedLayerMapping->foregroundLayer()); | 1076 childList.append(currentCompositedLayerMapping->foregroundLayer()); |
| 1079 } | 1077 } |
| 1080 | 1078 |
| 1081 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC
hildren | PositiveZOrderChildren); | 1079 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC
hildren | PositiveZOrderChildren); |
| 1082 while (RenderLayerStackingNode* curNode = iterator.next()) | 1080 while (RenderLayerStackingNode* curNode = iterator.next()) |
| 1083 rebuildCompositingLayerTree(curNode->layer(), childList, depth + 1); | 1081 rebuildCompositingLayerTree(curNode->layer(), childList, depth + 1); |
| 1084 | 1082 |
| 1085 if (currentCompositedLayerMapping) { | 1083 if (hasCompositedLayerMapping) { |
| 1086 bool parented = false; | 1084 bool parented = false; |
| 1087 if (layer->renderer()->isRenderPart()) | 1085 if (layer->renderer()->isRenderPart()) |
| 1088 parented = parentFrameContentLayers(toRenderPart(layer->renderer()))
; | 1086 parented = parentFrameContentLayers(toRenderPart(layer->renderer()))
; |
| 1089 | 1087 |
| 1090 if (!parented) | 1088 if (!parented) |
| 1091 currentCompositedLayerMapping->parentForSublayers()->setChildren(lay
erChildren); | 1089 currentCompositedLayerMapping->parentForSublayers()->setChildren(lay
erChildren); |
| 1092 | 1090 |
| 1093 // If the layer has a clipping layer the overflow controls layers will b
e siblings of the clipping layer. | 1091 // If the layer has a clipping layer the overflow controls layers will b
e siblings of the clipping layer. |
| 1094 // Otherwise, the overflow control layers are normal children. | 1092 // Otherwise, the overflow control layers are normal children. |
| 1095 if (!currentCompositedLayerMapping->hasClippingLayer() && !currentCompos
itedLayerMapping->hasScrollingLayer()) { | 1093 if (!currentCompositedLayerMapping->hasClippingLayer() && !currentCompos
itedLayerMapping->hasScrollingLayer()) { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 return 0; | 1256 return 0; |
| 1259 } | 1257 } |
| 1260 | 1258 |
| 1261 bool RenderLayerCompositor::parentFrameContentLayers(RenderPart* renderer) | 1259 bool RenderLayerCompositor::parentFrameContentLayers(RenderPart* renderer) |
| 1262 { | 1260 { |
| 1263 RenderLayerCompositor* innerCompositor = frameContentsCompositor(renderer); | 1261 RenderLayerCompositor* innerCompositor = frameContentsCompositor(renderer); |
| 1264 if (!innerCompositor || !innerCompositor->inCompositingMode() || innerCompos
itor->rootLayerAttachment() != RootLayerAttachedViaEnclosingFrame) | 1262 if (!innerCompositor || !innerCompositor->inCompositingMode() || innerCompos
itor->rootLayerAttachment() != RootLayerAttachedViaEnclosingFrame) |
| 1265 return false; | 1263 return false; |
| 1266 | 1264 |
| 1267 RenderLayer* layer = renderer->layer(); | 1265 RenderLayer* layer = renderer->layer(); |
| 1268 if (!layer->compositedLayerMapping()) | 1266 if (!layer->hasCompositedLayerMapping()) |
| 1269 return false; | 1267 return false; |
| 1270 | 1268 |
| 1271 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); | 1269 CompositedLayerMappingPtr compositedLayerMapping = layer->compositedLayerMap
ping(); |
| 1272 GraphicsLayer* hostingLayer = compositedLayerMapping->parentForSublayers(); | 1270 GraphicsLayer* hostingLayer = compositedLayerMapping->parentForSublayers(); |
| 1273 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer(); | 1271 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer(); |
| 1274 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r
ootLayer) { | 1272 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r
ootLayer) { |
| 1275 hostingLayer->removeAllChildren(); | 1273 hostingLayer->removeAllChildren(); |
| 1276 hostingLayer->addChild(rootLayer); | 1274 hostingLayer->addChild(rootLayer); |
| 1277 } | 1275 } |
| 1278 return true; | 1276 return true; |
| 1279 } | 1277 } |
| 1280 | 1278 |
| 1281 // This just updates layer geometry without changing the hierarchy. | 1279 // This just updates layer geometry without changing the hierarchy. |
| 1282 void RenderLayerCompositor::updateLayerTreeGeometry(RenderLayer* layer) | 1280 void RenderLayerCompositor::updateLayerTreeGeometry(RenderLayer* layer) |
| 1283 { | 1281 { |
| 1284 if (CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerM
apping()) { | 1282 if (layer->hasCompositedLayerMapping()) { |
| 1283 CompositedLayerMappingPtr compositedLayerMapping = layer->compositedLaye
rMapping(); |
| 1285 // The compositing state of all our children has been updated already, s
o now | 1284 // The compositing state of all our children has been updated already, s
o now |
| 1286 // we can compute and cache the composited bounds for this layer. | 1285 // we can compute and cache the composited bounds for this layer. |
| 1287 compositedLayerMapping->updateCompositedBounds(); | 1286 compositedLayerMapping->updateCompositedBounds(); |
| 1288 | 1287 |
| 1289 if (layer->reflectionInfo()) { | 1288 if (layer->reflectionInfo()) { |
| 1290 RenderLayer* reflectionLayer = layer->reflectionInfo()->reflectionLa
yer(); | 1289 RenderLayer* reflectionLayer = layer->reflectionInfo()->reflectionLa
yer(); |
| 1291 if (reflectionLayer->compositedLayerMapping()) | 1290 if (reflectionLayer->hasCompositedLayerMapping()) |
| 1292 reflectionLayer->compositedLayerMapping()->updateCompositedBound
s(); | 1291 reflectionLayer->compositedLayerMapping()->updateCompositedBound
s(); |
| 1293 } | 1292 } |
| 1294 | 1293 |
| 1295 compositedLayerMapping->updateGraphicsLayerConfiguration(); | 1294 compositedLayerMapping->updateGraphicsLayerConfiguration(); |
| 1296 compositedLayerMapping->updateGraphicsLayerGeometry(); | 1295 compositedLayerMapping->updateGraphicsLayerGeometry(); |
| 1297 | 1296 |
| 1298 if (!layer->parent()) | 1297 if (!layer->parent()) |
| 1299 updateRootLayerPosition(); | 1298 updateRootLayerPosition(); |
| 1300 } | 1299 } |
| 1301 | 1300 |
| 1302 #if !ASSERT_DISABLED | 1301 #if !ASSERT_DISABLED |
| 1303 LayerListMutationDetector mutationChecker(layer->stackingNode()); | 1302 LayerListMutationDetector mutationChecker(layer->stackingNode()); |
| 1304 #endif | 1303 #endif |
| 1305 | 1304 |
| 1306 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), AllChildren
); | 1305 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), AllChildren
); |
| 1307 while (RenderLayerStackingNode* curNode = iterator.next()) | 1306 while (RenderLayerStackingNode* curNode = iterator.next()) |
| 1308 updateLayerTreeGeometry(curNode->layer()); | 1307 updateLayerTreeGeometry(curNode->layer()); |
| 1309 } | 1308 } |
| 1310 | 1309 |
| 1311 // Recurs down the RenderLayer tree until its finds the compositing descendants
of compositingAncestor and updates their geometry. | 1310 // Recurs down the RenderLayer tree until its finds the compositing descendants
of compositingAncestor and updates their geometry. |
| 1312 void RenderLayerCompositor::updateCompositingDescendantGeometry(RenderLayerStack
ingNode* compositingAncestor, RenderLayer* layer, bool compositedChildrenOnly) | 1311 void RenderLayerCompositor::updateCompositingDescendantGeometry(RenderLayerStack
ingNode* compositingAncestor, RenderLayer* layer, bool compositedChildrenOnly) |
| 1313 { | 1312 { |
| 1314 if (layer->stackingNode() != compositingAncestor) { | 1313 if (layer->stackingNode() != compositingAncestor) { |
| 1315 if (CompositedLayerMapping* compositedLayerMapping = layer->compositedLa
yerMapping()) { | 1314 if (layer->hasCompositedLayerMapping()) { |
| 1315 CompositedLayerMappingPtr compositedLayerMapping = layer->composited
LayerMapping(); |
| 1316 compositedLayerMapping->updateCompositedBounds(); | 1316 compositedLayerMapping->updateCompositedBounds(); |
| 1317 | 1317 |
| 1318 if (layer->reflectionInfo()) { | 1318 if (layer->reflectionInfo()) { |
| 1319 RenderLayer* reflectionLayer = layer->reflectionInfo()->reflecti
onLayer(); | 1319 RenderLayer* reflectionLayer = layer->reflectionInfo()->reflecti
onLayer(); |
| 1320 if (reflectionLayer->compositedLayerMapping()) | 1320 if (reflectionLayer->hasCompositedLayerMapping()) |
| 1321 reflectionLayer->compositedLayerMapping()->updateCompositedB
ounds(); | 1321 reflectionLayer->compositedLayerMapping()->updateCompositedB
ounds(); |
| 1322 } | 1322 } |
| 1323 | 1323 |
| 1324 compositedLayerMapping->updateGraphicsLayerGeometry(); | 1324 compositedLayerMapping->updateGraphicsLayerGeometry(); |
| 1325 if (compositedChildrenOnly) | 1325 if (compositedChildrenOnly) |
| 1326 return; | 1326 return; |
| 1327 } | 1327 } |
| 1328 } | 1328 } |
| 1329 | 1329 |
| 1330 if (layer->reflectionInfo()) | 1330 if (layer->reflectionInfo()) |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1411 | 1411 |
| 1412 detachRootLayer(); | 1412 detachRootLayer(); |
| 1413 } | 1413 } |
| 1414 } | 1414 } |
| 1415 | 1415 |
| 1416 void RenderLayerCompositor::clearMappingForRenderLayerIncludingDescendants(Rende
rLayer* layer) | 1416 void RenderLayerCompositor::clearMappingForRenderLayerIncludingDescendants(Rende
rLayer* layer) |
| 1417 { | 1417 { |
| 1418 if (!layer) | 1418 if (!layer) |
| 1419 return; | 1419 return; |
| 1420 | 1420 |
| 1421 if (layer->compositedLayerMapping()) { | 1421 if (layer->hasCompositedLayerMapping()) { |
| 1422 removeViewportConstrainedLayer(layer); | 1422 removeViewportConstrainedLayer(layer); |
| 1423 layer->clearCompositedLayerMapping(); | 1423 layer->clearCompositedLayerMapping(); |
| 1424 } | 1424 } |
| 1425 | 1425 |
| 1426 for (RenderLayer* currLayer = layer->firstChild(); currLayer; currLayer = cu
rrLayer->nextSibling()) | 1426 for (RenderLayer* currLayer = layer->firstChild(); currLayer; currLayer = cu
rrLayer->nextSibling()) |
| 1427 clearMappingForRenderLayerIncludingDescendants(currLayer); | 1427 clearMappingForRenderLayerIncludingDescendants(currLayer); |
| 1428 } | 1428 } |
| 1429 | 1429 |
| 1430 void RenderLayerCompositor::clearMappingForAllRenderLayers() | 1430 void RenderLayerCompositor::clearMappingForAllRenderLayers() |
| 1431 { | 1431 { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1523 return directReasons; | 1523 return directReasons; |
| 1524 } | 1524 } |
| 1525 | 1525 |
| 1526 // Return true if the given layer has some ancestor in the RenderLayer hierarchy
that clips, | 1526 // Return true if the given layer has some ancestor in the RenderLayer hierarchy
that clips, |
| 1527 // up to the enclosing compositing ancestor. This is required because compositin
g layers are parented | 1527 // up to the enclosing compositing ancestor. This is required because compositin
g layers are parented |
| 1528 // according to the z-order hierarchy, yet clipping goes down the renderer hiera
rchy. | 1528 // according to the z-order hierarchy, yet clipping goes down the renderer hiera
rchy. |
| 1529 // Thus, a RenderLayer can be clipped by a RenderLayer that is an ancestor in th
e renderer hierarchy, | 1529 // Thus, a RenderLayer can be clipped by a RenderLayer that is an ancestor in th
e renderer hierarchy, |
| 1530 // but a sibling in the z-order hierarchy. | 1530 // but a sibling in the z-order hierarchy. |
| 1531 bool RenderLayerCompositor::clippedByAncestor(const RenderLayer* layer) const | 1531 bool RenderLayerCompositor::clippedByAncestor(const RenderLayer* layer) const |
| 1532 { | 1532 { |
| 1533 if (!layer->compositedLayerMapping() || !layer->parent()) | 1533 if (!layer->hasCompositedLayerMapping() || !layer->parent()) |
| 1534 return false; | 1534 return false; |
| 1535 | 1535 |
| 1536 const RenderLayer* compositingAncestor = layer->ancestorCompositingLayer(); | 1536 const RenderLayer* compositingAncestor = layer->ancestorCompositingLayer(); |
| 1537 if (!compositingAncestor) | 1537 if (!compositingAncestor) |
| 1538 return false; | 1538 return false; |
| 1539 | 1539 |
| 1540 // If the compositingAncestor clips, that will be taken care of by clipsComp
ositingDescendants(), | 1540 // If the compositingAncestor clips, that will be taken care of by clipsComp
ositingDescendants(), |
| 1541 // so we only care about clipping between its first child that is our ancest
or (the computeClipRoot), | 1541 // so we only care about clipping between its first child that is our ancest
or (the computeClipRoot), |
| 1542 // and layer. | 1542 // and layer. |
| 1543 const RenderLayer* computeClipRoot = 0; | 1543 const RenderLayer* computeClipRoot = 0; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1628 bool composite = renderer->isEmbeddedObject() && toRenderEmbeddedObject(rend
erer)->allowsAcceleratedCompositing(); | 1628 bool composite = renderer->isEmbeddedObject() && toRenderEmbeddedObject(rend
erer)->allowsAcceleratedCompositing(); |
| 1629 if (!composite) | 1629 if (!composite) |
| 1630 return false; | 1630 return false; |
| 1631 | 1631 |
| 1632 // FIXME: this seems bogus. If we don't know the layout position/size of the
plugin yet, would't that be handled elsewhere? | 1632 // FIXME: this seems bogus. If we don't know the layout position/size of the
plugin yet, would't that be handled elsewhere? |
| 1633 m_needsToRecomputeCompositingRequirements = true; | 1633 m_needsToRecomputeCompositingRequirements = true; |
| 1634 | 1634 |
| 1635 RenderWidget* pluginRenderer = toRenderWidget(renderer); | 1635 RenderWidget* pluginRenderer = toRenderWidget(renderer); |
| 1636 // If we can't reliably know the size of the plugin yet, don't change compos
iting state. | 1636 // If we can't reliably know the size of the plugin yet, don't change compos
iting state. |
| 1637 if (pluginRenderer->needsLayout()) | 1637 if (pluginRenderer->needsLayout()) |
| 1638 return pluginRenderer->hasLayer() && pluginRenderer->layer()->composited
LayerMapping(); | 1638 return pluginRenderer->hasLayer() && pluginRenderer->layer()->hasComposi
tedLayerMapping(); |
| 1639 | 1639 |
| 1640 // Don't go into compositing mode if height or width are zero, or size is 1x
1. | 1640 // Don't go into compositing mode if height or width are zero, or size is 1x
1. |
| 1641 IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect()); | 1641 IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect()); |
| 1642 return contentBox.height() * contentBox.width() > 1; | 1642 return contentBox.height() * contentBox.width() > 1; |
| 1643 } | 1643 } |
| 1644 | 1644 |
| 1645 bool RenderLayerCompositor::requiresCompositingForFrame(RenderObject* renderer)
const | 1645 bool RenderLayerCompositor::requiresCompositingForFrame(RenderObject* renderer)
const |
| 1646 { | 1646 { |
| 1647 if (!renderer->isRenderPart()) | 1647 if (!renderer->isRenderPart()) |
| 1648 return false; | 1648 return false; |
| 1649 | 1649 |
| 1650 RenderPart* frameRenderer = toRenderPart(renderer); | 1650 RenderPart* frameRenderer = toRenderPart(renderer); |
| 1651 | 1651 |
| 1652 if (!frameRenderer->requiresAcceleratedCompositing()) | 1652 if (!frameRenderer->requiresAcceleratedCompositing()) |
| 1653 return false; | 1653 return false; |
| 1654 | 1654 |
| 1655 // FIXME: this seems bogus. If we don't know the layout position/size of the
frame yet, wouldn't that be handled elsehwere? | 1655 // FIXME: this seems bogus. If we don't know the layout position/size of the
frame yet, wouldn't that be handled elsehwere? |
| 1656 m_needsToRecomputeCompositingRequirements = true; | 1656 m_needsToRecomputeCompositingRequirements = true; |
| 1657 | 1657 |
| 1658 RenderLayerCompositor* innerCompositor = frameContentsCompositor(frameRender
er); | 1658 RenderLayerCompositor* innerCompositor = frameContentsCompositor(frameRender
er); |
| 1659 if (!innerCompositor) | 1659 if (!innerCompositor) |
| 1660 return false; | 1660 return false; |
| 1661 | 1661 |
| 1662 // If we can't reliably know the size of the iframe yet, don't change compos
iting state. | 1662 // If we can't reliably know the size of the iframe yet, don't change compos
iting state. |
| 1663 if (renderer->needsLayout()) | 1663 if (renderer->needsLayout()) |
| 1664 return frameRenderer->hasLayer() && frameRenderer->layer()->compositedLa
yerMapping(); | 1664 return frameRenderer->hasLayer() && frameRenderer->layer()->hasComposite
dLayerMapping(); |
| 1665 | 1665 |
| 1666 // Don't go into compositing mode if height or width are zero. | 1666 // Don't go into compositing mode if height or width are zero. |
| 1667 IntRect contentBox = pixelSnappedIntRect(frameRenderer->contentBoxRect()); | 1667 IntRect contentBox = pixelSnappedIntRect(frameRenderer->contentBoxRect()); |
| 1668 return contentBox.height() * contentBox.width() > 0; | 1668 return contentBox.height() * contentBox.width() > 0; |
| 1669 } | 1669 } |
| 1670 | 1670 |
| 1671 bool RenderLayerCompositor::requiresCompositingForBackfaceVisibilityHidden(Rende
rObject* renderer) const | 1671 bool RenderLayerCompositor::requiresCompositingForBackfaceVisibilityHidden(Rende
rObject* renderer) const |
| 1672 { | 1672 { |
| 1673 return canRender3DTransforms() && renderer->style()->backfaceVisibility() ==
BackfaceVisibilityHidden; | 1673 return canRender3DTransforms() && renderer->style()->backfaceVisibility() ==
BackfaceVisibilityHidden; |
| 1674 } | 1674 } |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1821 | 1821 |
| 1822 if (!hasScrollableAncestor) { | 1822 if (!hasScrollableAncestor) { |
| 1823 if (viewportConstrainedNotCompositedReason) | 1823 if (viewportConstrainedNotCompositedReason) |
| 1824 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
ForUnscrollableAncestors; | 1824 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
ForUnscrollableAncestors; |
| 1825 return false; | 1825 return false; |
| 1826 } | 1826 } |
| 1827 | 1827 |
| 1828 // Subsequent tests depend on layout. If we can't tell now, just keep things
the way they are until layout is done. | 1828 // Subsequent tests depend on layout. If we can't tell now, just keep things
the way they are until layout is done. |
| 1829 if (!m_inPostLayoutUpdate) { | 1829 if (!m_inPostLayoutUpdate) { |
| 1830 m_needsToRecomputeCompositingRequirements = true; | 1830 m_needsToRecomputeCompositingRequirements = true; |
| 1831 return layer->compositedLayerMapping(); | 1831 return layer->hasCompositedLayerMapping(); |
| 1832 } | 1832 } |
| 1833 | 1833 |
| 1834 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend
ant(); | 1834 bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend
ant(); |
| 1835 if (!paintsContent) { | 1835 if (!paintsContent) { |
| 1836 if (viewportConstrainedNotCompositedReason) | 1836 if (viewportConstrainedNotCompositedReason) |
| 1837 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
ForNoVisibleContent; | 1837 *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
ForNoVisibleContent; |
| 1838 return false; | 1838 return false; |
| 1839 } | 1839 } |
| 1840 | 1840 |
| 1841 // Fixed position elements that are invisible in the current view don't get
their own layer. | 1841 // Fixed position elements that are invisible in the current view don't get
their own layer. |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2308 | 2308 |
| 2309 static bool isRootmostFixedOrStickyLayer(RenderLayer* layer) | 2309 static bool isRootmostFixedOrStickyLayer(RenderLayer* layer) |
| 2310 { | 2310 { |
| 2311 if (layer->renderer()->isStickyPositioned()) | 2311 if (layer->renderer()->isStickyPositioned()) |
| 2312 return true; | 2312 return true; |
| 2313 | 2313 |
| 2314 if (layer->renderer()->style()->position() != FixedPosition) | 2314 if (layer->renderer()->style()->position() != FixedPosition) |
| 2315 return false; | 2315 return false; |
| 2316 | 2316 |
| 2317 for (RenderLayerStackingNode* stackingContainerNode = layer->stackingNode()-
>ancestorStackingContainerNode(); stackingContainerNode; stackingContainerNode =
stackingContainerNode->ancestorStackingContainerNode()) { | 2317 for (RenderLayerStackingNode* stackingContainerNode = layer->stackingNode()-
>ancestorStackingContainerNode(); stackingContainerNode; stackingContainerNode =
stackingContainerNode->ancestorStackingContainerNode()) { |
| 2318 if (stackingContainerNode->layer()->compositedLayerMapping() && stacking
ContainerNode->layer()->renderer()->style()->position() == FixedPosition) | 2318 if (stackingContainerNode->layer()->hasCompositedLayerMapping() && stack
ingContainerNode->layer()->renderer()->style()->position() == FixedPosition) |
| 2319 return false; | 2319 return false; |
| 2320 } | 2320 } |
| 2321 | 2321 |
| 2322 return true; | 2322 return true; |
| 2323 } | 2323 } |
| 2324 | 2324 |
| 2325 void RenderLayerCompositor::updateViewportConstraintStatus(RenderLayer* layer) | 2325 void RenderLayerCompositor::updateViewportConstraintStatus(RenderLayer* layer) |
| 2326 { | 2326 { |
| 2327 if (isRootmostFixedOrStickyLayer(layer)) | 2327 if (isRootmostFixedOrStickyLayer(layer)) |
| 2328 addViewportConstrainedLayer(layer); | 2328 addViewportConstrainedLayer(layer); |
| 2329 else | 2329 else |
| 2330 removeViewportConstrainedLayer(layer); | 2330 removeViewportConstrainedLayer(layer); |
| 2331 } | 2331 } |
| 2332 | 2332 |
| 2333 void RenderLayerCompositor::addViewportConstrainedLayer(RenderLayer* layer) | 2333 void RenderLayerCompositor::addViewportConstrainedLayer(RenderLayer* layer) |
| 2334 { | 2334 { |
| 2335 m_viewportConstrainedLayers.add(layer); | 2335 m_viewportConstrainedLayers.add(layer); |
| 2336 } | 2336 } |
| 2337 | 2337 |
| 2338 void RenderLayerCompositor::removeViewportConstrainedLayer(RenderLayer* layer) | 2338 void RenderLayerCompositor::removeViewportConstrainedLayer(RenderLayer* layer) |
| 2339 { | 2339 { |
| 2340 if (!m_viewportConstrainedLayers.contains(layer)) | 2340 if (!m_viewportConstrainedLayers.contains(layer)) |
| 2341 return; | 2341 return; |
| 2342 | 2342 |
| 2343 m_viewportConstrainedLayers.remove(layer); | 2343 m_viewportConstrainedLayers.remove(layer); |
| 2344 } | 2344 } |
| 2345 | 2345 |
| 2346 FixedPositionViewportConstraints RenderLayerCompositor::computeFixedViewportCons
traints(RenderLayer* layer) const | 2346 FixedPositionViewportConstraints RenderLayerCompositor::computeFixedViewportCons
traints(RenderLayer* layer) const |
| 2347 { | 2347 { |
| 2348 ASSERT(layer->compositedLayerMapping()); | 2348 ASSERT(layer->hasCompositedLayerMapping()); |
| 2349 | 2349 |
| 2350 FrameView* frameView = m_renderView->frameView(); | 2350 FrameView* frameView = m_renderView->frameView(); |
| 2351 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect()
; | 2351 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect()
; |
| 2352 | 2352 |
| 2353 FixedPositionViewportConstraints constraints; | 2353 FixedPositionViewportConstraints constraints; |
| 2354 | 2354 |
| 2355 GraphicsLayer* graphicsLayer = layer->compositedLayerMapping()->mainGraphics
Layer(); | 2355 GraphicsLayer* graphicsLayer = layer->compositedLayerMapping()->mainGraphics
Layer(); |
| 2356 | 2356 |
| 2357 constraints.setLayerPositionAtLastLayout(graphicsLayer->position()); | 2357 constraints.setLayerPositionAtLastLayout(graphicsLayer->position()); |
| 2358 constraints.setViewportRectAtLastLayout(viewportRect); | 2358 constraints.setViewportRectAtLastLayout(viewportRect); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2376 | 2376 |
| 2377 // If top and bottom are auto, use top. | 2377 // If top and bottom are auto, use top. |
| 2378 if (style->top().isAuto() && style->bottom().isAuto()) | 2378 if (style->top().isAuto() && style->bottom().isAuto()) |
| 2379 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeTop); | 2379 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeTop); |
| 2380 | 2380 |
| 2381 return constraints; | 2381 return constraints; |
| 2382 } | 2382 } |
| 2383 | 2383 |
| 2384 StickyPositionViewportConstraints RenderLayerCompositor::computeStickyViewportCo
nstraints(RenderLayer* layer) const | 2384 StickyPositionViewportConstraints RenderLayerCompositor::computeStickyViewportCo
nstraints(RenderLayer* layer) const |
| 2385 { | 2385 { |
| 2386 ASSERT(layer->compositedLayerMapping()); | 2386 ASSERT(layer->hasCompositedLayerMapping()); |
| 2387 | 2387 |
| 2388 FrameView* frameView = m_renderView->frameView(); | 2388 FrameView* frameView = m_renderView->frameView(); |
| 2389 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect()
; | 2389 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect()
; |
| 2390 | 2390 |
| 2391 StickyPositionViewportConstraints constraints; | 2391 StickyPositionViewportConstraints constraints; |
| 2392 | 2392 |
| 2393 RenderBoxModelObject* renderer = toRenderBoxModelObject(layer->renderer()); | 2393 RenderBoxModelObject* renderer = toRenderBoxModelObject(layer->renderer()); |
| 2394 | 2394 |
| 2395 renderer->computeStickyPositionConstraints(constraints, viewportRect); | 2395 renderer->computeStickyPositionConstraints(constraints, viewportRect); |
| 2396 | 2396 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2444 } else if (graphicsLayer == m_scrollLayer.get()) { | 2444 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 2445 name = "Frame Scrolling Layer"; | 2445 name = "Frame Scrolling Layer"; |
| 2446 } else { | 2446 } else { |
| 2447 ASSERT_NOT_REACHED(); | 2447 ASSERT_NOT_REACHED(); |
| 2448 } | 2448 } |
| 2449 | 2449 |
| 2450 return name; | 2450 return name; |
| 2451 } | 2451 } |
| 2452 | 2452 |
| 2453 } // namespace WebCore | 2453 } // namespace WebCore |
| OLD | NEW |