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 3675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3686 | 3686 |
3687 return false; | 3687 return false; |
3688 } | 3688 } |
3689 | 3689 |
3690 static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newS
tyle) | 3690 static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newS
tyle) |
3691 { | 3691 { |
3692 ASSERT(newStyle); | 3692 ASSERT(newStyle); |
3693 return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter(); | 3693 return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter(); |
3694 } | 3694 } |
3695 | 3695 |
3696 inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle*
oldStyle, const RenderStyle* newStyle) const | |
3697 { | |
3698 ASSERT(newStyle); | |
3699 return oldStyle && (oldStyle->clip() != newStyle->clip() || oldStyle->hasCli
p() != newStyle->hasClip()); | |
3700 } | |
3701 | |
3702 inline bool RenderLayer::needsCompositingLayersRebuiltForOverflow(const RenderSt
yle* oldStyle, const RenderStyle* newStyle) const | |
3703 { | |
3704 ASSERT(newStyle); | |
3705 if (hasCompositedLayerMapping()) | |
3706 return false; | |
3707 if (!oldStyle) | |
3708 return false; | |
3709 if (oldStyle->overflowX() == newStyle->overflowX()) | |
3710 return false; | |
3711 RenderLayerStackingNode* stackingNode = m_stackingNode->ancestorStackingCont
extNode(); | |
3712 return stackingNode && stackingNode->layer()->hasCompositingDescendant(); | |
3713 } | |
3714 | |
3715 inline bool RenderLayer::needsCompositingLayersRebuiltForFilters(const RenderSty
le* oldStyle, const RenderStyle* newStyle) const | |
3716 { | |
3717 if (!hasOrHadFilters(oldStyle, newStyle)) | |
3718 return false; | |
3719 | |
3720 if (newStyle->isRunningFilterAnimationOnCompositor()) { | |
3721 // When the compositor is performing the filter animation, we shouldn't
touch the compositing layers. | |
3722 // All of the layers above us should have been promoted to compositing l
ayers already. | |
3723 return false; | |
3724 } | |
3725 | |
3726 FilterOutsets newOutsets = newStyle->filterOutsets(); | |
3727 if (oldStyle && (oldStyle->filterOutsets() != newOutsets)) { | |
3728 // When filter outsets change, we need to: | |
3729 // (1) Recompute the overlap map to promote the correct layers to compos
ited layers. | |
3730 // (2) Update the composited layer bounds (and child GraphicsLayer posit
ions) on platforms | |
3731 // whose compositors can't compute their own filter outsets. | |
3732 return true; | |
3733 } | |
3734 | |
3735 return false; | |
3736 } | |
3737 | |
3738 inline bool RenderLayer::needsCompositingLayersRebuiltForBlending(const RenderSt
yle* oldStyle, const RenderStyle* newStyle) const | |
3739 { | |
3740 ASSERT(newStyle); | |
3741 if (!hasCompositedLayerMapping()) | |
3742 return false; | |
3743 return (shouldIsolateCompositedDescendants() && !stackingNode()->isStackingC
ontext()) | |
3744 || (oldStyle && (oldStyle->hasBlendMode() != newStyle->hasBlendMode())); | |
3745 } | |
3746 | |
3747 void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle*
newStyle) | 3696 void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle*
newStyle) |
3748 { | 3697 { |
3749 if (!hasOrHadFilters(oldStyle, newStyle)) | 3698 if (!hasOrHadFilters(oldStyle, newStyle)) |
3750 return; | 3699 return; |
3751 | 3700 |
3752 updateOrRemoveFilterClients(); | 3701 updateOrRemoveFilterClients(); |
3753 // During an accelerated animation, both WebKit and the compositor animate p
roperties. | 3702 // During an accelerated animation, both WebKit and the compositor animate p
roperties. |
3754 // However, WebKit shouldn't ask the compositor to update its filters if the
compositor is performing the animation. | 3703 // However, WebKit shouldn't ask the compositor to update its filters if the
compositor is performing the animation. |
3755 if (hasCompositedLayerMapping() && !newStyle->isRunningFilterAnimationOnComp
ositor()) | 3704 if (hasCompositedLayerMapping() && !newStyle->isRunningFilterAnimationOnComp
ositor()) |
3756 compositedLayerMapping()->updateFilters(renderer()->style()); | 3705 compositedLayerMapping()->updateFilters(renderer()->style()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3789 } | 3738 } |
3790 | 3739 |
3791 compositor()->updateStyleDeterminedCompositingReasons(this); | 3740 compositor()->updateStyleDeterminedCompositingReasons(this); |
3792 | 3741 |
3793 setNeedsToUpdateAncestorDependentProperties(); | 3742 setNeedsToUpdateAncestorDependentProperties(); |
3794 | 3743 |
3795 // FIXME: Remove incremental compositing updates after fixing the chicken/eg
g issues | 3744 // FIXME: Remove incremental compositing updates after fixing the chicken/eg
g issues |
3796 // https://code.google.com/p/chromium/issues/detail?id=343756 | 3745 // https://code.google.com/p/chromium/issues/detail?id=343756 |
3797 DisableCompositingQueryAsserts disabler; | 3746 DisableCompositingQueryAsserts disabler; |
3798 | 3747 |
3799 const RenderStyle* newStyle = renderer()->style(); | |
3800 | |
3801 compositor()->updateLayerCompositingState(this, RenderLayerCompositor::UseCh
ickenEggHacks); | 3748 compositor()->updateLayerCompositingState(this, RenderLayerCompositor::UseCh
ickenEggHacks); |
3802 // FIXME: this compositing logic should be pushed into the compositing code,
not here. | |
3803 // Moving the filter code will require caching the presence of a filter on o
ldStyle and | |
3804 // the outsets for that filter, so that we can detect a change in outsets. | |
3805 if (needsCompositingLayersRebuiltForClip(oldStyle, newStyle) | |
3806 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) | |
3807 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle) | |
3808 || needsCompositingLayersRebuiltForBlending(oldStyle, newStyle)) { | |
3809 compositor()->setCompositingLayersNeedRebuild(); | |
3810 } | |
3811 } | 3749 } |
3812 | 3750 |
3813 bool RenderLayer::scrollsOverflow() const | 3751 bool RenderLayer::scrollsOverflow() const |
3814 { | 3752 { |
3815 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea()) | 3753 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea()) |
3816 return scrollableArea->scrollsOverflow(); | 3754 return scrollableArea->scrollsOverflow(); |
3817 | 3755 |
3818 return false; | 3756 return false; |
3819 } | 3757 } |
3820 | 3758 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3962 } | 3900 } |
3963 } | 3901 } |
3964 | 3902 |
3965 void showLayerTree(const WebCore::RenderObject* renderer) | 3903 void showLayerTree(const WebCore::RenderObject* renderer) |
3966 { | 3904 { |
3967 if (!renderer) | 3905 if (!renderer) |
3968 return; | 3906 return; |
3969 showLayerTree(renderer->enclosingLayer()); | 3907 showLayerTree(renderer->enclosingLayer()); |
3970 } | 3908 } |
3971 #endif | 3909 #endif |
OLD | NEW |