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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 } else if (layoutObject->isVideo()) { | 542 } else if (layoutObject->isVideo()) { |
543 HTMLMediaElement* mediaElement = toHTMLMediaElement(layoutObject->node()
); | 543 HTMLMediaElement* mediaElement = toHTMLMediaElement(layoutObject->node()
); |
544 m_graphicsLayer->setContentsToPlatformLayer(mediaElement->platformLayer(
)); | 544 m_graphicsLayer->setContentsToPlatformLayer(mediaElement->platformLayer(
)); |
545 } else if (isAcceleratedCanvas(layoutObject)) { | 545 } else if (isAcceleratedCanvas(layoutObject)) { |
546 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node()); | 546 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node()); |
547 if (CanvasRenderingContext* context = canvas->renderingContext()) | 547 if (CanvasRenderingContext* context = canvas->renderingContext()) |
548 m_graphicsLayer->setContentsToPlatformLayer(context->platformLayer()
); | 548 m_graphicsLayer->setContentsToPlatformLayer(context->platformLayer()
); |
549 layerConfigChanged = true; | 549 layerConfigChanged = true; |
550 } | 550 } |
551 if (layoutObject->isLayoutPart()) { | 551 if (layoutObject->isLayoutPart()) { |
552 if (PaintLayerCompositor::parentFrameContentLayers(toLayoutPart(layoutOb
ject))) | 552 if (PaintLayerCompositor::attachFrameContentLayersToIframeLayer(toLayout
Part(layoutObject))) |
553 layerConfigChanged = true; | 553 layerConfigChanged = true; |
554 } | 554 } |
555 | 555 |
556 // Changes to either the internal hierarchy or the mask layer have an impact | 556 // Changes to either the internal hierarchy or the mask layer have an impact |
557 // on painting phases, so we need to update when either are updated. | 557 // on painting phases, so we need to update when either are updated. |
558 if (layerConfigChanged || maskLayerChanged) | 558 if (layerConfigChanged || maskLayerChanged) |
559 updatePaintingPhases(); | 559 updatePaintingPhases(); |
560 | 560 |
561 return layerConfigChanged; | 561 return layerConfigChanged; |
562 } | 562 } |
(...skipping 140 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 // To clip correctly, m_overflowControlsHostLayer should match the border bo
x rect, which is at |
| 862 // the origin of the LayoutObject. The parent is m_graphicsLayer, so we must
adjust the position |
| 863 // by the distance from m_graphicsLayer to the LayoutObject. |
| 864 |
| 865 IntSize offsetFromLayoutObject = m_graphicsLayer->offsetFromLayoutObject() -
roundedIntSize(m_owningLayer.subpixelAccumulation()); |
| 866 hostLayerPosition.move(-offsetFromLayoutObject); |
| 867 m_overflowControlsHostLayer->setPosition(FloatPoint(hostLayerPosition)); |
| 868 |
| 869 const IntRect borderBox = toLayoutBox(m_owningLayer.layoutObject())->pixelSn
appedBorderBoxRect(); |
| 870 m_overflowControlsHostLayer->setSize(FloatSize(borderBox.size())); |
| 871 m_overflowControlsHostLayer->setMasksToBounds(true); |
861 } | 872 } |
862 | 873 |
863 void CompositedLayerMapping::updateChildContainmentLayerGeometry(const IntRect&
clippingBox, const IntRect& localCompositingBounds) | 874 void CompositedLayerMapping::updateChildContainmentLayerGeometry(const IntRect&
clippingBox, const IntRect& localCompositingBounds) |
864 { | 875 { |
865 if (!m_childContainmentLayer) | 876 if (!m_childContainmentLayer) |
866 return; | 877 return; |
867 | 878 |
868 FloatPoint clipPositionInLayoutObjectSpace(clippingBox.location() - localCom
positingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation())
); | 879 FloatPoint clipPositionInLayoutObjectSpace(clippingBox.location() - localCom
positingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation())
); |
869 | 880 |
870 // If there are layers between the the child containment layer and | 881 // 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 }; | 1108 }; |
1098 | 1109 |
1099 updateBottomLayer(m_childTransformLayer.get()); | 1110 updateBottomLayer(m_childTransformLayer.get()); |
1100 updateBottomLayer(m_childContainmentLayer.get()); | 1111 updateBottomLayer(m_childContainmentLayer.get()); |
1101 updateBottomLayer(m_scrollingLayer.get()); | 1112 updateBottomLayer(m_scrollingLayer.get()); |
1102 | 1113 |
1103 // Now constructing the subtree for the overflow controls. | 1114 // Now constructing the subtree for the overflow controls. |
1104 bottomLayer = m_graphicsLayer.get(); | 1115 bottomLayer = m_graphicsLayer.get(); |
1105 if (m_isMainFrameLayoutViewLayer) | 1116 if (m_isMainFrameLayoutViewLayer) |
1106 bottomLayer = layoutObject()->frame()->page()->frameHost().visualViewpor
t().containerLayer(); | 1117 bottomLayer = layoutObject()->frame()->page()->frameHost().visualViewpor
t().containerLayer(); |
1107 updateBottomLayer(m_overflowControlsClippingLayer.get()); | 1118 updateBottomLayer(m_overflowControlsAncestorClippingLayer.get()); |
1108 updateBottomLayer(m_overflowControlsHostLayer.get()); | 1119 updateBottomLayer(m_overflowControlsHostLayer.get()); |
1109 if (m_layerForHorizontalScrollbar) | 1120 if (m_layerForHorizontalScrollbar) |
1110 m_overflowControlsHostLayer->addChild(m_layerForHorizontalScrollbar.get(
)); | 1121 m_overflowControlsHostLayer->addChild(m_layerForHorizontalScrollbar.get(
)); |
1111 if (m_layerForVerticalScrollbar) | 1122 if (m_layerForVerticalScrollbar) |
1112 m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.get())
; | 1123 m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.get())
; |
1113 if (m_layerForScrollCorner) | 1124 if (m_layerForScrollCorner) |
1114 m_overflowControlsHostLayer->addChild(m_layerForScrollCorner.get()); | 1125 m_overflowControlsHostLayer->addChild(m_layerForScrollCorner.get()); |
1115 | 1126 |
1116 // The squashing containment layer, if it exists, becomes a no-op parent. | 1127 // The squashing containment layer, if it exists, becomes a no-op parent. |
1117 if (m_squashingLayer) { | 1128 if (m_squashingLayer) { |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 needsHorizontalScrollbarLayer &= !invisible; | 1349 needsHorizontalScrollbarLayer &= !invisible; |
1339 needsVerticalScrollbarLayer &= !invisible; | 1350 needsVerticalScrollbarLayer &= !invisible; |
1340 needsScrollCornerLayer &= !invisible; | 1351 needsScrollCornerLayer &= !invisible; |
1341 | 1352 |
1342 bool horizontalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerF
orHorizontalScrollbar, needsHorizontalScrollbarLayer, CompositingReasonLayerForH
orizontalScrollbar); | 1353 bool horizontalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerF
orHorizontalScrollbar, needsHorizontalScrollbarLayer, CompositingReasonLayerForH
orizontalScrollbar); |
1343 bool verticalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerFor
VerticalScrollbar, needsVerticalScrollbarLayer, CompositingReasonLayerForVertica
lScrollbar); | 1354 bool verticalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerFor
VerticalScrollbar, needsVerticalScrollbarLayer, CompositingReasonLayerForVertica
lScrollbar); |
1344 bool scrollCornerLayerChanged = toggleScrollbarLayerIfNeeded(m_layerForScrol
lCorner, needsScrollCornerLayer, CompositingReasonLayerForScrollCorner); | 1355 bool scrollCornerLayerChanged = toggleScrollbarLayerIfNeeded(m_layerForScrol
lCorner, needsScrollCornerLayer, CompositingReasonLayerForScrollCorner); |
1345 | 1356 |
1346 bool needsOverflowControlsHostLayer = needsHorizontalScrollbarLayer || needs
VerticalScrollbarLayer || needsScrollCornerLayer; | 1357 bool needsOverflowControlsHostLayer = needsHorizontalScrollbarLayer || needs
VerticalScrollbarLayer || needsScrollCornerLayer; |
1347 toggleScrollbarLayerIfNeeded(m_overflowControlsHostLayer, needsOverflowContr
olsHostLayer, CompositingReasonLayerForOverflowControlsHost); | 1358 toggleScrollbarLayerIfNeeded(m_overflowControlsHostLayer, needsOverflowContr
olsHostLayer, CompositingReasonLayerForOverflowControlsHost); |
1348 bool needsOverflowClipLayer = needsOverflowControlsHostLayer && needsAncesto
rClip; | 1359 bool needsOverflowAncestorClipLayer = needsOverflowControlsHostLayer && need
sAncestorClip; |
1349 toggleScrollbarLayerIfNeeded(m_overflowControlsClippingLayer, needsOverflowC
lipLayer, CompositingReasonLayerForOverflowControlsHost); | 1360 toggleScrollbarLayerIfNeeded(m_overflowControlsAncestorClippingLayer, needsO
verflowAncestorClipLayer, CompositingReasonLayerForOverflowControlsHost); |
1350 | 1361 |
1351 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay
er(m_owningLayer)) { | 1362 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay
er(m_owningLayer)) { |
1352 if (horizontalScrollbarLayerChanged) | 1363 if (horizontalScrollbarLayerChanged) |
1353 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning
Layer.scrollableArea(), HorizontalScrollbar); | 1364 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning
Layer.scrollableArea(), HorizontalScrollbar); |
1354 if (verticalScrollbarLayerChanged) | 1365 if (verticalScrollbarLayerChanged) |
1355 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning
Layer.scrollableArea(), VerticalScrollbar); | 1366 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning
Layer.scrollableArea(), VerticalScrollbar); |
1356 } | 1367 } |
1357 | 1368 |
1358 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || s
crollCornerLayerChanged; | 1369 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || s
crollCornerLayerChanged; |
1359 } | 1370 } |
1360 | 1371 |
1361 void CompositedLayerMapping::positionOverflowControlsLayers() | 1372 void CompositedLayerMapping::positionOverflowControlsLayers() |
1362 { | 1373 { |
1363 IntSize offsetFromLayoutObject = m_graphicsLayer->offsetFromLayoutObject() -
roundedIntSize(m_owningLayer.subpixelAccumulation()); | |
1364 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) { | 1374 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) { |
1365 Scrollbar* hBar = m_owningLayer.scrollableArea()->horizontalScrollbar(); | 1375 Scrollbar* hBar = m_owningLayer.scrollableArea()->horizontalScrollbar(); |
1366 if (hBar) { | 1376 if (hBar) { |
1367 layer->setPosition(hBar->frameRect().location() - offsetFromLayoutOb
ject); | 1377 layer->setPosition(hBar->frameRect().location()); |
1368 layer->setSize(FloatSize(hBar->frameRect().size())); | 1378 layer->setSize(FloatSize(hBar->frameRect().size())); |
1369 if (layer->hasContentsLayer()) | 1379 if (layer->hasContentsLayer()) |
1370 layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().siz
e())); | 1380 layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().siz
e())); |
1371 } | 1381 } |
1372 layer->setDrawsContent(hBar && !layer->hasContentsLayer()); | 1382 layer->setDrawsContent(hBar && !layer->hasContentsLayer()); |
1373 } | 1383 } |
1374 | 1384 |
1375 if (GraphicsLayer* layer = layerForVerticalScrollbar()) { | 1385 if (GraphicsLayer* layer = layerForVerticalScrollbar()) { |
1376 Scrollbar* vBar = m_owningLayer.scrollableArea()->verticalScrollbar(); | 1386 Scrollbar* vBar = m_owningLayer.scrollableArea()->verticalScrollbar(); |
1377 if (vBar) { | 1387 if (vBar) { |
1378 layer->setPosition(vBar->frameRect().location() - offsetFromLayoutOb
ject); | 1388 layer->setPosition(vBar->frameRect().location()); |
1379 layer->setSize(FloatSize(vBar->frameRect().size())); | 1389 layer->setSize(FloatSize(vBar->frameRect().size())); |
1380 if (layer->hasContentsLayer()) | 1390 if (layer->hasContentsLayer()) |
1381 layer->setContentsRect(IntRect(IntPoint(), vBar->frameRect().siz
e())); | 1391 layer->setContentsRect(IntRect(IntPoint(), vBar->frameRect().siz
e())); |
1382 } | 1392 } |
1383 layer->setDrawsContent(vBar && !layer->hasContentsLayer()); | 1393 layer->setDrawsContent(vBar && !layer->hasContentsLayer()); |
1384 } | 1394 } |
1385 | 1395 |
1386 if (GraphicsLayer* layer = layerForScrollCorner()) { | 1396 if (GraphicsLayer* layer = layerForScrollCorner()) { |
1387 const IntRect& scrollCornerAndResizer = m_owningLayer.scrollableArea()->
scrollCornerAndResizerRect(); | 1397 const IntRect& scrollCornerAndResizer = m_owningLayer.scrollableArea()->
scrollCornerAndResizerRect(); |
1388 layer->setPosition(FloatPoint(scrollCornerAndResizer.location() - offset
FromLayoutObject)); | 1398 layer->setPosition(FloatPoint(scrollCornerAndResizer.location())); |
1389 layer->setSize(FloatSize(scrollCornerAndResizer.size())); | 1399 layer->setSize(FloatSize(scrollCornerAndResizer.size())); |
1390 layer->setDrawsContent(!scrollCornerAndResizer.isEmpty()); | 1400 layer->setDrawsContent(!scrollCornerAndResizer.isEmpty()); |
1391 } | 1401 } |
1392 } | 1402 } |
1393 | 1403 |
1394 enum ApplyToGraphicsLayersModeFlags { | 1404 enum ApplyToGraphicsLayersModeFlags { |
1395 ApplyToLayersAffectedByPreserve3D = (1 << 0), | 1405 ApplyToLayersAffectedByPreserve3D = (1 << 0), |
1396 ApplyToSquashingLayer = (1 << 1), | 1406 ApplyToSquashingLayer = (1 << 1), |
1397 ApplyToScrollbarLayers = (1 << 2), | 1407 ApplyToScrollbarLayers = (1 << 2), |
1398 ApplyToBackgroundLayer = (1 << 3), | 1408 ApplyToBackgroundLayer = (1 << 3), |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1953 | 1963 |
1954 bool CompositedLayerMapping::needsToReparentOverflowControls() const | 1964 bool CompositedLayerMapping::needsToReparentOverflowControls() const |
1955 { | 1965 { |
1956 return m_owningLayer.scrollableArea() | 1966 return m_owningLayer.scrollableArea() |
1957 && m_owningLayer.scrollableArea()->hasOverlayScrollbars() | 1967 && m_owningLayer.scrollableArea()->hasOverlayScrollbars() |
1958 && m_owningLayer.scrollableArea()->topmostScrollChild(); | 1968 && m_owningLayer.scrollableArea()->topmostScrollChild(); |
1959 } | 1969 } |
1960 | 1970 |
1961 GraphicsLayer* CompositedLayerMapping::detachLayerForOverflowControls(const Pain
tLayer& enclosingLayer) | 1971 GraphicsLayer* CompositedLayerMapping::detachLayerForOverflowControls(const Pain
tLayer& enclosingLayer) |
1962 { | 1972 { |
1963 GraphicsLayer* host = m_overflowControlsClippingLayer.get(); | 1973 GraphicsLayer* host = m_overflowControlsAncestorClippingLayer.get(); |
1964 if (!host) | 1974 if (!host) |
1965 host = m_overflowControlsHostLayer.get(); | 1975 host = m_overflowControlsHostLayer.get(); |
1966 host->removeFromParent(); | 1976 host->removeFromParent(); |
1967 return host; | 1977 return host; |
1968 } | 1978 } |
1969 | 1979 |
1970 GraphicsLayer* CompositedLayerMapping::parentForSublayers() const | 1980 GraphicsLayer* CompositedLayerMapping::parentForSublayers() const |
1971 { | 1981 { |
1972 if (m_scrollingBlockSelectionLayer) | 1982 if (m_scrollingBlockSelectionLayer) |
1973 return m_scrollingBlockSelectionLayer.get(); | 1983 return m_scrollingBlockSelectionLayer.get(); |
1974 | 1984 |
1975 if (m_scrollingContentsLayer) | 1985 if (m_scrollingContentsLayer) |
1976 return m_scrollingContentsLayer.get(); | 1986 return m_scrollingContentsLayer.get(); |
1977 | 1987 |
1978 if (m_childContainmentLayer) | 1988 if (m_childContainmentLayer) |
1979 return m_childContainmentLayer.get(); | 1989 return m_childContainmentLayer.get(); |
1980 | 1990 |
1981 if (m_childTransformLayer) | 1991 if (m_childTransformLayer) |
1982 return m_childTransformLayer.get(); | 1992 return m_childTransformLayer.get(); |
1983 | 1993 |
1984 return m_graphicsLayer.get(); | 1994 return m_graphicsLayer.get(); |
1985 } | 1995 } |
1986 | 1996 |
| 1997 void CompositedLayerMapping::setSublayers(const GraphicsLayerVector& sublayers) |
| 1998 { |
| 1999 GraphicsLayer* overflowControlsContainer = m_overflowControlsAncestorClippin
gLayer |
| 2000 ? m_overflowControlsAncestorClippingLayer.get() |
| 2001 : m_overflowControlsHostLayer.get(); |
| 2002 GraphicsLayer* parent = parentForSublayers(); |
| 2003 bool needsOverflowControlsReattached = overflowControlsContainer && overflow
ControlsContainer->parent() == parent; |
| 2004 |
| 2005 parent->setChildren(sublayers); |
| 2006 |
| 2007 // If we have scrollbars, but are not using composited scrolling, then paren
tForSublayers may return m_graphicsLayer. |
| 2008 // In that case, the above call to setChildren has clobbered the overflow co
ntrols host layer, so we need to reattach it. |
| 2009 if (needsOverflowControlsReattached) |
| 2010 parent->addChild(overflowControlsContainer); |
| 2011 } |
| 2012 |
1987 GraphicsLayer* CompositedLayerMapping::childForSuperlayers() const | 2013 GraphicsLayer* CompositedLayerMapping::childForSuperlayers() const |
1988 { | 2014 { |
1989 if (m_squashingContainmentLayer) | 2015 if (m_squashingContainmentLayer) |
1990 return m_squashingContainmentLayer.get(); | 2016 return m_squashingContainmentLayer.get(); |
1991 | 2017 |
1992 if (m_ancestorClippingLayer) | 2018 if (m_ancestorClippingLayer) |
1993 return m_ancestorClippingLayer.get(); | 2019 return m_ancestorClippingLayer.get(); |
1994 | 2020 |
1995 return m_graphicsLayer.get(); | 2021 return m_graphicsLayer.get(); |
1996 } | 2022 } |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2498 } else if (graphicsLayer == m_childClippingMaskLayer.get()) { | 2524 } else if (graphicsLayer == m_childClippingMaskLayer.get()) { |
2499 name = "Child Clipping Mask Layer"; | 2525 name = "Child Clipping Mask Layer"; |
2500 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) { | 2526 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) { |
2501 name = "Horizontal Scrollbar Layer"; | 2527 name = "Horizontal Scrollbar Layer"; |
2502 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) { | 2528 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) { |
2503 name = "Vertical Scrollbar Layer"; | 2529 name = "Vertical Scrollbar Layer"; |
2504 } else if (graphicsLayer == m_layerForScrollCorner.get()) { | 2530 } else if (graphicsLayer == m_layerForScrollCorner.get()) { |
2505 name = "Scroll Corner Layer"; | 2531 name = "Scroll Corner Layer"; |
2506 } else if (graphicsLayer == m_overflowControlsHostLayer.get()) { | 2532 } else if (graphicsLayer == m_overflowControlsHostLayer.get()) { |
2507 name = "Overflow Controls Host Layer"; | 2533 name = "Overflow Controls Host Layer"; |
2508 } else if (graphicsLayer == m_overflowControlsClippingLayer.get()) { | 2534 } else if (graphicsLayer == m_overflowControlsAncestorClippingLayer.get()) { |
2509 name = "Overflow Controls ClipLayer Layer"; | 2535 name = "Overflow Controls Ancestor Clipping Layer"; |
2510 } else if (graphicsLayer == m_scrollingLayer.get()) { | 2536 } else if (graphicsLayer == m_scrollingLayer.get()) { |
2511 name = "Scrolling Layer"; | 2537 name = "Scrolling Layer"; |
2512 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2538 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
2513 name = "Scrolling Contents Layer"; | 2539 name = "Scrolling Contents Layer"; |
2514 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2540 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
2515 name = "Scrolling Block Selection Layer"; | 2541 name = "Scrolling Block Selection Layer"; |
2516 } else { | 2542 } else { |
2517 ASSERT_NOT_REACHED(); | 2543 ASSERT_NOT_REACHED(); |
2518 } | 2544 } |
2519 | 2545 |
2520 return name; | 2546 return name; |
2521 } | 2547 } |
2522 | 2548 |
2523 } // namespace blink | 2549 } // namespace blink |
OLD | NEW |