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