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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 442 |
443 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_ownin
gLayer))) | 443 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_ownin
gLayer))) |
444 layerConfigChanged = true; | 444 layerConfigChanged = true; |
445 | 445 |
446 bool needsDescendantsClippingLayer = compositor->clipsCompositingDescendants
(&m_owningLayer); | 446 bool needsDescendantsClippingLayer = compositor->clipsCompositingDescendants
(&m_owningLayer); |
447 | 447 |
448 // Our scrolling layer will clip. | 448 // Our scrolling layer will clip. |
449 if (m_owningLayer.needsCompositedScrolling()) | 449 if (m_owningLayer.needsCompositedScrolling()) |
450 needsDescendantsClippingLayer = false; | 450 needsDescendantsClippingLayer = false; |
451 | 451 |
| 452 // We disable clipping on ancestor layers of the root scroller to give it |
| 453 // the same behavior w.r.t top controls as the real root layer. See the |
| 454 // RootScrollerController class for more details. |
| 455 if (m_owningLayer.hasRootScrollerAsDescendant()) |
| 456 needsDescendantsClippingLayer = false; |
| 457 |
452 const PaintLayer* scrollParent = this->scrollParent(); | 458 const PaintLayer* scrollParent = this->scrollParent(); |
453 | 459 |
454 // This is required because compositing layers are parented according to the
z-order hierarchy, yet | 460 // This is required because compositing layers are parented according to the
z-order hierarchy, yet |
455 // clipping goes down the layoutObject hierarchy. Thus, a PaintLayer can be
clipped by a | 461 // clipping goes down the layoutObject hierarchy. Thus, a PaintLayer can be
clipped by a |
456 // PaintLayer that is an ancestor in the layoutObject hierarchy, but a sibli
ng in the z-order | 462 // PaintLayer that is an ancestor in the layoutObject hierarchy, but a sibli
ng in the z-order |
457 // hierarchy. Further, that sibling need not be composited at all. In such s
cenarios, an ancestor | 463 // hierarchy. Further, that sibling need not be composited at all. In such s
cenarios, an ancestor |
458 // clipping layer is necessary to apply the composited clip for this layer. | 464 // clipping layer is necessary to apply the composited clip for this layer. |
459 bool needsAncestorClip = owningLayerClippedByLayerNotAboveCompositedAncestor
(scrollParent); | 465 bool needsAncestorClip = owningLayerClippedByLayerNotAboveCompositedAncestor
(scrollParent) |
| 466 && !m_owningLayer.clippingContainer()->enclosingLayer()->hasRootScroller
AsDescendant(); |
460 | 467 |
461 if (updateClippingLayers(needsAncestorClip, needsDescendantsClippingLayer)) | 468 if (updateClippingLayers(needsAncestorClip, needsDescendantsClippingLayer)) |
462 layerConfigChanged = true; | 469 layerConfigChanged = true; |
463 | 470 |
464 bool scrollingConfigChanged = false; | 471 bool scrollingConfigChanged = false; |
465 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) { | 472 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) { |
466 layerConfigChanged = true; | 473 layerConfigChanged = true; |
467 scrollingConfigChanged = true; | 474 scrollingConfigChanged = true; |
468 } | 475 } |
469 | 476 |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 bool CompositedLayerMapping::updateScrollingLayers(bool needsScrollingLayers) | 1689 bool CompositedLayerMapping::updateScrollingLayers(bool needsScrollingLayers) |
1683 { | 1690 { |
1684 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m
_owningLayer); | 1691 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m
_owningLayer); |
1685 | 1692 |
1686 bool layerChanged = false; | 1693 bool layerChanged = false; |
1687 if (needsScrollingLayers) { | 1694 if (needsScrollingLayers) { |
1688 if (!m_scrollingLayer) { | 1695 if (!m_scrollingLayer) { |
1689 // Outer layer which corresponds with the scroll view. | 1696 // Outer layer which corresponds with the scroll view. |
1690 m_scrollingLayer = createGraphicsLayer(CompositingReasonLayerForScro
llingContainer); | 1697 m_scrollingLayer = createGraphicsLayer(CompositingReasonLayerForScro
llingContainer); |
1691 m_scrollingLayer->setDrawsContent(false); | 1698 m_scrollingLayer->setDrawsContent(false); |
1692 m_scrollingLayer->setMasksToBounds(true); | |
1693 | 1699 |
1694 // Inner layer which renders the content that scrolls. | 1700 // Inner layer which renders the content that scrolls. |
1695 m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLaye
rForScrollingContents); | 1701 m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLaye
rForScrollingContents); |
1696 | 1702 |
1697 if (Node* owningNode = m_owningLayer.layoutObject()->node()) | 1703 if (Node* owningNode = m_owningLayer.layoutObject()->node()) |
1698 m_scrollingContentsLayer->setElementId(createCompositorElementId
(DOMNodeIds::idForNode(owningNode), CompositorSubElementId::Scroll)); | 1704 m_scrollingContentsLayer->setElementId(createCompositorElementId
(DOMNodeIds::idForNode(owningNode), CompositorSubElementId::Scroll)); |
1699 | 1705 |
1700 m_scrollingLayer->addChild(m_scrollingContentsLayer.get()); | 1706 m_scrollingLayer->addChild(m_scrollingContentsLayer.get()); |
1701 | 1707 |
1702 layerChanged = true; | 1708 layerChanged = true; |
1703 if (scrollingCoordinator) { | 1709 if (scrollingCoordinator) { |
1704 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin
gLayer.getScrollableArea()); | 1710 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin
gLayer.getScrollableArea()); |
1705 scrollingCoordinator->scrollableAreasDidChange(); | 1711 scrollingCoordinator->scrollableAreasDidChange(); |
1706 } | 1712 } |
1707 } | 1713 } |
| 1714 |
| 1715 m_scrollingLayer->setMasksToBounds( |
| 1716 !m_owningLayer.hasRootScrollerAsDescendant()); |
1708 } else if (m_scrollingLayer) { | 1717 } else if (m_scrollingLayer) { |
1709 m_scrollingLayer = nullptr; | 1718 m_scrollingLayer = nullptr; |
1710 m_scrollingContentsLayer = nullptr; | 1719 m_scrollingContentsLayer = nullptr; |
1711 layerChanged = true; | 1720 layerChanged = true; |
1712 if (scrollingCoordinator) { | 1721 if (scrollingCoordinator) { |
1713 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLay
er.getScrollableArea()); | 1722 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLay
er.getScrollableArea()); |
1714 scrollingCoordinator->scrollableAreasDidChange(); | 1723 scrollingCoordinator->scrollableAreasDidChange(); |
1715 } | 1724 } |
1716 } | 1725 } |
1717 | 1726 |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2697 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2706 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
2698 name = "Scrolling Contents Layer"; | 2707 name = "Scrolling Contents Layer"; |
2699 } else { | 2708 } else { |
2700 ASSERT_NOT_REACHED(); | 2709 ASSERT_NOT_REACHED(); |
2701 } | 2710 } |
2702 | 2711 |
2703 return name; | 2712 return name; |
2704 } | 2713 } |
2705 | 2714 |
2706 } // namespace blink | 2715 } // namespace blink |
OLD | NEW |