Bug 1230056 part 2 - Remove nsLayoutUtils::HasAnimationsForCompositor and call EffectCompositor::HasAnimationsForCompositor directly; r=dholbert

This commit is contained in:
Brian Birtles 2015-12-09 16:28:10 -05:00
parent 4a5d70c96e
commit ab475ec0ac
5 changed files with 15 additions and 23 deletions

View File

@ -35,6 +35,7 @@
#include "nsSVGIntegrationUtils.h" #include "nsSVGIntegrationUtils.h"
#include "mozilla/LayerTimelineMarker.h" #include "mozilla/LayerTimelineMarker.h"
#include "mozilla/EffectCompositor.h"
#include "mozilla/Move.h" #include "mozilla/Move.h"
#include "mozilla/ReverseIterator.h" #include "mozilla/ReverseIterator.h"
#include "mozilla/gfx/2D.h" #include "mozilla/gfx/2D.h"
@ -5107,7 +5108,7 @@ ChooseScaleAndSetTransform(FrameLayerBuilder* aLayerBuilder,
// for animation // for animation
if (aContainerItem && if (aContainerItem &&
aContainerItem->GetType() == nsDisplayItem::TYPE_TRANSFORM && aContainerItem->GetType() == nsDisplayItem::TYPE_TRANSFORM &&
nsLayoutUtils::HasAnimationsForCompositor( EffectCompositor::HasAnimationsForCompositor(
aContainerFrame, eCSSProperty_transform)) { aContainerFrame, eCSSProperty_transform)) {
// Use the size of the nearest widget as the maximum size. This // Use the size of the nearest widget as the maximum size. This
// is important since it might be a popup that is bigger than the // is important since it might be a popup that is bigger than the

View File

@ -780,7 +780,8 @@ void nsDisplayListBuilder::MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame,
nsRect overflowRect = aFrame->GetVisualOverflowRect(); nsRect overflowRect = aFrame->GetVisualOverflowRect();
if (aFrame->IsTransformed() && if (aFrame->IsTransformed() &&
nsLayoutUtils::HasAnimationsForCompositor(aFrame, eCSSProperty_transform)) { EffectCompositor::HasAnimationsForCompositor(aFrame,
eCSSProperty_transform)) {
/** /**
* Add a fuzz factor to the overflow rectangle so that elements only just * Add a fuzz factor to the overflow rectangle so that elements only just
* out of view are pulled into the display list, so they can be * out of view are pulled into the display list, so they can be
@ -4076,7 +4077,8 @@ nsDisplayOpacity::NeedsActiveLayer(nsDisplayListBuilder* aBuilder)
if (ActiveLayerTracker::IsStyleAnimated(aBuilder, mFrame, eCSSProperty_opacity) && if (ActiveLayerTracker::IsStyleAnimated(aBuilder, mFrame, eCSSProperty_opacity) &&
!IsItemTooSmallForActiveLayer(this)) !IsItemTooSmallForActiveLayer(this))
return true; return true;
if (nsLayoutUtils::HasAnimationsForCompositor(mFrame, eCSSProperty_opacity)) { if (EffectCompositor::HasAnimationsForCompositor(mFrame,
eCSSProperty_opacity)) {
return true; return true;
} }
return false; return false;
@ -5434,7 +5436,8 @@ nsDisplayTransform::ShouldPrerenderTransformedContent(nsDisplayListBuilder* aBui
// might have only just had its transform animated in which case // might have only just had its transform animated in which case
// the ActiveLayerManager may not have been notified yet. // the ActiveLayerManager may not have been notified yet.
if (!ActiveLayerTracker::IsStyleMaybeAnimated(aFrame, eCSSProperty_transform) && if (!ActiveLayerTracker::IsStyleMaybeAnimated(aFrame, eCSSProperty_transform) &&
!nsLayoutUtils::HasAnimationsForCompositor(aFrame, eCSSProperty_transform)) { !EffectCompositor::HasAnimationsForCompositor(aFrame,
eCSSProperty_transform)) {
if (aLogAnimations) { if (aLogAnimations) {
nsCString message; nsCString message;
message.AppendLiteral("Performance warning: Async animation disabled because frame was not marked active for transform animation"); message.AppendLiteral("Performance warning: Async animation disabled because frame was not marked active for transform animation");
@ -5634,7 +5637,8 @@ nsDisplayTransform::GetLayerState(nsDisplayListBuilder* aBuilder,
if (ActiveLayerTracker::IsStyleAnimated(aBuilder, mFrame, eCSSProperty_transform) && if (ActiveLayerTracker::IsStyleAnimated(aBuilder, mFrame, eCSSProperty_transform) &&
!IsItemTooSmallForActiveLayer(this)) !IsItemTooSmallForActiveLayer(this))
return LAYER_ACTIVE; return LAYER_ACTIVE;
if (nsLayoutUtils::HasAnimationsForCompositor(mFrame, eCSSProperty_transform)) { if (EffectCompositor::HasAnimationsForCompositor(mFrame,
eCSSProperty_transform)) {
return LAYER_ACTIVE; return LAYER_ACTIVE;
} }

View File

@ -370,13 +370,6 @@ FloatLogicalValuesEnabledPrefChangeCallback(const char* aPrefName,
isFloatLogicalValuesEnabled ? eCSSKeyword_inline_end : eCSSKeyword_UNKNOWN; isFloatLogicalValuesEnabled ? eCSSKeyword_inline_end : eCSSKeyword_UNKNOWN;
} }
bool
nsLayoutUtils::HasAnimationsForCompositor(const nsIFrame* aFrame,
nsCSSProperty aProperty)
{
return !EffectCompositor::HasAnimationsForCompositor(aFrame, aProperty);
}
template<typename TestType> template<typename TestType>
static bool static bool
HasMatchingCurrentAnimations(const nsIFrame* aFrame, TestType&& aTest) HasMatchingCurrentAnimations(const nsIFrame* aFrame, TestType&& aTest)

View File

@ -2208,13 +2208,6 @@ public:
nsIContent* &aContentResult, nsIContent* &aContentResult,
nsCSSPseudoElements::Type &aPseudoTypeResult); nsCSSPseudoElements::Type &aPseudoTypeResult);
/**
* Returns true if the frame has animations or transitions that can be
* performed on the compositor.
*/
static bool HasAnimationsForCompositor(const nsIFrame* aFrame,
nsCSSProperty aProperty);
/** /**
* Returns true if the frame has current (i.e. running or scheduled-to-run) * Returns true if the frame has current (i.e. running or scheduled-to-run)
* animations or transitions for the property. * animations or transitions for the property.

View File

@ -87,6 +87,7 @@
#include "nsIFrameInlines.h" #include "nsIFrameInlines.h"
#include "mozilla/AsyncEventDispatcher.h" #include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/EffectCompositor.h"
#include "mozilla/EventListenerManager.h" #include "mozilla/EventListenerManager.h"
#include "mozilla/EventStateManager.h" #include "mozilla/EventStateManager.h"
#include "mozilla/EventStates.h" #include "mozilla/EventStates.h"
@ -1083,8 +1084,8 @@ nsIFrame::IsTransformed() const
(StyleDisplay()->HasTransform(this) || (StyleDisplay()->HasTransform(this) ||
IsSVGTransformed() || IsSVGTransformed() ||
(mContent && (mContent &&
nsLayoutUtils::HasAnimationsForCompositor(this, EffectCompositor::HasAnimationsForCompositor(
eCSSProperty_transform) && this, eCSSProperty_transform) &&
IsFrameOfType(eSupportsCSSTransforms) && IsFrameOfType(eSupportsCSSTransforms) &&
mContent->GetPrimaryFrame() == this))); mContent->GetPrimaryFrame() == this)));
} }
@ -1097,8 +1098,8 @@ nsIFrame::HasOpacityInternal(float aThreshold) const
return StyleDisplay()->mOpacity < aThreshold || return StyleDisplay()->mOpacity < aThreshold ||
(displayStyle->mWillChangeBitField & NS_STYLE_WILL_CHANGE_OPACITY) || (displayStyle->mWillChangeBitField & NS_STYLE_WILL_CHANGE_OPACITY) ||
(mContent && (mContent &&
nsLayoutUtils::HasAnimationsForCompositor(this, EffectCompositor::HasAnimationsForCompositor(
eCSSProperty_opacity) && this, eCSSProperty_opacity) &&
mContent->GetPrimaryFrame() == this); mContent->GetPrimaryFrame() == this);
} }