| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 } // namespace | 104 } // namespace |
| 105 | 105 |
| 106 using namespace HTMLNames; | 106 using namespace HTMLNames; |
| 107 | 107 |
| 108 RenderLayer::RenderLayer(RenderLayerModelObject* renderer, LayerType type) | 108 RenderLayer::RenderLayer(RenderLayerModelObject* renderer, LayerType type) |
| 109 : m_layerType(type) | 109 : m_layerType(type) |
| 110 , m_hasSelfPaintingLayerDescendant(false) | 110 , m_hasSelfPaintingLayerDescendant(false) |
| 111 , m_hasSelfPaintingLayerDescendantDirty(false) | 111 , m_hasSelfPaintingLayerDescendantDirty(false) |
| 112 , m_hasOutOfFlowPositionedDescendant(false) | 112 , m_hasOutOfFlowPositionedDescendant(false) |
| 113 , m_hasOutOfFlowPositionedDescendantDirty(true) | 113 , m_hasOutOfFlowPositionedDescendantDirty(true) |
| 114 , m_hasUnclippedDescendant(false) | |
| 115 , m_isUnclippedDescendant(false) | 114 , m_isUnclippedDescendant(false) |
| 116 , m_isRootLayer(renderer->isRenderView()) | 115 , m_isRootLayer(renderer->isRenderView()) |
| 117 , m_usedTransparency(false) | 116 , m_usedTransparency(false) |
| 118 , m_visibleContentStatusDirty(true) | 117 , m_visibleContentStatusDirty(true) |
| 119 , m_hasVisibleContent(false) | 118 , m_hasVisibleContent(false) |
| 120 , m_visibleDescendantStatusDirty(false) | 119 , m_visibleDescendantStatusDirty(false) |
| 121 , m_hasVisibleDescendant(false) | 120 , m_hasVisibleDescendant(false) |
| 122 , m_hasVisibleNonLayerContent(false) | 121 , m_hasVisibleNonLayerContent(false) |
| 123 , m_isPaginated(false) | 122 , m_isPaginated(false) |
| 124 , m_3DTransformedDescendantStatusDirty(true) | 123 , m_3DTransformedDescendantStatusDirty(true) |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 layer->setHasOutOfFlowPositionedDescendantDirty(false); | 361 layer->setHasOutOfFlowPositionedDescendantDirty(false); |
| 363 layer->setHasOutOfFlowPositionedDescendant(true); | 362 layer->setHasOutOfFlowPositionedDescendant(true); |
| 364 } | 363 } |
| 365 } | 364 } |
| 366 | 365 |
| 367 void RenderLayer::dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() | 366 void RenderLayer::dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() |
| 368 { | 367 { |
| 369 for (RenderLayer* layer = this; layer; layer = layer->parent()) { | 368 for (RenderLayer* layer = this; layer; layer = layer->parent()) { |
| 370 layer->setHasOutOfFlowPositionedDescendantDirty(true); | 369 layer->setHasOutOfFlowPositionedDescendantDirty(true); |
| 371 | 370 |
| 372 // We may or may not have an unclipped descendant. If we do, we'll reset | |
| 373 // this to true the next time composited scrolling state is updated. | |
| 374 layer->setHasUnclippedDescendant(false); | |
| 375 | |
| 376 // If we have reached an out of flow positioned layer, we know our paren
t should have an out-of-flow positioned descendant. | 371 // If we have reached an out of flow positioned layer, we know our paren
t should have an out-of-flow positioned descendant. |
| 377 // In this case, there is no need to dirty our ancestors further. | 372 // In this case, there is no need to dirty our ancestors further. |
| 378 if (layer->renderer()->isOutOfFlowPositioned()) { | 373 if (layer->renderer()->isOutOfFlowPositioned()) { |
| 379 ASSERT(!parent() || parent()->m_hasOutOfFlowPositionedDescendantDirt
y || parent()->hasOutOfFlowPositionedDescendant()); | 374 ASSERT(!parent() || parent()->m_hasOutOfFlowPositionedDescendantDirt
y || parent()->hasOutOfFlowPositionedDescendant()); |
| 380 break; | 375 break; |
| 381 } | 376 } |
| 382 } | 377 } |
| 383 } | 378 } |
| 384 | 379 |
| 385 bool RenderLayer::scrollsWithRespectTo(const RenderLayer* other) const | 380 bool RenderLayer::scrollsWithRespectTo(const RenderLayer* other) const |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 { | 795 { |
| 801 for (RenderLayer* layer = this; layer; layer = layer->parent()) { | 796 for (RenderLayer* layer = this; layer; layer = layer->parent()) { |
| 802 if (!layer->m_visibleDescendantStatusDirty && layer->hasVisibleDescendan
t()) | 797 if (!layer->m_visibleDescendantStatusDirty && layer->hasVisibleDescendan
t()) |
| 803 break; | 798 break; |
| 804 | 799 |
| 805 layer->m_hasVisibleDescendant = true; | 800 layer->m_hasVisibleDescendant = true; |
| 806 layer->m_visibleDescendantStatusDirty = false; | 801 layer->m_visibleDescendantStatusDirty = false; |
| 807 } | 802 } |
| 808 } | 803 } |
| 809 | 804 |
| 810 void RenderLayer::updateHasUnclippedDescendant() | 805 void RenderLayer::updateIsUnclippedDescendant() |
| 811 { | 806 { |
| 812 TRACE_EVENT0("blink_rendering", "RenderLayer::updateHasUnclippedDescendant")
; | 807 TRACE_EVENT0("blink_rendering", "RenderLayer::updateIsUnclippedDescendant"); |
| 813 ASSERT(renderer()->isOutOfFlowPositioned()); | 808 ASSERT(renderer()->isOutOfFlowPositioned()); |
| 814 if (!m_hasVisibleContent && !m_hasVisibleDescendant) | 809 if (!m_hasVisibleContent && !m_hasVisibleDescendant) |
| 815 return; | 810 return; |
| 816 | 811 |
| 817 FrameView* frameView = renderer()->view()->frameView(); | 812 FrameView* frameView = renderer()->view()->frameView(); |
| 818 if (!frameView) | 813 if (!frameView) |
| 819 return; | 814 return; |
| 820 | 815 |
| 816 setIsUnclippedDescendant(false); |
| 817 |
| 821 const RenderObject* containingBlock = renderer()->containingBlock(); | 818 const RenderObject* containingBlock = renderer()->containingBlock(); |
| 822 setIsUnclippedDescendant(false); | |
| 823 for (RenderLayer* ancestor = parent(); ancestor && ancestor->renderer() != c
ontainingBlock; ancestor = ancestor->parent()) { | 819 for (RenderLayer* ancestor = parent(); ancestor && ancestor->renderer() != c
ontainingBlock; ancestor = ancestor->parent()) { |
| 824 // TODO(vollick): This isn't quite right. Whenever ancestor is composite
d and clips | 820 // TODO(vollick): This isn't quite right. Whenever ancestor is composite
d and clips |
| 825 // overflow, we're technically unclipped. However, this will currently c
ause a huge | 821 // overflow, we're technically unclipped. However, this will currently c
ause a huge |
| 826 // number of layers to report that they are unclipped. Eventually, when
we've formally | 822 // number of layers to report that they are unclipped. Eventually, when
we've formally |
| 827 // separated the clipping, transform, opacity, and stacking trees here a
nd in the | 823 // separated the clipping, transform, opacity, and stacking trees here a
nd in the |
| 828 // compositor, we will be able to relax this restriction without it bein
g prohibitively | 824 // compositor, we will be able to relax this restriction without it bein
g prohibitively |
| 829 // expensive (currently, we have to do a lot of work in the compositor t
o honor a | 825 // expensive (currently, we have to do a lot of work in the compositor t
o honor a |
| 830 // clip child/parent relationship). | 826 // clip child/parent relationship). |
| 831 if (ancestor->scrollsOverflow()) | 827 if (ancestor->scrollsOverflow()) { |
| 832 setIsUnclippedDescendant(true); | 828 setIsUnclippedDescendant(true); |
| 833 ancestor->setHasUnclippedDescendant(true); | 829 return; |
| 830 } |
| 834 } | 831 } |
| 835 } | 832 } |
| 836 | 833 |
| 837 // FIXME: this is quite brute-force. We could be more efficient if we were to | 834 // FIXME: this is quite brute-force. We could be more efficient if we were to |
| 838 // track state and update it as appropriate as changes are made in the Render tr
ee. | 835 // track state and update it as appropriate as changes are made in the Render tr
ee. |
| 839 void RenderLayer::updateScrollingStateAfterCompositingChange() | 836 void RenderLayer::updateScrollingStateAfterCompositingChange() |
| 840 { | 837 { |
| 841 TRACE_EVENT0("blink_rendering", "RenderLayer::updateScrollingStateAfterCompo
sitingChange"); | 838 TRACE_EVENT0("blink_rendering", "RenderLayer::updateScrollingStateAfterCompo
sitingChange"); |
| 842 m_hasVisibleNonLayerContent = false; | 839 m_hasVisibleNonLayerContent = false; |
| 843 for (RenderObject* r = renderer()->slowFirstChild(); r; r = r->nextSibling()
) { | 840 for (RenderObject* r = renderer()->slowFirstChild(); r; r = r->nextSibling()
) { |
| (...skipping 2898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3742 | 3739 |
| 3743 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle) | 3740 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle) |
| 3744 { | 3741 { |
| 3745 ASSERT(!oldStyle || renderer()->style()->position() != oldStyle->position())
; | 3742 ASSERT(!oldStyle || renderer()->style()->position() != oldStyle->position())
; |
| 3746 | 3743 |
| 3747 bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == AbsoluteP
osition || oldStyle->position() == FixedPosition); | 3744 bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == AbsoluteP
osition || oldStyle->position() == FixedPosition); |
| 3748 bool isOutOfFlowPositioned = renderer()->isOutOfFlowPositioned(); | 3745 bool isOutOfFlowPositioned = renderer()->isOutOfFlowPositioned(); |
| 3749 if (!wasOutOfFlowPositioned && !isOutOfFlowPositioned) | 3746 if (!wasOutOfFlowPositioned && !isOutOfFlowPositioned) |
| 3750 return; | 3747 return; |
| 3751 | 3748 |
| 3752 // Even if the layer remains out-of-flow, a change to this property | |
| 3753 // will likely change its containing block. We must clear these bits | |
| 3754 // so that they can be set properly by the RenderLayerCompositor. | |
| 3755 for (RenderLayer* ancestor = parent(); ancestor; ancestor = ancestor->parent
()) | |
| 3756 ancestor->setHasUnclippedDescendant(false); | |
| 3757 | |
| 3758 // Ensures that we reset the above bits correctly. | 3749 // Ensures that we reset the above bits correctly. |
| 3759 compositor()->setNeedsUpdateCompositingRequirementsState(); | 3750 compositor()->setNeedsUpdateCompositingRequirementsState(); |
| 3760 | 3751 |
| 3761 if (wasOutOfFlowPositioned && isOutOfFlowPositioned) | 3752 if (wasOutOfFlowPositioned && isOutOfFlowPositioned) |
| 3762 return; | 3753 return; |
| 3763 | 3754 |
| 3764 if (isOutOfFlowPositioned) { | 3755 if (isOutOfFlowPositioned) { |
| 3765 setAncestorChainHasOutOfFlowPositionedDescendant(); | 3756 setAncestorChainHasOutOfFlowPositionedDescendant(); |
| 3766 compositor()->addOutOfFlowPositionedLayer(this); | 3757 compositor()->addOutOfFlowPositionedLayer(this); |
| 3767 } else { | 3758 } else { |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4063 } | 4054 } |
| 4064 } | 4055 } |
| 4065 | 4056 |
| 4066 void showLayerTree(const WebCore::RenderObject* renderer) | 4057 void showLayerTree(const WebCore::RenderObject* renderer) |
| 4067 { | 4058 { |
| 4068 if (!renderer) | 4059 if (!renderer) |
| 4069 return; | 4060 return; |
| 4070 showLayerTree(renderer->enclosingLayer()); | 4061 showLayerTree(renderer->enclosingLayer()); |
| 4071 } | 4062 } |
| 4072 #endif | 4063 #endif |
| OLD | NEW |