зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1331704 - Part 3: Drop all of unused stuff. r=birtles a=abillings
MozReview-Commit-ID: BWAC0iZLw6t
This commit is contained in:
Родитель
14613aa3a3
Коммит
1c96a1ad82
|
@ -355,8 +355,6 @@ EffectCompositor::UpdateEffectProperties(nsStyleContext* aStyleContext,
|
||||||
// e.g removing !important, so we should update the cascading result.
|
// e.g removing !important, so we should update the cascading result.
|
||||||
effectSet->MarkCascadeNeedsUpdate();
|
effectSet->MarkCascadeNeedsUpdate();
|
||||||
|
|
||||||
ClearBaseStyles(*aElement, aPseudoType);
|
|
||||||
|
|
||||||
for (KeyframeEffectReadOnly* effect : *effectSet) {
|
for (KeyframeEffectReadOnly* effect : *effectSet) {
|
||||||
effect->UpdateProperties(aStyleContext);
|
effect->UpdateProperties(aStyleContext);
|
||||||
}
|
}
|
||||||
|
@ -948,79 +946,6 @@ EffectCompositor::SetPerformanceWarning(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ StyleAnimationValue
|
|
||||||
EffectCompositor::GetBaseStyle(nsCSSPropertyID aProperty,
|
|
||||||
nsStyleContext* aStyleContext,
|
|
||||||
dom::Element& aElement,
|
|
||||||
CSSPseudoElementType aPseudoType)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aStyleContext, "Need style context to resolve the base value");
|
|
||||||
MOZ_ASSERT(!aStyleContext->StyleSource().IsServoComputedValues(),
|
|
||||||
"Bug 1311257: Servo backend does not support the base value yet");
|
|
||||||
|
|
||||||
StyleAnimationValue result;
|
|
||||||
|
|
||||||
EffectSet* effectSet =
|
|
||||||
EffectSet::GetEffectSet(&aElement, aPseudoType);
|
|
||||||
if (!effectSet) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check whether there is a cached style.
|
|
||||||
result = effectSet->GetBaseStyle(aProperty);
|
|
||||||
if (!result.IsNull()) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<nsStyleContext> styleContextWithoutAnimation =
|
|
||||||
aStyleContext->PresContext()->StyleSet()->AsGecko()->
|
|
||||||
ResolveStyleByRemovingAnimation(&aElement, aStyleContext,
|
|
||||||
eRestyle_AllHintsWithAnimations);
|
|
||||||
|
|
||||||
DebugOnly<bool> success =
|
|
||||||
StyleAnimationValue::ExtractComputedValue(aProperty,
|
|
||||||
styleContextWithoutAnimation,
|
|
||||||
result);
|
|
||||||
MOZ_ASSERT(success, "Should be able to extract computed animation value");
|
|
||||||
MOZ_ASSERT(!result.IsNull(), "Should have a valid StyleAnimationValue");
|
|
||||||
|
|
||||||
effectSet->PutBaseStyle(aProperty, result);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */ StyleAnimationValue
|
|
||||||
EffectCompositor::GetBaseStyle(nsCSSPropertyID aProperty,
|
|
||||||
const nsIFrame* aFrame)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aFrame->StyleContext(),
|
|
||||||
"The frame should have a valid style context");
|
|
||||||
|
|
||||||
Maybe<NonOwningAnimationTarget> pseudoElement =
|
|
||||||
EffectCompositor::GetAnimationElementAndPseudoForFrame(aFrame);
|
|
||||||
|
|
||||||
MOZ_ASSERT(pseudoElement && pseudoElement->mElement,
|
|
||||||
"The frame should have an associated element");
|
|
||||||
|
|
||||||
return EffectCompositor::GetBaseStyle(aProperty,
|
|
||||||
aFrame->StyleContext(),
|
|
||||||
*pseudoElement->mElement,
|
|
||||||
pseudoElement->mPseudoType);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */ void
|
|
||||||
EffectCompositor::ClearBaseStyles(dom::Element& aElement,
|
|
||||||
CSSPseudoElementType aPseudoType)
|
|
||||||
{
|
|
||||||
EffectSet* effectSet =
|
|
||||||
EffectSet::GetEffectSet(&aElement, aPseudoType);
|
|
||||||
if (!effectSet) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
effectSet->ClearBaseStyles();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Nested class: AnimationStyleRuleProcessor
|
// Nested class: AnimationStyleRuleProcessor
|
||||||
|
|
|
@ -233,25 +233,6 @@ public:
|
||||||
nsCSSPropertyID aProperty,
|
nsCSSPropertyID aProperty,
|
||||||
const AnimationPerformanceWarning& aWarning);
|
const AnimationPerformanceWarning& aWarning);
|
||||||
|
|
||||||
// Returns the base style of (pseudo-)element for |aProperty|.
|
|
||||||
// If there is no cached base style for the property, a new base style value
|
|
||||||
// is resolved with |aStyleContext|. The new resolved base style is cached
|
|
||||||
// until ClearBaseStyles is called.
|
|
||||||
static StyleAnimationValue GetBaseStyle(nsCSSPropertyID aProperty,
|
|
||||||
nsStyleContext* aStyleContext,
|
|
||||||
dom::Element& aElement,
|
|
||||||
CSSPseudoElementType aPseudoType);
|
|
||||||
|
|
||||||
// Returns the base style corresponding to |aFrame|.
|
|
||||||
// This function should be called only after restyle process has done, i.e.
|
|
||||||
// |aFrame| has a resolved style context.
|
|
||||||
static StyleAnimationValue GetBaseStyle(nsCSSPropertyID aProperty,
|
|
||||||
const nsIFrame* aFrame);
|
|
||||||
|
|
||||||
// Clear cached base styles of (pseudo-)element.
|
|
||||||
static void ClearBaseStyles(dom::Element& aElement,
|
|
||||||
CSSPseudoElementType aPseudoType);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~EffectCompositor() = default;
|
~EffectCompositor() = default;
|
||||||
|
|
||||||
|
|
|
@ -199,26 +199,6 @@ public:
|
||||||
return mPropertiesForAnimationsLevel;
|
return mPropertiesForAnimationsLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is intended to be called by EffectCompositor::GetBaseStyle
|
|
||||||
// and should not be called directly.
|
|
||||||
StyleAnimationValue GetBaseStyle(nsCSSPropertyID aProperty) const
|
|
||||||
{
|
|
||||||
StyleAnimationValue result;
|
|
||||||
DebugOnly<bool> hasProperty = mBaseStyleValues.Get(aProperty, &result);
|
|
||||||
MOZ_ASSERT(hasProperty || result.IsNull());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PutBaseStyle(nsCSSPropertyID aProperty,
|
|
||||||
const StyleAnimationValue& aValue)
|
|
||||||
{
|
|
||||||
return mBaseStyleValues.Put(aProperty, aValue);
|
|
||||||
}
|
|
||||||
void ClearBaseStyles()
|
|
||||||
{
|
|
||||||
return mBaseStyleValues.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static nsIAtom* GetEffectSetPropertyAtom(CSSPseudoElementType aPseudoType);
|
static nsIAtom* GetEffectSetPropertyAtom(CSSPseudoElementType aPseudoType);
|
||||||
|
|
||||||
|
@ -267,11 +247,6 @@ private:
|
||||||
// composing the animation style for the transitions level of the cascede.
|
// composing the animation style for the transitions level of the cascede.
|
||||||
nsCSSPropertyIDSet mPropertiesForAnimationsLevel;
|
nsCSSPropertyIDSet mPropertiesForAnimationsLevel;
|
||||||
|
|
||||||
// The non-animated values for properties animated by effects in this set that
|
|
||||||
// contain at least one animation value that is composited with the underlying
|
|
||||||
// value (i.e. it uses the additive or accumulate composite mode).
|
|
||||||
nsDataHashtable<nsUint32HashKey, StyleAnimationValue> mBaseStyleValues;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// Track how many iterators are referencing this effect set when we are
|
// Track how many iterators are referencing this effect set when we are
|
||||||
// destroyed, we can assert that nothing is still pointing to us.
|
// destroyed, we can assert that nothing is still pointing to us.
|
||||||
|
|
|
@ -950,9 +950,8 @@ KeyframeEffectReadOnly::RequestRestyle(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<KeyframeEffectReadOnly::AnimationStyle aAnimationStyle>
|
|
||||||
already_AddRefed<nsStyleContext>
|
already_AddRefed<nsStyleContext>
|
||||||
KeyframeEffectReadOnly::DoGetTargetStyleContext()
|
KeyframeEffectReadOnly::GetTargetStyleContext()
|
||||||
{
|
{
|
||||||
nsIPresShell* shell = GetPresShell();
|
nsIPresShell* shell = GetPresShell();
|
||||||
if (!shell) {
|
if (!shell) {
|
||||||
|
@ -966,26 +965,9 @@ KeyframeEffectReadOnly::DoGetTargetStyleContext()
|
||||||
? nsCSSPseudoElements::GetPseudoAtom(mTarget->mPseudoType)
|
? nsCSSPseudoElements::GetPseudoAtom(mTarget->mPseudoType)
|
||||||
: nullptr;
|
: nullptr;
|
||||||
|
|
||||||
if (aAnimationStyle == AnimationStyle::Include) {
|
return nsComputedDOMStyle::GetStyleContextForElement(mTarget->mElement,
|
||||||
return nsComputedDOMStyle::GetStyleContextForElement(mTarget->mElement,
|
pseudo,
|
||||||
pseudo,
|
shell);
|
||||||
shell);
|
|
||||||
}
|
|
||||||
|
|
||||||
return nsComputedDOMStyle::GetStyleContextForElementWithoutAnimation(
|
|
||||||
mTarget->mElement, pseudo, shell);
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<nsStyleContext>
|
|
||||||
KeyframeEffectReadOnly::GetTargetStyleContext()
|
|
||||||
{
|
|
||||||
return DoGetTargetStyleContext<AnimationStyle::Include>();
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<nsStyleContext>
|
|
||||||
KeyframeEffectReadOnly::GetTargetStyleContextWithoutAnimation()
|
|
||||||
{
|
|
||||||
return DoGetTargetStyleContext<AnimationStyle::Skip>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
|
@ -355,18 +355,6 @@ protected:
|
||||||
// infinite recursion.
|
// infinite recursion.
|
||||||
already_AddRefed<nsStyleContext> GetTargetStyleContext();
|
already_AddRefed<nsStyleContext> GetTargetStyleContext();
|
||||||
|
|
||||||
// Similar to the above but ignoring animation rules. We use this to get base
|
|
||||||
// styles (which don't include animation rules).
|
|
||||||
already_AddRefed<nsStyleContext>
|
|
||||||
GetTargetStyleContextWithoutAnimation();
|
|
||||||
|
|
||||||
enum AnimationStyle {
|
|
||||||
Skip,
|
|
||||||
Include
|
|
||||||
};
|
|
||||||
template<AnimationStyle aAnimationStyle>
|
|
||||||
already_AddRefed<nsStyleContext> DoGetTargetStyleContext();
|
|
||||||
|
|
||||||
// A wrapper for marking cascade update according to the current
|
// A wrapper for marking cascade update according to the current
|
||||||
// target and its effectSet.
|
// target and its effectSet.
|
||||||
void MarkCascadeNeedsUpdate();
|
void MarkCascadeNeedsUpdate();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче