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

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

Issue 1457963006: Revert of 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::attachFrameContentLayersToIframeLayer(toLayout Part(layoutObject))) 552 if (PaintLayerCompositor::parentFrameContentLayers(toLayoutPart(layoutOb ject)))
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
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);
713 714
714 FloatSize contentsSize(relativeCompositingBounds.size()); 715 FloatSize contentsSize(relativeCompositingBounds.size());
715 716
716 updateMainGraphicsLayerGeometry(relativeCompositingBounds, localCompositingB ounds, graphicsLayerParentLocation); 717 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
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
834 if (needsToReparentOverflowControls()) { 832 if (needsToReparentOverflowControls()) {
835 if (m_overflowControlsAncestorClippingLayer) { 833 if (m_overflowControlsClippingLayer) {
836 m_overflowControlsAncestorClippingLayer->setSize(m_ancestorClippingL ayer->size()); 834 m_overflowControlsClippingLayer->setSize(m_ancestorClippingLayer->si ze());
837 m_overflowControlsAncestorClippingLayer->setOffsetFromLayoutObject(m _ancestorClippingLayer->offsetFromLayoutObject()); 835 m_overflowControlsClippingLayer->setOffsetFromLayoutObject(m_ancesto rClippingLayer->offsetFromLayoutObject());
838 m_overflowControlsAncestorClippingLayer->setMasksToBounds(true); 836 m_overflowControlsClippingLayer->setMasksToBounds(true);
839 hostLayerPosition = toLayoutPoint(LayoutSize(-m_overflowControlsAnce storClippingLayer->offsetFromLayoutObject())); 837 m_overflowControlsHostLayer->setPosition(IntPoint(-m_overflowControl sClippingLayer->offsetFromLayoutObject()));
840 838
841 FloatPoint position = m_ancestorClippingLayer->position(); 839 FloatPoint position = m_ancestorClippingLayer->position();
842 if (compositingStackingContext != compositingContainer) { 840 if (compositingStackingContext != compositingContainer) {
843 LayoutPoint offset; 841 LayoutPoint offset;
844 compositingContainer->convertToLayerCoords(compositingStackingCo ntext, offset); 842 compositingContainer->convertToLayerCoords(compositingStackingCo ntext, offset);
845 FloatSize offsetFromStackingContainer = toFloatSize(FloatPoint(o ffset)); 843 FloatSize offsetFromStackingContainer = toFloatSize(FloatPoint(o ffset));
846 position += offsetFromStackingContainer; 844 position += offsetFromStackingContainer;
847 } 845 }
848 846
849 m_overflowControlsAncestorClippingLayer->setPosition(position); 847 m_overflowControlsClippingLayer->setPosition(position);
850 } else { 848 } else {
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. 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.
852 TransformState transformState(TransformState::ApplyTransformDirectio n, FloatPoint()); 850 TransformState transformState(TransformState::ApplyTransformDirectio n, FloatPoint());
853 m_owningLayer.layoutObject()->mapLocalToContainer(compositingStackin gContext->layoutObject(), transformState, ApplyContainerFlip); 851 m_owningLayer.layoutObject()->mapLocalToContainer(compositingStackin gContext->layoutObject(), transformState, ApplyContainerFlip);
854 transformState.flatten(); 852 transformState.flatten();
855 hostLayerPosition = LayoutPoint(transformState.lastPlanarPoint()); 853 LayoutPoint offsetFromStackingContainer = LayoutPoint(transformState .lastPlanarPoint());
856 if (PaintLayerScrollableArea* scrollableArea = compositingStackingCo ntext->scrollableArea()) 854 if (PaintLayerScrollableArea* scrollableArea = compositingStackingCo ntext->scrollableArea())
857 hostLayerPosition.move(LayoutSize(scrollableArea->adjustedScroll Offset())); 855 offsetFromStackingContainer.move(LayoutSize(scrollableArea->adju stedScrollOffset()));
856 m_overflowControlsHostLayer->setPosition(FloatPoint(offsetFromStacki ngContainer));
858 } 857 }
858 } else {
859 m_overflowControlsHostLayer->setPosition(FloatPoint());
859 } 860 }
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);
872 } 861 }
873 862
874 void CompositedLayerMapping::updateChildContainmentLayerGeometry(const IntRect& clippingBox, const IntRect& localCompositingBounds) 863 void CompositedLayerMapping::updateChildContainmentLayerGeometry(const IntRect& clippingBox, const IntRect& localCompositingBounds)
875 { 864 {
876 if (!m_childContainmentLayer) 865 if (!m_childContainmentLayer)
877 return; 866 return;
878 867
879 FloatPoint clipPositionInLayoutObjectSpace(clippingBox.location() - localCom positingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation()) ); 868 FloatPoint clipPositionInLayoutObjectSpace(clippingBox.location() - localCom positingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation()) );
880 869
881 // If there are layers between the the child containment layer and 870 // If there are layers between the the child containment layer and
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 }; 1097 };
1109 1098
1110 updateBottomLayer(m_childTransformLayer.get()); 1099 updateBottomLayer(m_childTransformLayer.get());
1111 updateBottomLayer(m_childContainmentLayer.get()); 1100 updateBottomLayer(m_childContainmentLayer.get());
1112 updateBottomLayer(m_scrollingLayer.get()); 1101 updateBottomLayer(m_scrollingLayer.get());
1113 1102
1114 // Now constructing the subtree for the overflow controls. 1103 // Now constructing the subtree for the overflow controls.
1115 bottomLayer = m_graphicsLayer.get(); 1104 bottomLayer = m_graphicsLayer.get();
1116 if (m_isMainFrameLayoutViewLayer) 1105 if (m_isMainFrameLayoutViewLayer)
1117 bottomLayer = layoutObject()->frame()->page()->frameHost().visualViewpor t().containerLayer(); 1106 bottomLayer = layoutObject()->frame()->page()->frameHost().visualViewpor t().containerLayer();
1118 updateBottomLayer(m_overflowControlsAncestorClippingLayer.get()); 1107 updateBottomLayer(m_overflowControlsClippingLayer.get());
1119 updateBottomLayer(m_overflowControlsHostLayer.get()); 1108 updateBottomLayer(m_overflowControlsHostLayer.get());
1120 if (m_layerForHorizontalScrollbar) 1109 if (m_layerForHorizontalScrollbar)
1121 m_overflowControlsHostLayer->addChild(m_layerForHorizontalScrollbar.get( )); 1110 m_overflowControlsHostLayer->addChild(m_layerForHorizontalScrollbar.get( ));
1122 if (m_layerForVerticalScrollbar) 1111 if (m_layerForVerticalScrollbar)
1123 m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.get()) ; 1112 m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.get()) ;
1124 if (m_layerForScrollCorner) 1113 if (m_layerForScrollCorner)
1125 m_overflowControlsHostLayer->addChild(m_layerForScrollCorner.get()); 1114 m_overflowControlsHostLayer->addChild(m_layerForScrollCorner.get());
1126 1115
1127 // The squashing containment layer, if it exists, becomes a no-op parent. 1116 // The squashing containment layer, if it exists, becomes a no-op parent.
1128 if (m_squashingLayer) { 1117 if (m_squashingLayer) {
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 needsHorizontalScrollbarLayer &= !invisible; 1338 needsHorizontalScrollbarLayer &= !invisible;
1350 needsVerticalScrollbarLayer &= !invisible; 1339 needsVerticalScrollbarLayer &= !invisible;
1351 needsScrollCornerLayer &= !invisible; 1340 needsScrollCornerLayer &= !invisible;
1352 1341
1353 bool horizontalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerF orHorizontalScrollbar, needsHorizontalScrollbarLayer, CompositingReasonLayerForH orizontalScrollbar); 1342 bool horizontalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerF orHorizontalScrollbar, needsHorizontalScrollbarLayer, CompositingReasonLayerForH orizontalScrollbar);
1354 bool verticalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerFor VerticalScrollbar, needsVerticalScrollbarLayer, CompositingReasonLayerForVertica lScrollbar); 1343 bool verticalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerFor VerticalScrollbar, needsVerticalScrollbarLayer, CompositingReasonLayerForVertica lScrollbar);
1355 bool scrollCornerLayerChanged = toggleScrollbarLayerIfNeeded(m_layerForScrol lCorner, needsScrollCornerLayer, CompositingReasonLayerForScrollCorner); 1344 bool scrollCornerLayerChanged = toggleScrollbarLayerIfNeeded(m_layerForScrol lCorner, needsScrollCornerLayer, CompositingReasonLayerForScrollCorner);
1356 1345
1357 bool needsOverflowControlsHostLayer = needsHorizontalScrollbarLayer || needs VerticalScrollbarLayer || needsScrollCornerLayer; 1346 bool needsOverflowControlsHostLayer = needsHorizontalScrollbarLayer || needs VerticalScrollbarLayer || needsScrollCornerLayer;
1358 toggleScrollbarLayerIfNeeded(m_overflowControlsHostLayer, needsOverflowContr olsHostLayer, CompositingReasonLayerForOverflowControlsHost); 1347 toggleScrollbarLayerIfNeeded(m_overflowControlsHostLayer, needsOverflowContr olsHostLayer, CompositingReasonLayerForOverflowControlsHost);
1359 bool needsOverflowAncestorClipLayer = needsOverflowControlsHostLayer && need sAncestorClip; 1348 bool needsOverflowClipLayer = needsOverflowControlsHostLayer && needsAncesto rClip;
1360 toggleScrollbarLayerIfNeeded(m_overflowControlsAncestorClippingLayer, needsO verflowAncestorClipLayer, CompositingReasonLayerForOverflowControlsHost); 1349 toggleScrollbarLayerIfNeeded(m_overflowControlsClippingLayer, needsOverflowC lipLayer, CompositingReasonLayerForOverflowControlsHost);
1361 1350
1362 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer)) { 1351 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer)) {
1363 if (horizontalScrollbarLayerChanged) 1352 if (horizontalScrollbarLayerChanged)
1364 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer.scrollableArea(), HorizontalScrollbar); 1353 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer.scrollableArea(), HorizontalScrollbar);
1365 if (verticalScrollbarLayerChanged) 1354 if (verticalScrollbarLayerChanged)
1366 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer.scrollableArea(), VerticalScrollbar); 1355 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer.scrollableArea(), VerticalScrollbar);
1367 } 1356 }
1368 1357
1369 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || s crollCornerLayerChanged; 1358 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || s crollCornerLayerChanged;
1370 } 1359 }
1371 1360
1372 void CompositedLayerMapping::positionOverflowControlsLayers() 1361 void CompositedLayerMapping::positionOverflowControlsLayers()
1373 { 1362 {
1363 IntSize offsetFromLayoutObject = m_graphicsLayer->offsetFromLayoutObject() - roundedIntSize(m_owningLayer.subpixelAccumulation());
1374 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) { 1364 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
1375 Scrollbar* hBar = m_owningLayer.scrollableArea()->horizontalScrollbar(); 1365 Scrollbar* hBar = m_owningLayer.scrollableArea()->horizontalScrollbar();
1376 if (hBar) { 1366 if (hBar) {
1377 layer->setPosition(hBar->frameRect().location()); 1367 layer->setPosition(hBar->frameRect().location() - offsetFromLayoutOb ject);
1378 layer->setSize(FloatSize(hBar->frameRect().size())); 1368 layer->setSize(FloatSize(hBar->frameRect().size()));
1379 if (layer->hasContentsLayer()) 1369 if (layer->hasContentsLayer())
1380 layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().siz e())); 1370 layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().siz e()));
1381 } 1371 }
1382 layer->setDrawsContent(hBar && !layer->hasContentsLayer()); 1372 layer->setDrawsContent(hBar && !layer->hasContentsLayer());
1383 } 1373 }
1384 1374
1385 if (GraphicsLayer* layer = layerForVerticalScrollbar()) { 1375 if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
1386 Scrollbar* vBar = m_owningLayer.scrollableArea()->verticalScrollbar(); 1376 Scrollbar* vBar = m_owningLayer.scrollableArea()->verticalScrollbar();
1387 if (vBar) { 1377 if (vBar) {
1388 layer->setPosition(vBar->frameRect().location()); 1378 layer->setPosition(vBar->frameRect().location() - offsetFromLayoutOb ject);
1389 layer->setSize(FloatSize(vBar->frameRect().size())); 1379 layer->setSize(FloatSize(vBar->frameRect().size()));
1390 if (layer->hasContentsLayer()) 1380 if (layer->hasContentsLayer())
1391 layer->setContentsRect(IntRect(IntPoint(), vBar->frameRect().siz e())); 1381 layer->setContentsRect(IntRect(IntPoint(), vBar->frameRect().siz e()));
1392 } 1382 }
1393 layer->setDrawsContent(vBar && !layer->hasContentsLayer()); 1383 layer->setDrawsContent(vBar && !layer->hasContentsLayer());
1394 } 1384 }
1395 1385
1396 if (GraphicsLayer* layer = layerForScrollCorner()) { 1386 if (GraphicsLayer* layer = layerForScrollCorner()) {
1397 const IntRect& scrollCornerAndResizer = m_owningLayer.scrollableArea()-> scrollCornerAndResizerRect(); 1387 const IntRect& scrollCornerAndResizer = m_owningLayer.scrollableArea()-> scrollCornerAndResizerRect();
1398 layer->setPosition(FloatPoint(scrollCornerAndResizer.location())); 1388 layer->setPosition(FloatPoint(scrollCornerAndResizer.location() - offset FromLayoutObject));
1399 layer->setSize(FloatSize(scrollCornerAndResizer.size())); 1389 layer->setSize(FloatSize(scrollCornerAndResizer.size()));
1400 layer->setDrawsContent(!scrollCornerAndResizer.isEmpty()); 1390 layer->setDrawsContent(!scrollCornerAndResizer.isEmpty());
1401 } 1391 }
1402 } 1392 }
1403 1393
1404 enum ApplyToGraphicsLayersModeFlags { 1394 enum ApplyToGraphicsLayersModeFlags {
1405 ApplyToLayersAffectedByPreserve3D = (1 << 0), 1395 ApplyToLayersAffectedByPreserve3D = (1 << 0),
1406 ApplyToSquashingLayer = (1 << 1), 1396 ApplyToSquashingLayer = (1 << 1),
1407 ApplyToScrollbarLayers = (1 << 2), 1397 ApplyToScrollbarLayers = (1 << 2),
1408 ApplyToBackgroundLayer = (1 << 3), 1398 ApplyToBackgroundLayer = (1 << 3),
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1963 1953
1964 bool CompositedLayerMapping::needsToReparentOverflowControls() const 1954 bool CompositedLayerMapping::needsToReparentOverflowControls() const
1965 { 1955 {
1966 return m_owningLayer.scrollableArea() 1956 return m_owningLayer.scrollableArea()
1967 && m_owningLayer.scrollableArea()->hasOverlayScrollbars() 1957 && m_owningLayer.scrollableArea()->hasOverlayScrollbars()
1968 && m_owningLayer.scrollableArea()->topmostScrollChild(); 1958 && m_owningLayer.scrollableArea()->topmostScrollChild();
1969 } 1959 }
1970 1960
1971 GraphicsLayer* CompositedLayerMapping::detachLayerForOverflowControls(const Pain tLayer& enclosingLayer) 1961 GraphicsLayer* CompositedLayerMapping::detachLayerForOverflowControls(const Pain tLayer& enclosingLayer)
1972 { 1962 {
1973 GraphicsLayer* host = m_overflowControlsAncestorClippingLayer.get(); 1963 GraphicsLayer* host = m_overflowControlsClippingLayer.get();
1974 if (!host) 1964 if (!host)
1975 host = m_overflowControlsHostLayer.get(); 1965 host = m_overflowControlsHostLayer.get();
1976 host->removeFromParent(); 1966 host->removeFromParent();
1977 return host; 1967 return host;
1978 } 1968 }
1979 1969
1980 GraphicsLayer* CompositedLayerMapping::parentForSublayers() const 1970 GraphicsLayer* CompositedLayerMapping::parentForSublayers() const
1981 { 1971 {
1982 if (m_scrollingBlockSelectionLayer) 1972 if (m_scrollingBlockSelectionLayer)
1983 return m_scrollingBlockSelectionLayer.get(); 1973 return m_scrollingBlockSelectionLayer.get();
1984 1974
1985 if (m_scrollingContentsLayer) 1975 if (m_scrollingContentsLayer)
1986 return m_scrollingContentsLayer.get(); 1976 return m_scrollingContentsLayer.get();
1987 1977
1988 if (m_childContainmentLayer) 1978 if (m_childContainmentLayer)
1989 return m_childContainmentLayer.get(); 1979 return m_childContainmentLayer.get();
1990 1980
1991 if (m_childTransformLayer) 1981 if (m_childTransformLayer)
1992 return m_childTransformLayer.get(); 1982 return m_childTransformLayer.get();
1993 1983
1994 return m_graphicsLayer.get(); 1984 return m_graphicsLayer.get();
1995 } 1985 }
1996 1986
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
2013 GraphicsLayer* CompositedLayerMapping::childForSuperlayers() const 1987 GraphicsLayer* CompositedLayerMapping::childForSuperlayers() const
2014 { 1988 {
2015 if (m_squashingContainmentLayer) 1989 if (m_squashingContainmentLayer)
2016 return m_squashingContainmentLayer.get(); 1990 return m_squashingContainmentLayer.get();
2017 1991
2018 if (m_ancestorClippingLayer) 1992 if (m_ancestorClippingLayer)
2019 return m_ancestorClippingLayer.get(); 1993 return m_ancestorClippingLayer.get();
2020 1994
2021 return m_graphicsLayer.get(); 1995 return m_graphicsLayer.get();
2022 } 1996 }
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
2524 } else if (graphicsLayer == m_childClippingMaskLayer.get()) { 2498 } else if (graphicsLayer == m_childClippingMaskLayer.get()) {
2525 name = "Child Clipping Mask Layer"; 2499 name = "Child Clipping Mask Layer";
2526 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) { 2500 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) {
2527 name = "Horizontal Scrollbar Layer"; 2501 name = "Horizontal Scrollbar Layer";
2528 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) { 2502 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) {
2529 name = "Vertical Scrollbar Layer"; 2503 name = "Vertical Scrollbar Layer";
2530 } else if (graphicsLayer == m_layerForScrollCorner.get()) { 2504 } else if (graphicsLayer == m_layerForScrollCorner.get()) {
2531 name = "Scroll Corner Layer"; 2505 name = "Scroll Corner Layer";
2532 } else if (graphicsLayer == m_overflowControlsHostLayer.get()) { 2506 } else if (graphicsLayer == m_overflowControlsHostLayer.get()) {
2533 name = "Overflow Controls Host Layer"; 2507 name = "Overflow Controls Host Layer";
2534 } else if (graphicsLayer == m_overflowControlsAncestorClippingLayer.get()) { 2508 } else if (graphicsLayer == m_overflowControlsClippingLayer.get()) {
2535 name = "Overflow Controls Ancestor Clipping Layer"; 2509 name = "Overflow Controls ClipLayer Layer";
2536 } else if (graphicsLayer == m_scrollingLayer.get()) { 2510 } else if (graphicsLayer == m_scrollingLayer.get()) {
2537 name = "Scrolling Layer"; 2511 name = "Scrolling Layer";
2538 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2512 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2539 name = "Scrolling Contents Layer"; 2513 name = "Scrolling Contents Layer";
2540 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { 2514 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2541 name = "Scrolling Block Selection Layer"; 2515 name = "Scrolling Block Selection Layer";
2542 } else { 2516 } else {
2543 ASSERT_NOT_REACHED(); 2517 ASSERT_NOT_REACHED();
2544 } 2518 }
2545 2519
2546 return name; 2520 return name;
2547 } 2521 }
2548 2522
2549 } // namespace blink 2523 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698