OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 IntRect relativeCompositingBounds; | 703 IntRect relativeCompositingBounds; |
704 LayoutPoint offsetFromCompositedAncestor; | 704 LayoutPoint offsetFromCompositedAncestor; |
705 IntPoint snappedOffsetFromCompositedAncestor; | 705 IntPoint snappedOffsetFromCompositedAncestor; |
706 computeBoundsOfOwningLayer(compositingContainer, localCompositingBounds, rel
ativeCompositingBounds, offsetFromCompositedAncestor, snappedOffsetFromComposite
dAncestor); | 706 computeBoundsOfOwningLayer(compositingContainer, localCompositingBounds, rel
ativeCompositingBounds, offsetFromCompositedAncestor, snappedOffsetFromComposite
dAncestor); |
707 | 707 |
708 IntPoint graphicsLayerParentLocation; | 708 IntPoint graphicsLayerParentLocation; |
709 computeGraphicsLayerParentLocation(compositingContainer, ancestorCompositing
Bounds, graphicsLayerParentLocation); | 709 computeGraphicsLayerParentLocation(compositingContainer, ancestorCompositing
Bounds, graphicsLayerParentLocation); |
710 | 710 |
711 // Might update graphicsLayerParentLocation. | 711 // Might update graphicsLayerParentLocation. |
712 updateAncestorClippingLayerGeometry(compositingContainer, snappedOffsetFromC
ompositedAncestor, graphicsLayerParentLocation); | 712 updateAncestorClippingLayerGeometry(compositingContainer, snappedOffsetFromC
ompositedAncestor, graphicsLayerParentLocation); |
713 updateOverflowControlsHostLayerGeometry(compositingStackingContext, composit
ingContainer); | |
714 | 713 |
715 FloatSize contentsSize(relativeCompositingBounds.size()); | 714 FloatSize contentsSize(relativeCompositingBounds.size()); |
716 | 715 |
717 updateMainGraphicsLayerGeometry(relativeCompositingBounds, localCompositingB
ounds, graphicsLayerParentLocation); | 716 updateMainGraphicsLayerGeometry(relativeCompositingBounds, localCompositingB
ounds, graphicsLayerParentLocation); |
| 717 updateOverflowControlsHostLayerGeometry(compositingStackingContext, composit
ingContainer); |
718 updateContentsOffsetInCompositingLayer(snappedOffsetFromCompositedAncestor,
graphicsLayerParentLocation); | 718 updateContentsOffsetInCompositingLayer(snappedOffsetFromCompositedAncestor,
graphicsLayerParentLocation); |
719 updateSquashingLayerGeometry(offsetFromCompositedAncestor, graphicsLayerPare
ntLocation, m_owningLayer, m_squashedLayers, m_squashingLayer.get(), &m_squashin
gLayerOffsetFromTransformedAncestor, layersNeedingPaintInvalidation); | 719 updateSquashingLayerGeometry(offsetFromCompositedAncestor, graphicsLayerPare
ntLocation, m_owningLayer, m_squashedLayers, m_squashingLayer.get(), &m_squashin
gLayerOffsetFromTransformedAncestor, layersNeedingPaintInvalidation); |
720 | 720 |
721 // If we have a layer that clips children, position it. | 721 // If we have a layer that clips children, position it. |
722 IntRect clippingBox; | 722 IntRect clippingBox; |
723 if (m_childContainmentLayer) | 723 if (m_childContainmentLayer) |
724 clippingBox = clipBox(toLayoutBox(layoutObject())); | 724 clippingBox = clipBox(toLayoutBox(layoutObject())); |
725 | 725 |
726 updateChildTransformLayerGeometry(); | 726 updateChildTransformLayerGeometry(); |
727 updateChildContainmentLayerGeometry(clippingBox, localCompositingBounds); | 727 updateChildContainmentLayerGeometry(clippingBox, localCompositingBounds); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 | 822 |
823 // The primary layer is then parented in, and positioned relative to this cl
ipping layer. | 823 // The primary layer is then parented in, and positioned relative to this cl
ipping layer. |
824 graphicsLayerParentLocation = parentClipRect.location(); | 824 graphicsLayerParentLocation = parentClipRect.location(); |
825 } | 825 } |
826 | 826 |
827 void CompositedLayerMapping::updateOverflowControlsHostLayerGeometry(const Paint
Layer* compositingStackingContext, const PaintLayer* compositingContainer) | 827 void CompositedLayerMapping::updateOverflowControlsHostLayerGeometry(const Paint
Layer* compositingStackingContext, const PaintLayer* compositingContainer) |
828 { | 828 { |
829 if (!m_overflowControlsHostLayer) | 829 if (!m_overflowControlsHostLayer) |
830 return; | 830 return; |
831 | 831 |
| 832 LayoutPoint hostLayerPosition; |
| 833 |
832 if (needsToReparentOverflowControls()) { | 834 if (needsToReparentOverflowControls()) { |
833 if (m_overflowControlsClippingLayer) { | 835 if (m_overflowControlsAncestorClippingLayer) { |
834 m_overflowControlsClippingLayer->setSize(m_ancestorClippingLayer->si
ze()); | 836 m_overflowControlsAncestorClippingLayer->setSize(m_ancestorClippingL
ayer->size()); |
835 m_overflowControlsClippingLayer->setOffsetFromLayoutObject(m_ancesto
rClippingLayer->offsetFromLayoutObject()); | 837 m_overflowControlsAncestorClippingLayer->setOffsetFromLayoutObject(m
_ancestorClippingLayer->offsetFromLayoutObject()); |
836 m_overflowControlsClippingLayer->setMasksToBounds(true); | 838 m_overflowControlsAncestorClippingLayer->setMasksToBounds(true); |
837 m_overflowControlsHostLayer->setPosition(IntPoint(-m_overflowControl
sClippingLayer->offsetFromLayoutObject())); | 839 hostLayerPosition = toLayoutPoint(LayoutSize(-m_overflowControlsAnce
storClippingLayer->offsetFromLayoutObject())); |
838 | 840 |
839 FloatPoint position = m_ancestorClippingLayer->position(); | 841 FloatPoint position = m_ancestorClippingLayer->position(); |
840 if (compositingStackingContext != compositingContainer) { | 842 if (compositingStackingContext != compositingContainer) { |
841 LayoutPoint offset; | 843 LayoutPoint offset; |
842 compositingContainer->convertToLayerCoords(compositingStackingCo
ntext, offset); | 844 compositingContainer->convertToLayerCoords(compositingStackingCo
ntext, offset); |
843 FloatSize offsetFromStackingContainer = toFloatSize(FloatPoint(o
ffset)); | 845 FloatSize offsetFromStackingContainer = toFloatSize(FloatPoint(o
ffset)); |
844 position += offsetFromStackingContainer; | 846 position += offsetFromStackingContainer; |
845 } | 847 } |
846 | 848 |
847 m_overflowControlsClippingLayer->setPosition(position); | 849 m_overflowControlsAncestorClippingLayer->setPosition(position); |
848 } else { | 850 } else { |
849 // The controls are in the same 2D space as the compositing containe
r, so we can map them into the space of the container. | 851 // The controls are in the same 2D space as the compositing containe
r, so we can map them into the space of the container. |
850 TransformState transformState(TransformState::ApplyTransformDirectio
n, FloatPoint()); | 852 TransformState transformState(TransformState::ApplyTransformDirectio
n, FloatPoint()); |
851 m_owningLayer.layoutObject()->mapLocalToContainer(compositingStackin
gContext->layoutObject(), transformState, ApplyContainerFlip); | 853 m_owningLayer.layoutObject()->mapLocalToContainer(compositingStackin
gContext->layoutObject(), transformState, ApplyContainerFlip); |
852 transformState.flatten(); | 854 transformState.flatten(); |
853 LayoutPoint offsetFromStackingContainer = LayoutPoint(transformState
.lastPlanarPoint()); | 855 hostLayerPosition = LayoutPoint(transformState.lastPlanarPoint()); |
854 if (PaintLayerScrollableArea* scrollableArea = compositingStackingCo
ntext->scrollableArea()) | 856 if (PaintLayerScrollableArea* scrollableArea = compositingStackingCo
ntext->scrollableArea()) |
855 offsetFromStackingContainer.move(LayoutSize(scrollableArea->adju
stedScrollOffset())); | 857 hostLayerPosition.move(LayoutSize(scrollableArea->adjustedScroll
Offset())); |
856 m_overflowControlsHostLayer->setPosition(FloatPoint(offsetFromStacki
ngContainer)); | |
857 } | 858 } |
858 } else { | |
859 m_overflowControlsHostLayer->setPosition(FloatPoint()); | |
860 } | 859 } |
| 860 |
| 861 IntSize offsetFromLayoutObject = m_graphicsLayer->offsetFromLayoutObject() -
roundedIntSize(m_owningLayer.subpixelAccumulation()); |
| 862 hostLayerPosition.move(-offsetFromLayoutObject); |
| 863 m_overflowControlsHostLayer->setPosition(FloatPoint(hostLayerPosition)); |
| 864 |
| 865 const IntRect borderBox = toLayoutBox(m_owningLayer.layoutObject())->pixelSn
appedBorderBoxRect(); |
| 866 m_overflowControlsHostLayer->setSize(FloatSize(borderBox.size())); |
| 867 m_overflowControlsHostLayer->setMasksToBounds(true); |
861 } | 868 } |
862 | 869 |
863 void CompositedLayerMapping::updateChildContainmentLayerGeometry(const IntRect&
clippingBox, const IntRect& localCompositingBounds) | 870 void CompositedLayerMapping::updateChildContainmentLayerGeometry(const IntRect&
clippingBox, const IntRect& localCompositingBounds) |
864 { | 871 { |
865 if (!m_childContainmentLayer) | 872 if (!m_childContainmentLayer) |
866 return; | 873 return; |
867 | 874 |
868 FloatPoint clipPositionInLayoutObjectSpace(clippingBox.location() - localCom
positingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation())
); | 875 FloatPoint clipPositionInLayoutObjectSpace(clippingBox.location() - localCom
positingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation())
); |
869 | 876 |
870 // If there are layers between the the child containment layer and | 877 // If there are layers between the the child containment layer and |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 }; | 1104 }; |
1098 | 1105 |
1099 updateBottomLayer(m_childTransformLayer.get()); | 1106 updateBottomLayer(m_childTransformLayer.get()); |
1100 updateBottomLayer(m_childContainmentLayer.get()); | 1107 updateBottomLayer(m_childContainmentLayer.get()); |
1101 updateBottomLayer(m_scrollingLayer.get()); | 1108 updateBottomLayer(m_scrollingLayer.get()); |
1102 | 1109 |
1103 // Now constructing the subtree for the overflow controls. | 1110 // Now constructing the subtree for the overflow controls. |
1104 bottomLayer = m_graphicsLayer.get(); | 1111 bottomLayer = m_graphicsLayer.get(); |
1105 if (m_isMainFrameLayoutViewLayer) | 1112 if (m_isMainFrameLayoutViewLayer) |
1106 bottomLayer = layoutObject()->frame()->page()->frameHost().visualViewpor
t().containerLayer(); | 1113 bottomLayer = layoutObject()->frame()->page()->frameHost().visualViewpor
t().containerLayer(); |
1107 updateBottomLayer(m_overflowControlsClippingLayer.get()); | 1114 updateBottomLayer(m_overflowControlsAncestorClippingLayer.get()); |
1108 updateBottomLayer(m_overflowControlsHostLayer.get()); | 1115 updateBottomLayer(m_overflowControlsHostLayer.get()); |
1109 if (m_layerForHorizontalScrollbar) | 1116 if (m_layerForHorizontalScrollbar) |
1110 m_overflowControlsHostLayer->addChild(m_layerForHorizontalScrollbar.get(
)); | 1117 m_overflowControlsHostLayer->addChild(m_layerForHorizontalScrollbar.get(
)); |
1111 if (m_layerForVerticalScrollbar) | 1118 if (m_layerForVerticalScrollbar) |
1112 m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.get())
; | 1119 m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.get())
; |
1113 if (m_layerForScrollCorner) | 1120 if (m_layerForScrollCorner) |
1114 m_overflowControlsHostLayer->addChild(m_layerForScrollCorner.get()); | 1121 m_overflowControlsHostLayer->addChild(m_layerForScrollCorner.get()); |
1115 | 1122 |
1116 // The squashing containment layer, if it exists, becomes a no-op parent. | 1123 // The squashing containment layer, if it exists, becomes a no-op parent. |
1117 if (m_squashingLayer) { | 1124 if (m_squashingLayer) { |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 needsHorizontalScrollbarLayer &= !invisible; | 1345 needsHorizontalScrollbarLayer &= !invisible; |
1339 needsVerticalScrollbarLayer &= !invisible; | 1346 needsVerticalScrollbarLayer &= !invisible; |
1340 needsScrollCornerLayer &= !invisible; | 1347 needsScrollCornerLayer &= !invisible; |
1341 | 1348 |
1342 bool horizontalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerF
orHorizontalScrollbar, needsHorizontalScrollbarLayer, CompositingReasonLayerForH
orizontalScrollbar); | 1349 bool horizontalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerF
orHorizontalScrollbar, needsHorizontalScrollbarLayer, CompositingReasonLayerForH
orizontalScrollbar); |
1343 bool verticalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerFor
VerticalScrollbar, needsVerticalScrollbarLayer, CompositingReasonLayerForVertica
lScrollbar); | 1350 bool verticalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerFor
VerticalScrollbar, needsVerticalScrollbarLayer, CompositingReasonLayerForVertica
lScrollbar); |
1344 bool scrollCornerLayerChanged = toggleScrollbarLayerIfNeeded(m_layerForScrol
lCorner, needsScrollCornerLayer, CompositingReasonLayerForScrollCorner); | 1351 bool scrollCornerLayerChanged = toggleScrollbarLayerIfNeeded(m_layerForScrol
lCorner, needsScrollCornerLayer, CompositingReasonLayerForScrollCorner); |
1345 | 1352 |
1346 bool needsOverflowControlsHostLayer = needsHorizontalScrollbarLayer || needs
VerticalScrollbarLayer || needsScrollCornerLayer; | 1353 bool needsOverflowControlsHostLayer = needsHorizontalScrollbarLayer || needs
VerticalScrollbarLayer || needsScrollCornerLayer; |
1347 toggleScrollbarLayerIfNeeded(m_overflowControlsHostLayer, needsOverflowContr
olsHostLayer, CompositingReasonLayerForOverflowControlsHost); | 1354 toggleScrollbarLayerIfNeeded(m_overflowControlsHostLayer, needsOverflowContr
olsHostLayer, CompositingReasonLayerForOverflowControlsHost); |
1348 bool needsOverflowClipLayer = needsOverflowControlsHostLayer && needsAncesto
rClip; | 1355 bool needsOverflowAncestorClipLayer = needsOverflowControlsHostLayer && need
sAncestorClip; |
1349 toggleScrollbarLayerIfNeeded(m_overflowControlsClippingLayer, needsOverflowC
lipLayer, CompositingReasonLayerForOverflowControlsHost); | 1356 toggleScrollbarLayerIfNeeded(m_overflowControlsAncestorClippingLayer, needsO
verflowAncestorClipLayer, CompositingReasonLayerForOverflowControlsHost); |
1350 | 1357 |
1351 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay
er(m_owningLayer)) { | 1358 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay
er(m_owningLayer)) { |
1352 if (horizontalScrollbarLayerChanged) | 1359 if (horizontalScrollbarLayerChanged) |
1353 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning
Layer.scrollableArea(), HorizontalScrollbar); | 1360 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning
Layer.scrollableArea(), HorizontalScrollbar); |
1354 if (verticalScrollbarLayerChanged) | 1361 if (verticalScrollbarLayerChanged) |
1355 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning
Layer.scrollableArea(), VerticalScrollbar); | 1362 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning
Layer.scrollableArea(), VerticalScrollbar); |
1356 } | 1363 } |
1357 | 1364 |
1358 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || s
crollCornerLayerChanged; | 1365 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || s
crollCornerLayerChanged; |
1359 } | 1366 } |
1360 | 1367 |
1361 void CompositedLayerMapping::positionOverflowControlsLayers() | 1368 void CompositedLayerMapping::positionOverflowControlsLayers() |
1362 { | 1369 { |
1363 IntSize offsetFromLayoutObject = m_graphicsLayer->offsetFromLayoutObject() -
roundedIntSize(m_owningLayer.subpixelAccumulation()); | |
1364 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) { | 1370 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) { |
1365 Scrollbar* hBar = m_owningLayer.scrollableArea()->horizontalScrollbar(); | 1371 Scrollbar* hBar = m_owningLayer.scrollableArea()->horizontalScrollbar(); |
1366 if (hBar) { | 1372 if (hBar) { |
1367 layer->setPosition(hBar->frameRect().location() - offsetFromLayoutOb
ject); | 1373 layer->setPosition(hBar->frameRect().location()); |
1368 layer->setSize(FloatSize(hBar->frameRect().size())); | 1374 layer->setSize(FloatSize(hBar->frameRect().size())); |
1369 if (layer->hasContentsLayer()) | 1375 if (layer->hasContentsLayer()) |
1370 layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().siz
e())); | 1376 layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().siz
e())); |
1371 } | 1377 } |
1372 layer->setDrawsContent(hBar && !layer->hasContentsLayer()); | 1378 layer->setDrawsContent(hBar && !layer->hasContentsLayer()); |
1373 } | 1379 } |
1374 | 1380 |
1375 if (GraphicsLayer* layer = layerForVerticalScrollbar()) { | 1381 if (GraphicsLayer* layer = layerForVerticalScrollbar()) { |
1376 Scrollbar* vBar = m_owningLayer.scrollableArea()->verticalScrollbar(); | 1382 Scrollbar* vBar = m_owningLayer.scrollableArea()->verticalScrollbar(); |
1377 if (vBar) { | 1383 if (vBar) { |
1378 layer->setPosition(vBar->frameRect().location() - offsetFromLayoutOb
ject); | 1384 layer->setPosition(vBar->frameRect().location()); |
1379 layer->setSize(FloatSize(vBar->frameRect().size())); | 1385 layer->setSize(FloatSize(vBar->frameRect().size())); |
1380 if (layer->hasContentsLayer()) | 1386 if (layer->hasContentsLayer()) |
1381 layer->setContentsRect(IntRect(IntPoint(), vBar->frameRect().siz
e())); | 1387 layer->setContentsRect(IntRect(IntPoint(), vBar->frameRect().siz
e())); |
1382 } | 1388 } |
1383 layer->setDrawsContent(vBar && !layer->hasContentsLayer()); | 1389 layer->setDrawsContent(vBar && !layer->hasContentsLayer()); |
1384 } | 1390 } |
1385 | 1391 |
1386 if (GraphicsLayer* layer = layerForScrollCorner()) { | 1392 if (GraphicsLayer* layer = layerForScrollCorner()) { |
1387 const IntRect& scrollCornerAndResizer = m_owningLayer.scrollableArea()->
scrollCornerAndResizerRect(); | 1393 const IntRect& scrollCornerAndResizer = m_owningLayer.scrollableArea()->
scrollCornerAndResizerRect(); |
1388 layer->setPosition(FloatPoint(scrollCornerAndResizer.location() - offset
FromLayoutObject)); | 1394 layer->setPosition(FloatPoint(scrollCornerAndResizer.location())); |
1389 layer->setSize(FloatSize(scrollCornerAndResizer.size())); | 1395 layer->setSize(FloatSize(scrollCornerAndResizer.size())); |
1390 layer->setDrawsContent(!scrollCornerAndResizer.isEmpty()); | 1396 layer->setDrawsContent(!scrollCornerAndResizer.isEmpty()); |
1391 } | 1397 } |
1392 } | 1398 } |
1393 | 1399 |
1394 enum ApplyToGraphicsLayersModeFlags { | 1400 enum ApplyToGraphicsLayersModeFlags { |
1395 ApplyToLayersAffectedByPreserve3D = (1 << 0), | 1401 ApplyToLayersAffectedByPreserve3D = (1 << 0), |
1396 ApplyToSquashingLayer = (1 << 1), | 1402 ApplyToSquashingLayer = (1 << 1), |
1397 ApplyToScrollbarLayers = (1 << 2), | 1403 ApplyToScrollbarLayers = (1 << 2), |
1398 ApplyToBackgroundLayer = (1 << 3), | 1404 ApplyToBackgroundLayer = (1 << 3), |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1953 | 1959 |
1954 bool CompositedLayerMapping::needsToReparentOverflowControls() const | 1960 bool CompositedLayerMapping::needsToReparentOverflowControls() const |
1955 { | 1961 { |
1956 return m_owningLayer.scrollableArea() | 1962 return m_owningLayer.scrollableArea() |
1957 && m_owningLayer.scrollableArea()->hasOverlayScrollbars() | 1963 && m_owningLayer.scrollableArea()->hasOverlayScrollbars() |
1958 && m_owningLayer.scrollableArea()->topmostScrollChild(); | 1964 && m_owningLayer.scrollableArea()->topmostScrollChild(); |
1959 } | 1965 } |
1960 | 1966 |
1961 GraphicsLayer* CompositedLayerMapping::detachLayerForOverflowControls(const Pain
tLayer& enclosingLayer) | 1967 GraphicsLayer* CompositedLayerMapping::detachLayerForOverflowControls(const Pain
tLayer& enclosingLayer) |
1962 { | 1968 { |
1963 GraphicsLayer* host = m_overflowControlsClippingLayer.get(); | 1969 GraphicsLayer* host = m_overflowControlsAncestorClippingLayer.get(); |
1964 if (!host) | 1970 if (!host) |
1965 host = m_overflowControlsHostLayer.get(); | 1971 host = m_overflowControlsHostLayer.get(); |
1966 host->removeFromParent(); | 1972 host->removeFromParent(); |
1967 return host; | 1973 return host; |
1968 } | 1974 } |
1969 | 1975 |
1970 GraphicsLayer* CompositedLayerMapping::parentForSublayers() const | 1976 GraphicsLayer* CompositedLayerMapping::parentForSublayers() const |
1971 { | 1977 { |
1972 if (m_scrollingBlockSelectionLayer) | 1978 if (m_scrollingBlockSelectionLayer) |
1973 return m_scrollingBlockSelectionLayer.get(); | 1979 return m_scrollingBlockSelectionLayer.get(); |
1974 | 1980 |
1975 if (m_scrollingContentsLayer) | 1981 if (m_scrollingContentsLayer) |
1976 return m_scrollingContentsLayer.get(); | 1982 return m_scrollingContentsLayer.get(); |
1977 | 1983 |
1978 if (m_childContainmentLayer) | 1984 if (m_childContainmentLayer) |
1979 return m_childContainmentLayer.get(); | 1985 return m_childContainmentLayer.get(); |
1980 | 1986 |
1981 if (m_childTransformLayer) | 1987 if (m_childTransformLayer) |
1982 return m_childTransformLayer.get(); | 1988 return m_childTransformLayer.get(); |
1983 | 1989 |
1984 return m_graphicsLayer.get(); | 1990 return m_graphicsLayer.get(); |
1985 } | 1991 } |
1986 | 1992 |
| 1993 void CompositedLayerMapping::setSublayers(const GraphicsLayerVector& sublayers) |
| 1994 { |
| 1995 GraphicsLayer* overflowControlsContainer = m_overflowControlsAncestorClippin
gLayer |
| 1996 ? m_overflowControlsAncestorClippingLayer.get() |
| 1997 : m_overflowControlsHostLayer.get(); |
| 1998 GraphicsLayer* parent = parentForSublayers(); |
| 1999 bool needsOverflowControlsReattached = overflowControlsContainer && overflow
ControlsContainer->parent() == parent; |
| 2000 |
| 2001 parent->setChildren(sublayers); |
| 2002 |
| 2003 // If we have scrollbars, but are not using composited scrolling, then paren
tForSublayers may return m_graphicsLayer. |
| 2004 // In that case, the above call to setChildren has clobbered the overflow co
ntrols host layer, so we need to reattach it. |
| 2005 if (needsOverflowControlsReattached) |
| 2006 parent->addChild(overflowControlsContainer); |
| 2007 } |
| 2008 |
1987 GraphicsLayer* CompositedLayerMapping::childForSuperlayers() const | 2009 GraphicsLayer* CompositedLayerMapping::childForSuperlayers() const |
1988 { | 2010 { |
1989 if (m_squashingContainmentLayer) | 2011 if (m_squashingContainmentLayer) |
1990 return m_squashingContainmentLayer.get(); | 2012 return m_squashingContainmentLayer.get(); |
1991 | 2013 |
1992 if (m_ancestorClippingLayer) | 2014 if (m_ancestorClippingLayer) |
1993 return m_ancestorClippingLayer.get(); | 2015 return m_ancestorClippingLayer.get(); |
1994 | 2016 |
1995 return m_graphicsLayer.get(); | 2017 return m_graphicsLayer.get(); |
1996 } | 2018 } |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2498 } else if (graphicsLayer == m_childClippingMaskLayer.get()) { | 2520 } else if (graphicsLayer == m_childClippingMaskLayer.get()) { |
2499 name = "Child Clipping Mask Layer"; | 2521 name = "Child Clipping Mask Layer"; |
2500 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) { | 2522 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) { |
2501 name = "Horizontal Scrollbar Layer"; | 2523 name = "Horizontal Scrollbar Layer"; |
2502 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) { | 2524 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) { |
2503 name = "Vertical Scrollbar Layer"; | 2525 name = "Vertical Scrollbar Layer"; |
2504 } else if (graphicsLayer == m_layerForScrollCorner.get()) { | 2526 } else if (graphicsLayer == m_layerForScrollCorner.get()) { |
2505 name = "Scroll Corner Layer"; | 2527 name = "Scroll Corner Layer"; |
2506 } else if (graphicsLayer == m_overflowControlsHostLayer.get()) { | 2528 } else if (graphicsLayer == m_overflowControlsHostLayer.get()) { |
2507 name = "Overflow Controls Host Layer"; | 2529 name = "Overflow Controls Host Layer"; |
2508 } else if (graphicsLayer == m_overflowControlsClippingLayer.get()) { | 2530 } else if (graphicsLayer == m_overflowControlsAncestorClippingLayer.get()) { |
2509 name = "Overflow Controls ClipLayer Layer"; | 2531 name = "Overflow Controls Ancestor Clipping Layer"; |
2510 } else if (graphicsLayer == m_scrollingLayer.get()) { | 2532 } else if (graphicsLayer == m_scrollingLayer.get()) { |
2511 name = "Scrolling Layer"; | 2533 name = "Scrolling Layer"; |
2512 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2534 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
2513 name = "Scrolling Contents Layer"; | 2535 name = "Scrolling Contents Layer"; |
2514 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2536 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
2515 name = "Scrolling Block Selection Layer"; | 2537 name = "Scrolling Block Selection Layer"; |
2516 } else { | 2538 } else { |
2517 ASSERT_NOT_REACHED(); | 2539 ASSERT_NOT_REACHED(); |
2518 } | 2540 } |
2519 | 2541 |
2520 return name; | 2542 return name; |
2521 } | 2543 } |
2522 | 2544 |
2523 } // namespace blink | 2545 } // namespace blink |
OLD | NEW |