Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

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

Powered by Google App Engine
This is Rietveld 408576698