OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 1815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1826 | 1826 |
1827 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) | 1827 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) |
1828 dirtyAncestorChainVisibleDescendantStatus(); | 1828 dirtyAncestorChainVisibleDescendantStatus(); |
1829 | 1829 |
1830 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant()) | 1830 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant()) |
1831 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 1831 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
1832 | 1832 |
1833 return oldChild; | 1833 return oldChild; |
1834 } | 1834 } |
1835 | 1835 |
1836 bool RenderLayer::hasAncestor(const RenderLayer* ancestor) const | |
1837 { | |
1838 if (!ancestor) | |
1839 return false; | |
1840 | |
1841 for (const RenderLayer* layer = this; layer; layer = layer->parent()) { | |
1842 if (layer == ancestor) | |
1843 return true; | |
1844 } | |
1845 | |
1846 return false; | |
1847 } | |
1848 | |
1836 void RenderLayer::removeOnlyThisLayer() | 1849 void RenderLayer::removeOnlyThisLayer() |
1837 { | 1850 { |
1838 if (!m_parent) | 1851 if (!m_parent) |
1839 return; | 1852 return; |
1840 | 1853 |
1841 // Mark that we are about to lose our layer. This makes render tree | 1854 // Mark that we are about to lose our layer. This makes render tree |
1842 // walks ignore this layer while we're removing it. | 1855 // walks ignore this layer while we're removing it. |
1843 m_renderer->setHasLayer(false); | 1856 m_renderer->setHasLayer(false); |
1844 | 1857 |
1845 compositor()->layerWillBeRemoved(m_parent, this); | 1858 compositor()->layerWillBeRemoved(m_parent, this); |
(...skipping 3070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4916 void RenderLayer::calculateClipRects(const ClipRectsContext& clipRectsContext, C lipRects& clipRects) const | 4929 void RenderLayer::calculateClipRects(const ClipRectsContext& clipRectsContext, C lipRects& clipRects) const |
4917 { | 4930 { |
4918 if (!parent()) { | 4931 if (!parent()) { |
4919 // The root layer's clip rect is always infinite. | 4932 // The root layer's clip rect is always infinite. |
4920 clipRects.reset(PaintInfo::infiniteRect()); | 4933 clipRects.reset(PaintInfo::infiniteRect()); |
4921 return; | 4934 return; |
4922 } | 4935 } |
4923 | 4936 |
4924 ClipRectsType clipRectsType = clipRectsContext.clipRectsType; | 4937 ClipRectsType clipRectsType = clipRectsContext.clipRectsType; |
4925 bool useCached = clipRectsType != TemporaryClipRects; | 4938 bool useCached = clipRectsType != TemporaryClipRects; |
4939 bool isRoot = this == clipRectsContext.rootLayer; | |
4926 | 4940 |
4927 // For transformed layers, the root layer was shifted to be us, so there is no need to | 4941 // For transformed layers, the root layer was shifted to be us, so there is no need to |
4928 // examine the parent. We want to cache clip rects with us as the root. | 4942 // examine the parent. We want to cache clip rects with us as the root. |
4929 RenderLayer* parentLayer = clipRectsContext.rootLayer != this ? parent() : 0 ; | 4943 RenderLayer* parentLayer = isRoot ? 0 : parent(); |
4930 | 4944 |
4931 // Ensure that our parent's clip has been calculated so that we can examine the values. | 4945 // Ensure that our parent's clip has been calculated so that we can examine the values. |
4932 if (parentLayer) { | 4946 if (parentLayer) { |
4933 if (useCached && parentLayer->clipRects(clipRectsContext)) | 4947 if (useCached && parentLayer->clipRects(clipRectsContext)) |
4934 clipRects = *parentLayer->clipRects(clipRectsContext); | 4948 clipRects = *parentLayer->clipRects(clipRectsContext); |
4935 else { | 4949 else { |
4936 ClipRectsContext parentContext(clipRectsContext); | 4950 ClipRectsContext parentContext(clipRectsContext); |
4937 parentContext.overlayScrollbarSizeRelevancy = IgnoreOverlayScrollbar Size; // FIXME: why? | 4951 parentContext.overlayScrollbarSizeRelevancy = IgnoreOverlayScrollbar Size; // FIXME: why? |
4952 if (this == clipRectsContext.scrollParent) | |
4953 parentContext.scrollParent = 0; | |
4938 parentLayer->calculateClipRects(parentContext, clipRects); | 4954 parentLayer->calculateClipRects(parentContext, clipRects); |
4939 } | 4955 } |
4940 } else | 4956 } else |
4941 clipRects.reset(PaintInfo::infiniteRect()); | 4957 clipRects.reset(PaintInfo::infiniteRect()); |
4942 | 4958 |
4943 // A fixed object is essentially the root of its containing block hierarchy, so when | 4959 // A fixed object is essentially the root of its containing block hierarchy, so when |
4944 // we encounter such an object, we reset our clip rects to the fixedClipRect . | 4960 // we encounter such an object, we reset our clip rects to the fixedClipRect . |
4945 if (renderer()->style()->position() == FixedPosition) { | 4961 if (renderer()->style()->position() == FixedPosition) { |
4946 clipRects.setPosClipRect(clipRects.fixedClipRect()); | 4962 clipRects.setPosClipRect(clipRects.fixedClipRect()); |
4947 clipRects.setOverflowClipRect(clipRects.fixedClipRect()); | 4963 clipRects.setOverflowClipRect(clipRects.fixedClipRect()); |
4948 clipRects.setFixed(true); | 4964 clipRects.setFixed(true); |
4949 } else if (renderer()->style()->hasInFlowPosition()) | 4965 } else if (renderer()->style()->hasInFlowPosition()) |
4950 clipRects.setPosClipRect(clipRects.overflowClipRect()); | 4966 clipRects.setPosClipRect(clipRects.overflowClipRect()); |
4951 else if (renderer()->style()->position() == AbsolutePosition) | 4967 else if (renderer()->style()->position() == AbsolutePosition) |
4952 clipRects.setOverflowClipRect(clipRects.posClipRect()); | 4968 clipRects.setOverflowClipRect(clipRects.posClipRect()); |
4953 | 4969 |
4954 // Update the clip rects that will be passed to child layers. | 4970 // Update the clip rects that will be passed to child layers. There are two reasons |
4955 if ((renderer()->hasOverflowClip() && (clipRectsContext.respectOverflowClip == RespectOverflowClip || this != clipRectsContext.rootLayer)) || renderer()->ha sClip()) { | 4971 // we may ignor the cilp here. If we've been told to ignore the overflow cli p (via |
enne (OOO)
2013/08/22 20:54:30
I won't ignor this cilp.
| |
4972 // ClipRectsContext::respectOverflowClip), we do so, but only if this is the clip | |
4973 // root (this setting only applies to the root layer). Also, if a scroll par ent is | |
4974 // set, we ignore all clips until we've reached it (the point of the scrollP arent | |
4975 // member of ClipRectsContext is to determine the clip the scrollParent esta blishes | |
4976 // with respect to the clipRoot, regardless of any subsequent clipping that may happen | |
4977 // between us and our scroll parent). | |
4978 bool shouldIgnoreClip = clipRectsContext.scrollParent && this != clipRectsCo ntext.scrollParent; | |
4979 bool shouldIgnoreOverflowClip = clipRectsContext.respectOverflowClip == Igno reOverflowClip && isRoot; | |
4980 | |
4981 bool shouldApplyClip = renderer()->hasClip() && !shouldIgnoreClip; | |
4982 bool shouldApplyOverflowClip = renderer()->hasOverflowClip() && !shouldIgnor eOverflowClip && !shouldIgnoreClip; | |
4983 | |
4984 if (shouldApplyOverflowClip || shouldApplyClip) { | |
4956 // This layer establishes a clip of some kind. | 4985 // This layer establishes a clip of some kind. |
4957 | 4986 |
4958 // This offset cannot use convertToLayerCoords, because sometimes our ro otLayer may be across | 4987 // This offset cannot use convertToLayerCoords, because sometimes our ro otLayer may be across |
4959 // some transformed layer boundary, for example, in the RenderLayerCompo sitor overlapMap, where | 4988 // some transformed layer boundary, for example, in the RenderLayerCompo sitor overlapMap, where |
4960 // clipRects are needed in view space. | 4989 // clipRects are needed in view space. |
4961 LayoutPoint offset; | 4990 LayoutPoint offset; |
4962 offset = roundedLayoutPoint(renderer()->localToContainerPoint(FloatPoint (), clipRectsContext.rootLayer->renderer())); | 4991 offset = roundedLayoutPoint(renderer()->localToContainerPoint(FloatPoint (), clipRectsContext.rootLayer->renderer())); |
4963 RenderView* view = renderer()->view(); | 4992 RenderView* view = renderer()->view(); |
4964 ASSERT(view); | 4993 ASSERT(view); |
4965 if (view && clipRects.fixed() && clipRectsContext.rootLayer->renderer() == view) { | 4994 if (view && clipRects.fixed() && clipRectsContext.rootLayer->renderer() == view) { |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5459 bool RenderLayer::hasCompositedMask() const | 5488 bool RenderLayer::hasCompositedMask() const |
5460 { | 5489 { |
5461 return m_backing && m_backing->hasMaskLayer(); | 5490 return m_backing && m_backing->hasMaskLayer(); |
5462 } | 5491 } |
5463 | 5492 |
5464 GraphicsLayer* RenderLayer::layerForScrolling() const | 5493 GraphicsLayer* RenderLayer::layerForScrolling() const |
5465 { | 5494 { |
5466 return m_backing ? m_backing->scrollingContentsLayer() : 0; | 5495 return m_backing ? m_backing->scrollingContentsLayer() : 0; |
5467 } | 5496 } |
5468 | 5497 |
5498 GraphicsLayer* RenderLayer::layerForScrollChild() const | |
5499 { | |
5500 // If we have an ancestor clipping layer because of our scroll parent, we do not want to | |
5501 // scroll that clip layer -- we need it to stay put and we will slide within it. If, on | |
5502 // the other hand, we have an ancestor clipping layer due to some other clip ping layer, we | |
5503 // want to scroll the root of the layer's associate graphics layer subtree. I.e., we want it | |
5504 // and its clip to move in concert. | |
5505 | |
5506 if (!backing()) | |
5507 return 0; | |
5508 | |
5509 if (backing()->hasAncestorScrollClippingLayer()) { | |
5510 return backing()->hasAncestorClippingLayer() | |
5511 ? backing()->ancestorClippingLayer() | |
5512 : backing()->graphicsLayer(); | |
5513 } | |
5514 | |
5515 if (renderer()->containingBlock()->enclosingLayer() == ancestorScrollingLaye r()) | |
5516 return backing()->graphicsLayer(); | |
5517 | |
5518 return backing()->childForSuperlayers(); | |
5519 } | |
5520 | |
5469 GraphicsLayer* RenderLayer::layerForHorizontalScrollbar() const | 5521 GraphicsLayer* RenderLayer::layerForHorizontalScrollbar() const |
5470 { | 5522 { |
5471 return m_backing ? m_backing->layerForHorizontalScrollbar() : 0; | 5523 return m_backing ? m_backing->layerForHorizontalScrollbar() : 0; |
5472 } | 5524 } |
5473 | 5525 |
5474 GraphicsLayer* RenderLayer::layerForVerticalScrollbar() const | 5526 GraphicsLayer* RenderLayer::layerForVerticalScrollbar() const |
5475 { | 5527 { |
5476 return m_backing ? m_backing->layerForVerticalScrollbar() : 0; | 5528 return m_backing ? m_backing->layerForVerticalScrollbar() : 0; |
5477 } | 5529 } |
5478 | 5530 |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6477 } | 6529 } |
6478 } | 6530 } |
6479 | 6531 |
6480 void showLayerTree(const WebCore::RenderObject* renderer) | 6532 void showLayerTree(const WebCore::RenderObject* renderer) |
6481 { | 6533 { |
6482 if (!renderer) | 6534 if (!renderer) |
6483 return; | 6535 return; |
6484 showLayerTree(renderer->enclosingLayer()); | 6536 showLayerTree(renderer->enclosingLayer()); |
6485 } | 6537 } |
6486 #endif | 6538 #endif |
OLD | NEW |