Bug 1339690 - Part 3: Drop spacing mode. r=birtles,smaug
MozReview-Commit-ID: 1c7jpzWQjVP
This commit is contained in:
@@ -10,9 +10,7 @@
|
||||
// For UnrestrictedDoubleOrKeyframeAnimationOptions
|
||||
#include "mozilla/dom/AnimationEffectTiming.h"
|
||||
#include "mozilla/dom/KeyframeEffectBinding.h"
|
||||
#include "mozilla/KeyframeUtils.h"
|
||||
#include "nsDOMMutationObserver.h" // For nsAutoAnimationMutationBatch
|
||||
#include "nsIScriptError.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@@ -113,8 +111,6 @@ KeyframeEffect::SetTarget(const Nullable<ElementOrCSSPseudoElement>& aTarget)
|
||||
RefPtr<nsStyleContext> styleContext = GetTargetStyleContext();
|
||||
if (styleContext) {
|
||||
UpdateProperties(styleContext);
|
||||
} else if (mEffectOptions.mSpacingMode == SpacingMode::paced) {
|
||||
KeyframeUtils::ApplyDistributeSpacing(mKeyframes);
|
||||
}
|
||||
|
||||
MaybeUpdateFrameForCompositor();
|
||||
@@ -125,9 +121,6 @@ KeyframeEffect::SetTarget(const Nullable<ElementOrCSSPseudoElement>& aTarget)
|
||||
if (mAnimation) {
|
||||
nsNodeUtils::AnimationAdded(mAnimation);
|
||||
}
|
||||
} else if (mEffectOptions.mSpacingMode == SpacingMode::paced) {
|
||||
// New target is null, so fall back to distribute spacing.
|
||||
KeyframeUtils::ApplyDistributeSpacing(mKeyframes);
|
||||
}
|
||||
|
||||
// If the new target frame is also oversized we should probably record that
|
||||
@@ -181,61 +174,5 @@ KeyframeEffect::SetComposite(const CompositeOperation& aComposite)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KeyframeEffect::SetSpacing(JSContext* aCx,
|
||||
const nsAString& aSpacing,
|
||||
CallerType aCallerType,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
SpacingMode spacingMode = SpacingMode::distribute;
|
||||
nsCSSPropertyID pacedProperty = eCSSProperty_UNKNOWN;
|
||||
nsAutoString invalidPacedProperty;
|
||||
KeyframeEffectParams::ParseSpacing(aSpacing,
|
||||
spacingMode,
|
||||
pacedProperty,
|
||||
invalidPacedProperty,
|
||||
aCallerType,
|
||||
aRv);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!invalidPacedProperty.IsEmpty()) {
|
||||
const char16_t* params[] = { invalidPacedProperty.get() };
|
||||
nsIDocument* doc = AnimationUtils::GetCurrentRealmDocument(aCx);
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
NS_LITERAL_CSTRING("Animation"),
|
||||
doc,
|
||||
nsContentUtils::eDOM_PROPERTIES,
|
||||
"UnanimatablePacedProperty",
|
||||
params, ArrayLength(params));
|
||||
}
|
||||
|
||||
if (mEffectOptions.mSpacingMode == spacingMode &&
|
||||
mEffectOptions.mPacedProperty == pacedProperty) {
|
||||
return;
|
||||
}
|
||||
|
||||
mEffectOptions.mSpacingMode = spacingMode;
|
||||
mEffectOptions.mPacedProperty = pacedProperty;
|
||||
|
||||
// Apply spacing. We apply distribute here. If the new spacing is paced,
|
||||
// UpdateProperties() will apply it.
|
||||
if (mEffectOptions.mSpacingMode == SpacingMode::distribute) {
|
||||
KeyframeUtils::ApplyDistributeSpacing(mKeyframes);
|
||||
}
|
||||
|
||||
if (mAnimation && mAnimation->IsRelevant()) {
|
||||
nsNodeUtils::AnimationChanged(mAnimation);
|
||||
}
|
||||
|
||||
if (mTarget) {
|
||||
RefPtr<nsStyleContext> styleContext = GetTargetStyleContext();
|
||||
if (styleContext) {
|
||||
UpdateProperties(styleContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
Reference in New Issue
Block a user