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

Side by Side Diff: Source/core/rendering/compositing/CompositedLayerMapping.cpp

Issue 397713004: Overlay scrollbars must respect ancestor clip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 6 years, 5 months 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 | Annotate | Revision Log
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Do not leave the destroyed pointer dangling on any RenderLayers that pain ted to this mapping's squashing layer. 180 // Do not leave the destroyed pointer dangling on any RenderLayers that pain ted to this mapping's squashing layer.
181 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { 181 for (size_t i = 0; i < m_squashedLayers.size(); ++i) {
182 RenderLayer* oldSquashedLayer = m_squashedLayers[i].renderLayer; 182 RenderLayer* oldSquashedLayer = m_squashedLayers[i].renderLayer;
183 if (oldSquashedLayer->groupedMapping() == this) { 183 if (oldSquashedLayer->groupedMapping() == this) {
184 oldSquashedLayer->setGroupedMapping(0, true); 184 oldSquashedLayer->setGroupedMapping(0, true);
185 oldSquashedLayer->setLostGroupedMapping(true); 185 oldSquashedLayer->setLostGroupedMapping(true);
186 } 186 }
187 } 187 }
188 188
189 updateClippingLayers(false, false); 189 updateClippingLayers(false, false);
190 updateOverflowControlsLayers(false, false, false); 190 updateOverflowControlsLayers(false, false, false, false);
191 updateChildTransformLayer(false); 191 updateChildTransformLayer(false);
192 updateForegroundLayer(false); 192 updateForegroundLayer(false);
193 updateBackgroundLayer(false); 193 updateBackgroundLayer(false);
194 updateMaskLayer(false); 194 updateMaskLayer(false);
195 updateClippingMaskLayers(false); 195 updateClippingMaskLayers(false);
196 updateScrollingLayers(false); 196 updateScrollingLayers(false);
197 updateSquashingLayers(false); 197 updateSquashingLayers(false);
198 destroyGraphicsLayers(); 198 destroyGraphicsLayers();
199 } 199 }
200 200
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 if (scrollParent) { 381 if (scrollParent) {
382 // If our containing block is our ancestor scrolling layer, then we'll a lready be clipped 382 // If our containing block is our ancestor scrolling layer, then we'll a lready be clipped
383 // to it via our scroll parent and we don't need an ancestor clipping la yer. 383 // to it via our scroll parent and we don't need an ancestor clipping la yer.
384 if (m_owningLayer.renderer()->containingBlock()->enclosingLayer() == m_o wningLayer.ancestorScrollingLayer()) 384 if (m_owningLayer.renderer()->containingBlock()->enclosingLayer() == m_o wningLayer.ancestorScrollingLayer())
385 needsAncestorClip = false; 385 needsAncestorClip = false;
386 } 386 }
387 387
388 if (updateClippingLayers(needsAncestorClip, needsDescendantsClippingLayer)) 388 if (updateClippingLayers(needsAncestorClip, needsDescendantsClippingLayer))
389 layerConfigChanged = true; 389 layerConfigChanged = true;
390 390
391 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require sVerticalScrollbarLayer(), requiresScrollCornerLayer())) 391 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require sVerticalScrollbarLayer(), requiresScrollCornerLayer(), needsAncestorClip))
392 layerConfigChanged = true; 392 layerConfigChanged = true;
393 393
394 bool scrollingConfigChanged = false; 394 bool scrollingConfigChanged = false;
395 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) { 395 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) {
396 layerConfigChanged = true; 396 layerConfigChanged = true;
397 scrollingConfigChanged = true; 397 scrollingConfigChanged = true;
398 } 398 }
399 399
400 bool hasPerspective = false; 400 bool hasPerspective = false;
401 if (RenderStyle* style = renderer->style()) 401 if (RenderStyle* style = renderer->style())
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 squashingLayer->setPosition(squashLayerBounds.location()); 591 squashingLayer->setPosition(squashLayerBounds.location());
592 squashingLayer->setSize(squashLayerBounds.size()); 592 squashingLayer->setSize(squashLayerBounds.size());
593 593
594 *offsetFromTransformedAncestor = referenceOffsetFromTransformedAncestor; 594 *offsetFromTransformedAncestor = referenceOffsetFromTransformedAncestor;
595 offsetFromTransformedAncestor->move(squashLayerOriginInOwningLayerSpace); 595 offsetFromTransformedAncestor->move(squashLayerOriginInOwningLayerSpace);
596 596
597 for (size_t i = 0; i < layers.size(); ++i) 597 for (size_t i = 0; i < layers.size(); ++i)
598 layers[i].localClipRectForSquashedLayer = localClipRectForSquashedLayer( referenceLayer, layers[i], layers); 598 layers[i].localClipRectForSquashedLayer = localClipRectForSquashedLayer( referenceLayer, layers[i], layers);
599 } 599 }
600 600
601 void CompositedLayerMapping::updateGraphicsLayerGeometry(const RenderLayer* comp ositingContainer, Vector<RenderLayer*>& layersNeedingPaintInvalidation) 601 void CompositedLayerMapping::updateGraphicsLayerGeometry(const RenderLayer* comp ositingContainer, const RenderLayer* compositingStackingContext, Vector<RenderLa yer*>& layersNeedingPaintInvalidation)
602 { 602 {
603 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle: :InCompositingUpdate); 603 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle: :InCompositingUpdate);
604 604
605 // Set transform property, if it is not animating. We have to do this here b ecause the transform 605 // Set transform property, if it is not animating. We have to do this here b ecause the transform
606 // is affected by the layer dimensions. 606 // is affected by the layer dimensions.
607 if (!renderer()->style()->isRunningTransformAnimationOnCompositor()) 607 if (!renderer()->style()->isRunningTransformAnimationOnCompositor())
608 updateTransform(renderer()->style()); 608 updateTransform(renderer()->style());
609 609
610 // Set opacity, if it is not animating. 610 // Set opacity, if it is not animating.
611 if (!renderer()->style()->isRunningOpacityAnimationOnCompositor()) 611 if (!renderer()->style()->isRunningOpacityAnimationOnCompositor())
(...skipping 13 matching lines...) Expand all
625 IntRect relativeCompositingBounds; 625 IntRect relativeCompositingBounds;
626 LayoutPoint offsetFromCompositedAncestor; 626 LayoutPoint offsetFromCompositedAncestor;
627 IntPoint snappedOffsetFromCompositedAncestor; 627 IntPoint snappedOffsetFromCompositedAncestor;
628 computeBoundsOfOwningLayer(compositingContainer, localCompositingBounds, rel ativeCompositingBounds, offsetFromCompositedAncestor, snappedOffsetFromComposite dAncestor); 628 computeBoundsOfOwningLayer(compositingContainer, localCompositingBounds, rel ativeCompositingBounds, offsetFromCompositedAncestor, snappedOffsetFromComposite dAncestor);
629 629
630 IntPoint graphicsLayerParentLocation; 630 IntPoint graphicsLayerParentLocation;
631 computeGraphicsLayerParentLocation(compositingContainer, ancestorCompositing Bounds, graphicsLayerParentLocation); 631 computeGraphicsLayerParentLocation(compositingContainer, ancestorCompositing Bounds, graphicsLayerParentLocation);
632 632
633 // Might update graphicsLayerParentLocation. 633 // Might update graphicsLayerParentLocation.
634 updateAncestorClippingLayerGeometry(compositingContainer, snappedOffsetFromC ompositedAncestor, graphicsLayerParentLocation); 634 updateAncestorClippingLayerGeometry(compositingContainer, snappedOffsetFromC ompositedAncestor, graphicsLayerParentLocation);
635 updateOverflowControlsHostLayerGeometry(compositingStackingContext);
635 636
636 FloatSize contentsSize = relativeCompositingBounds.size(); 637 FloatSize contentsSize = relativeCompositingBounds.size();
637 638
638 updateMainGraphicsLayerGeometry(relativeCompositingBounds, localCompositingB ounds, graphicsLayerParentLocation); 639 updateMainGraphicsLayerGeometry(relativeCompositingBounds, localCompositingB ounds, graphicsLayerParentLocation);
639 updateSquashingLayerGeometry(offsetFromCompositedAncestor, graphicsLayerPare ntLocation, m_owningLayer, m_squashedLayers, m_squashingLayer.get(), &m_squashin gLayerOffsetFromTransformedAncestor, layersNeedingPaintInvalidation); 640 updateSquashingLayerGeometry(offsetFromCompositedAncestor, graphicsLayerPare ntLocation, m_owningLayer, m_squashedLayers, m_squashingLayer.get(), &m_squashin gLayerOffsetFromTransformedAncestor, layersNeedingPaintInvalidation);
640 641
641 // If we have a layer that clips children, position it. 642 // If we have a layer that clips children, position it.
642 IntRect clippingBox; 643 IntRect clippingBox;
643 if (m_childContainmentLayer) 644 if (m_childContainmentLayer)
644 clippingBox = clipBox(toRenderBox(renderer())); 645 clippingBox = clipBox(toRenderBox(renderer()));
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location() - graphicsLayerParentLocation)); 740 m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location() - graphicsLayerParentLocation));
740 m_ancestorClippingLayer->setSize(parentClipRect.size()); 741 m_ancestorClippingLayer->setSize(parentClipRect.size());
741 742
742 // backgroundRect is relative to compositingContainer, so subtract snappedOf fsetFromCompositedAncestor.X/snappedOffsetFromCompositedAncestor.Y to get back t o local coords. 743 // backgroundRect is relative to compositingContainer, so subtract snappedOf fsetFromCompositedAncestor.X/snappedOffsetFromCompositedAncestor.Y to get back t o local coords.
743 m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - s nappedOffsetFromCompositedAncestor); 744 m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - s nappedOffsetFromCompositedAncestor);
744 745
745 // The primary layer is then parented in, and positioned relative to this cl ipping layer. 746 // The primary layer is then parented in, and positioned relative to this cl ipping layer.
746 graphicsLayerParentLocation = parentClipRect.location(); 747 graphicsLayerParentLocation = parentClipRect.location();
747 } 748 }
748 749
750 void CompositedLayerMapping::updateOverflowControlsHostLayerGeometry(const Rende rLayer* compositingStackingContext)
751 {
752 if (!m_overflowControlsHostLayer)
753 return;
754
755 if (needsToReparentOverflowControls()) {
756 if (m_overflowControlsClippingLayer) {
757 m_overflowControlsClippingLayer->setPosition(m_ancestorClippingLayer ->position());
758 m_overflowControlsClippingLayer->setSize(m_ancestorClippingLayer->si ze());
759 m_overflowControlsClippingLayer->setOffsetFromRenderer(m_ancestorCli ppingLayer->offsetFromRenderer());
760 m_overflowControlsClippingLayer->setMasksToBounds(true);
761
762 m_overflowControlsHostLayer->setPosition(IntPoint(-m_overflowControl sClippingLayer->offsetFromRenderer()));
763 } else {
764 ASSERT(m_owningLayer.transformAncestor() == compositingStackingConte xt->transformAncestor());
765 LayoutPoint localOffsetToTransformedAncestor = m_owningLayer.compute OffsetFromTransformedAncestor();
766 LayoutPoint compositingStackingContextOffsetToTransformedAncestor = compositingStackingContext->computeOffsetFromTransformedAncestor();
767
768 m_overflowControlsHostLayer->setPosition(FloatPoint(localOffsetToTra nsformedAncestor - compositingStackingContextOffsetToTransformedAncestor));
769 }
770 } else {
771 m_overflowControlsHostLayer->setPosition(FloatPoint());
772 }
773 }
774
749 void CompositedLayerMapping::updateChildContainmentLayerGeometry(const IntRect& clippingBox, const IntRect& localCompositingBounds) 775 void CompositedLayerMapping::updateChildContainmentLayerGeometry(const IntRect& clippingBox, const IntRect& localCompositingBounds)
750 { 776 {
751 if (!m_childContainmentLayer) 777 if (!m_childContainmentLayer)
752 return; 778 return;
753 779
754 m_childContainmentLayer->setPosition(FloatPoint(clippingBox.location() - loc alCompositingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulati on()))); 780 m_childContainmentLayer->setPosition(FloatPoint(clippingBox.location() - loc alCompositingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulati on())));
755 m_childContainmentLayer->setSize(clippingBox.size()); 781 m_childContainmentLayer->setSize(clippingBox.size());
756 m_childContainmentLayer->setOffsetFromRenderer(toIntSize(clippingBox.locatio n())); 782 m_childContainmentLayer->setOffsetFromRenderer(toIntSize(clippingBox.locatio n()));
757 if (m_childClippingMaskLayer && !m_scrollingLayer && !renderer()->style()->c lipPath()) { 783 if (m_childClippingMaskLayer && !m_scrollingLayer && !renderer()->style()->c lipPath()) {
758 m_childClippingMaskLayer->setPosition(m_childContainmentLayer->position( )); 784 m_childClippingMaskLayer->setPosition(m_childContainmentLayer->position( ));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); 836 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin);
811 } 837 }
812 } 838 }
813 839
814 void CompositedLayerMapping::updateReflectionLayerGeometry(Vector<RenderLayer*>& layersNeedingPaintInvalidation) 840 void CompositedLayerMapping::updateReflectionLayerGeometry(Vector<RenderLayer*>& layersNeedingPaintInvalidation)
815 { 841 {
816 if (!m_owningLayer.reflectionInfo() || !m_owningLayer.reflectionInfo()->refl ectionLayer()->hasCompositedLayerMapping()) 842 if (!m_owningLayer.reflectionInfo() || !m_owningLayer.reflectionInfo()->refl ectionLayer()->hasCompositedLayerMapping())
817 return; 843 return;
818 844
819 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLayer.r eflectionInfo()->reflectionLayer()->compositedLayerMapping(); 845 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLayer.r eflectionInfo()->reflectionLayer()->compositedLayerMapping();
820 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(&m_owningLayer , layersNeedingPaintInvalidation); 846 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(&m_owningLayer , &m_owningLayer, layersNeedingPaintInvalidation);
821 } 847 }
822 848
823 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo mpositingBounds) 849 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo mpositingBounds)
824 { 850 {
825 if (!m_scrollingLayer) 851 if (!m_scrollingLayer)
826 return; 852 return;
827 853
828 ASSERT(m_scrollingContentsLayer); 854 ASSERT(m_scrollingContentsLayer);
829 RenderBox* renderBox = toRenderBox(renderer()); 855 RenderBox* renderBox = toRenderBox(renderer());
830 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect()); 856 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect());
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 1002
977 if (m_childTransformLayer) 1003 if (m_childTransformLayer)
978 superLayer = m_childTransformLayer.get(); 1004 superLayer = m_childTransformLayer.get();
979 1005
980 superLayer->addChild(m_scrollingLayer.get()); 1006 superLayer->addChild(m_scrollingLayer.get());
981 } 1007 }
982 1008
983 // The clip for child layers does not include space for overflow controls, s o they exist as 1009 // The clip for child layers does not include space for overflow controls, s o they exist as
984 // siblings of the clipping layer if we have one. Normal children of this la yer are set as 1010 // siblings of the clipping layer if we have one. Normal children of this la yer are set as
985 // children of the clipping layer. 1011 // children of the clipping layer.
986 if (m_overflowControlsHostLayer) 1012 if (m_overflowControlsClippingLayer) {
1013 ASSERT(m_overflowControlsHostLayer);
1014 m_graphicsLayer->addChild(m_overflowControlsClippingLayer.get());
1015 m_overflowControlsClippingLayer->addChild(m_overflowControlsHostLayer.ge t());
1016 } else if (m_overflowControlsHostLayer) {
987 m_graphicsLayer->addChild(m_overflowControlsHostLayer.get()); 1017 m_graphicsLayer->addChild(m_overflowControlsHostLayer.get());
1018 }
1019
988 if (m_layerForHorizontalScrollbar) 1020 if (m_layerForHorizontalScrollbar)
989 m_overflowControlsHostLayer->addChild(m_layerForHorizontalScrollbar.get( )); 1021 m_overflowControlsHostLayer->addChild(m_layerForHorizontalScrollbar.get( ));
990 if (m_layerForVerticalScrollbar) 1022 if (m_layerForVerticalScrollbar)
991 m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.get()) ; 1023 m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.get()) ;
992 if (m_layerForScrollCorner) 1024 if (m_layerForScrollCorner)
993 m_overflowControlsHostLayer->addChild(m_layerForScrollCorner.get()); 1025 m_overflowControlsHostLayer->addChild(m_layerForScrollCorner.get());
994 1026
995 // The squashing containment layer, if it exists, becomes a no-op parent. 1027 // The squashing containment layer, if it exists, becomes a no-op parent.
996 if (m_squashingLayer) { 1028 if (m_squashingLayer) {
997 ASSERT(compositor()->layerSquashingEnabled()); 1029 ASSERT(compositor()->layerSquashingEnabled());
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 1192
1161 // Only a member function so it can call createGraphicsLayer. 1193 // Only a member function so it can call createGraphicsLayer.
1162 bool CompositedLayerMapping::toggleScrollbarLayerIfNeeded(OwnPtr<GraphicsLayer>& layer, bool needsLayer, CompositingReasons reason) 1194 bool CompositedLayerMapping::toggleScrollbarLayerIfNeeded(OwnPtr<GraphicsLayer>& layer, bool needsLayer, CompositingReasons reason)
1163 { 1195 {
1164 if (needsLayer == !!layer) 1196 if (needsLayer == !!layer)
1165 return false; 1197 return false;
1166 layer = needsLayer ? createGraphicsLayer(reason) : nullptr; 1198 layer = needsLayer ? createGraphicsLayer(reason) : nullptr;
1167 return true; 1199 return true;
1168 } 1200 }
1169 1201
1170 bool CompositedLayerMapping::updateOverflowControlsLayers(bool needsHorizontalSc rollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer) 1202 bool CompositedLayerMapping::updateOverflowControlsLayers(bool needsHorizontalSc rollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer, boo l needsAncestorClip)
1171 { 1203 {
1172 bool horizontalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerF orHorizontalScrollbar, needsHorizontalScrollbarLayer, CompositingReasonLayerForH orizontalScrollbar); 1204 bool horizontalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerF orHorizontalScrollbar, needsHorizontalScrollbarLayer, CompositingReasonLayerForH orizontalScrollbar);
1173 bool verticalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerFor VerticalScrollbar, needsVerticalScrollbarLayer, CompositingReasonLayerForVertica lScrollbar); 1205 bool verticalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerFor VerticalScrollbar, needsVerticalScrollbarLayer, CompositingReasonLayerForVertica lScrollbar);
1174 bool scrollCornerLayerChanged = toggleScrollbarLayerIfNeeded(m_layerForScrol lCorner, needsScrollCornerLayer, CompositingReasonLayerForScrollCorner); 1206 bool scrollCornerLayerChanged = toggleScrollbarLayerIfNeeded(m_layerForScrol lCorner, needsScrollCornerLayer, CompositingReasonLayerForScrollCorner);
1175 1207
1176 bool needsOverflowControlsHostLayer = needsHorizontalScrollbarLayer || needs VerticalScrollbarLayer || needsScrollCornerLayer; 1208 bool needsOverflowControlsHostLayer = needsHorizontalScrollbarLayer || needs VerticalScrollbarLayer || needsScrollCornerLayer;
1177 toggleScrollbarLayerIfNeeded(m_overflowControlsHostLayer, needsOverflowContr olsHostLayer, CompositingReasonLayerForOverflowControlsHost); 1209 toggleScrollbarLayerIfNeeded(m_overflowControlsHostLayer, needsOverflowContr olsHostLayer, CompositingReasonLayerForOverflowControlsHost);
1210 bool needsOverflowClipLayer = needsOverflowControlsHostLayer && needsAncesto rClip;
1211 toggleScrollbarLayerIfNeeded(m_overflowControlsClippingLayer, needsOverflowC lipLayer, CompositingReasonLayerForOverflowControlsHost);
1178 1212
1179 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer)) { 1213 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer)) {
1180 if (horizontalScrollbarLayerChanged) 1214 if (horizontalScrollbarLayerChanged)
1181 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer.scrollableArea(), HorizontalScrollbar); 1215 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer.scrollableArea(), HorizontalScrollbar);
1182 if (verticalScrollbarLayerChanged) 1216 if (verticalScrollbarLayerChanged)
1183 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer.scrollableArea(), VerticalScrollbar); 1217 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer.scrollableArea(), VerticalScrollbar);
1184 } 1218 }
1185 1219
1186 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || s crollCornerLayerChanged; 1220 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || s crollCornerLayerChanged;
1187 } 1221 }
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 return LayoutSize(-m_compositedBounds.x(), -m_compositedBounds.y()); 1818 return LayoutSize(-m_compositedBounds.x(), -m_compositedBounds.y());
1785 } 1819 }
1786 1820
1787 LayoutRect CompositedLayerMapping::contentsBox() const 1821 LayoutRect CompositedLayerMapping::contentsBox() const
1788 { 1822 {
1789 LayoutRect contentsBox = contentsRect(renderer()); 1823 LayoutRect contentsBox = contentsRect(renderer());
1790 contentsBox.move(contentOffsetInCompositingLayer()); 1824 contentsBox.move(contentOffsetInCompositingLayer());
1791 return contentsBox; 1825 return contentsBox;
1792 } 1826 }
1793 1827
1828 bool CompositedLayerMapping::needsToReparentOverflowControls() const
1829 {
1830 return m_owningLayer.scrollableArea()
1831 && m_owningLayer.scrollableArea()->hasOverlayScrollbars()
1832 && m_owningLayer.scrollableArea()->topmostScrollChild();
1833 }
1834
1794 GraphicsLayer* CompositedLayerMapping::detachLayerForOverflowControls(const Rend erLayer& enclosingLayer) 1835 GraphicsLayer* CompositedLayerMapping::detachLayerForOverflowControls(const Rend erLayer& enclosingLayer)
1795 { 1836 {
1796 LayoutPoint localOffsetToTransformedAncestor = m_owningLayer.computeOffsetFr omTransformedAncestor(); 1837 GraphicsLayer* host = m_overflowControlsClippingLayer.get();
1797 LayoutPoint enclosingLayerOffsetToTransformedAncestor = enclosingLayer.compu teOffsetFromTransformedAncestor(); 1838 if (!host)
1798 m_overflowControlsHostLayer->setPosition(FloatPoint(localOffsetToTransformed Ancestor - enclosingLayerOffsetToTransformedAncestor)); 1839 host = m_overflowControlsHostLayer.get();
1799 m_overflowControlsHostLayer->removeFromParent(); 1840 host->removeFromParent();
1800 return m_overflowControlsHostLayer.get(); 1841 return host;
1801 } 1842 }
1802 1843
1803 GraphicsLayer* CompositedLayerMapping::parentForSublayers() const 1844 GraphicsLayer* CompositedLayerMapping::parentForSublayers() const
1804 { 1845 {
1805 if (m_scrollingBlockSelectionLayer) 1846 if (m_scrollingBlockSelectionLayer)
1806 return m_scrollingBlockSelectionLayer.get(); 1847 return m_scrollingBlockSelectionLayer.get();
1807 1848
1808 if (m_scrollingContentsLayer) 1849 if (m_scrollingContentsLayer)
1809 return m_scrollingContentsLayer.get(); 1850 return m_scrollingContentsLayer.get();
1810 1851
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 } else if (graphicsLayer == m_childClippingMaskLayer.get()) { 2277 } else if (graphicsLayer == m_childClippingMaskLayer.get()) {
2237 name = "Child Clipping Mask Layer"; 2278 name = "Child Clipping Mask Layer";
2238 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) { 2279 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) {
2239 name = "Horizontal Scrollbar Layer"; 2280 name = "Horizontal Scrollbar Layer";
2240 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) { 2281 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) {
2241 name = "Vertical Scrollbar Layer"; 2282 name = "Vertical Scrollbar Layer";
2242 } else if (graphicsLayer == m_layerForScrollCorner.get()) { 2283 } else if (graphicsLayer == m_layerForScrollCorner.get()) {
2243 name = "Scroll Corner Layer"; 2284 name = "Scroll Corner Layer";
2244 } else if (graphicsLayer == m_overflowControlsHostLayer.get()) { 2285 } else if (graphicsLayer == m_overflowControlsHostLayer.get()) {
2245 name = "Overflow Controls Host Layer"; 2286 name = "Overflow Controls Host Layer";
2287 } else if (graphicsLayer == m_overflowControlsClippingLayer.get()) {
2288 name = "Overflow Controls ClipLayer Layer";
2246 } else if (graphicsLayer == m_scrollingLayer.get()) { 2289 } else if (graphicsLayer == m_scrollingLayer.get()) {
2247 name = "Scrolling Layer"; 2290 name = "Scrolling Layer";
2248 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2291 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2249 name = "Scrolling Contents Layer"; 2292 name = "Scrolling Contents Layer";
2250 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { 2293 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2251 name = "Scrolling Block Selection Layer"; 2294 name = "Scrolling Block Selection Layer";
2252 } else { 2295 } else {
2253 ASSERT_NOT_REACHED(); 2296 ASSERT_NOT_REACHED();
2254 } 2297 }
2255 2298
2256 return name; 2299 return name;
2257 } 2300 }
2258 2301
2259 } // namespace blink 2302 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698