mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1274944 - Part 2: Implement SetSpacing(). r=birtles
MozReview-Commit-ID: ASJHVK97gq6 --HG-- extra : rebase_source : 6cdd2118c9aeecd2feb41a794781d85b6ae7ac67
This commit is contained in:
parent
adeea43b3b
commit
f31b43fda5
@ -12,6 +12,7 @@
|
||||
#include "mozilla/dom/KeyframeEffectBinding.h"
|
||||
#include "mozilla/KeyframeUtils.h"
|
||||
#include "nsDOMMutationObserver.h" // For nsAutoAnimationMutationBatch
|
||||
#include "nsIScriptError.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -130,7 +131,49 @@ KeyframeEffect::SetSpacing(JSContext* aCx,
|
||||
const nsAString& aSpacing,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
// TODO: Implement this in the next patch.
|
||||
SpacingMode spacingMode = SpacingMode::distribute;
|
||||
nsCSSPropertyID pacedProperty = eCSSProperty_UNKNOWN;
|
||||
nsAutoString invalidPacedProperty;
|
||||
KeyframeEffectParams::ParseSpacing(aSpacing,
|
||||
spacingMode,
|
||||
pacedProperty,
|
||||
invalidPacedProperty,
|
||||
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 (mTarget) {
|
||||
RefPtr<nsStyleContext> styleContext = GetTargetStyleContext();
|
||||
if (styleContext) {
|
||||
UpdateProperties(styleContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
Loading…
Reference in New Issue
Block a user