Bug 1519253 - Move nsSMILInterval and nsSMILRepeatCount to the mozilla namespace r=birtles

--HG--
rename : dom/smil/nsSMILInterval.cpp => dom/smil/SMILInterval.cpp
rename : dom/smil/nsSMILInterval.h => dom/smil/SMILInterval.h
rename : dom/smil/nsSMILRepeatCount.cpp => dom/smil/SMILRepeatCount.cpp
rename : dom/smil/nsSMILRepeatCount.h => dom/smil/SMILRepeatCount.h
This commit is contained in:
longsonr 2019-01-21 13:08:12 +00:00
parent 173ea88195
commit deb24b809c
14 changed files with 111 additions and 89 deletions

View File

@ -4,11 +4,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsSMILInterval.h"
#include "SMILInterval.h"
nsSMILInterval::nsSMILInterval() : mBeginFixed(false), mEndFixed(false) {}
namespace mozilla {
nsSMILInterval::nsSMILInterval(const nsSMILInterval& aOther)
SMILInterval::SMILInterval() : mBeginFixed(false), mEndFixed(false) {}
SMILInterval::SMILInterval(const SMILInterval& aOther)
: mBegin(aOther.mBegin),
mEnd(aOther.mEnd),
mBeginFixed(false),
@ -25,13 +27,13 @@ nsSMILInterval::nsSMILInterval(const nsSMILInterval& aOther)
"Attempt to copy-construct an interval with fixed endpoints");
}
nsSMILInterval::~nsSMILInterval() {
SMILInterval::~SMILInterval() {
MOZ_ASSERT(mDependentTimes.IsEmpty(),
"Destroying interval without disassociating dependent instance "
"times. Unlink was not called");
}
void nsSMILInterval::Unlink(bool aFiltered) {
void SMILInterval::Unlink(bool aFiltered) {
for (int32_t i = mDependentTimes.Length() - 1; i >= 0; --i) {
if (aFiltered) {
mDependentTimes[i]->HandleFilteredInterval();
@ -50,17 +52,17 @@ void nsSMILInterval::Unlink(bool aFiltered) {
mEnd = nullptr;
}
nsSMILInstanceTime* nsSMILInterval::Begin() {
nsSMILInstanceTime* SMILInterval::Begin() {
MOZ_ASSERT(mBegin && mEnd, "Requesting Begin() on un-initialized interval.");
return mBegin;
}
nsSMILInstanceTime* nsSMILInterval::End() {
nsSMILInstanceTime* SMILInterval::End() {
MOZ_ASSERT(mBegin && mEnd, "Requesting End() on un-initialized interval.");
return mEnd;
}
void nsSMILInterval::SetBegin(nsSMILInstanceTime& aBegin) {
void SMILInterval::SetBegin(nsSMILInstanceTime& aBegin) {
MOZ_ASSERT(aBegin.Time().IsDefinite(),
"Attempt to set unresolved or indefinite begin time on interval");
MOZ_ASSERT(!mBeginFixed,
@ -74,7 +76,7 @@ void nsSMILInterval::SetBegin(nsSMILInstanceTime& aBegin) {
mBegin = &aBegin;
}
void nsSMILInterval::SetEnd(nsSMILInstanceTime& aEnd) {
void SMILInterval::SetEnd(nsSMILInstanceTime& aEnd) {
MOZ_ASSERT(!mEndFixed, "Attempt to set end time but the end point is fixed");
// As with SetBegin, check we're not making an instance time dependent on
// itself.
@ -84,14 +86,14 @@ void nsSMILInterval::SetEnd(nsSMILInstanceTime& aEnd) {
mEnd = &aEnd;
}
void nsSMILInterval::FixBegin() {
void SMILInterval::FixBegin() {
MOZ_ASSERT(mBegin && mEnd, "Fixing begin point on un-initialized interval");
MOZ_ASSERT(!mBeginFixed, "Duplicate calls to FixBegin()");
mBeginFixed = true;
mBegin->AddRefFixedEndpoint();
}
void nsSMILInterval::FixEnd() {
void SMILInterval::FixEnd() {
MOZ_ASSERT(mBegin && mEnd, "Fixing end point on un-initialized interval");
MOZ_ASSERT(mBeginFixed,
"Fixing the end of an interval without a fixed begin");
@ -100,7 +102,7 @@ void nsSMILInterval::FixEnd() {
mEnd->AddRefFixedEndpoint();
}
void nsSMILInterval::AddDependentTime(nsSMILInstanceTime& aTime) {
void SMILInterval::AddDependentTime(nsSMILInstanceTime& aTime) {
RefPtr<nsSMILInstanceTime>* inserted =
mDependentTimes.InsertElementSorted(&aTime);
if (!inserted) {
@ -108,7 +110,7 @@ void nsSMILInterval::AddDependentTime(nsSMILInstanceTime& aTime) {
}
}
void nsSMILInterval::RemoveDependentTime(const nsSMILInstanceTime& aTime) {
void SMILInterval::RemoveDependentTime(const nsSMILInstanceTime& aTime) {
#ifdef DEBUG
bool found =
#endif
@ -116,11 +118,11 @@ void nsSMILInterval::RemoveDependentTime(const nsSMILInstanceTime& aTime) {
MOZ_ASSERT(found, "Couldn't find instance time to delete.");
}
void nsSMILInterval::GetDependentTimes(InstanceTimeList& aTimes) {
void SMILInterval::GetDependentTimes(InstanceTimeList& aTimes) {
aTimes = mDependentTimes;
}
bool nsSMILInterval::IsDependencyChainLink() const {
bool SMILInterval::IsDependencyChainLink() const {
if (!mBegin || !mEnd)
return false; // Not yet initialised so it can't be part of a chain
@ -132,3 +134,5 @@ bool nsSMILInterval::IsDependencyChainLink() const {
return (mBegin->IsDependent() && mBegin->GetBaseInterval() != this) ||
(mEnd->IsDependent() && mEnd->GetBaseInterval() != this);
}
} // namespace mozilla

View File

@ -10,8 +10,10 @@
#include "nsSMILInstanceTime.h"
#include "nsTArray.h"
namespace mozilla {
//----------------------------------------------------------------------
// nsSMILInterval class
// SMILInterval class
//
// A structure consisting of a begin and end time. The begin time must be
// resolved (i.e. not indefinite or unresolved).
@ -19,11 +21,11 @@
// For an overview of how this class is related to other SMIL time classes see
// the documentation in nsSMILTimeValue.h
class nsSMILInterval {
class SMILInterval {
public:
nsSMILInterval();
nsSMILInterval(const nsSMILInterval& aOther);
~nsSMILInterval();
SMILInterval();
SMILInterval(const SMILInterval& aOther);
~SMILInterval();
void Unlink(bool aFiltered = false);
const nsSMILInstanceTime* Begin() const {
@ -79,4 +81,6 @@ class nsSMILInterval {
bool mEndFixed;
};
} // namespace mozilla
#endif // NS_SMILINTERVAL_H_

View File

@ -5,15 +5,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "SMILParserUtils.h"
#include "mozilla/SMILKeySpline.h"
#include "mozilla/SMILRepeatCount.h"
#include "mozilla/SVGContentUtils.h"
#include "mozilla/TextUtils.h"
#include "SMILKeySpline.h"
#include "nsISMILAttr.h"
#include "nsSMILValue.h"
#include "nsSMILTimeValue.h"
#include "nsSMILTimeValueSpecParams.h"
#include "nsSMILTypes.h"
#include "nsSMILRepeatCount.h"
#include "nsContentUtils.h"
#include "nsCharSeparatedTokenizer.h"
@ -551,7 +552,7 @@ bool SMILParserUtils::ParseValuesGeneric(const nsAString& aSpec,
}
bool SMILParserUtils::ParseRepeatCount(const nsAString& aSpec,
nsSMILRepeatCount& aResult) {
SMILRepeatCount& aResult) {
const nsAString& spec = SMILParserUtils::TrimWhitespace(aSpec);
if (spec.EqualsLiteral("indefinite")) {

View File

@ -11,13 +11,13 @@
#include "nsStringFwd.h"
class nsISMILAttr;
class SMILKeySpline;
class nsSMILTimeValue;
class nsSMILValue;
class nsSMILRepeatCount;
class nsSMILTimeValueSpecParams;
namespace mozilla {
class SMILKeySpline;
class SMILRepeatCount;
namespace dom {
class SVGAnimationElement;
} // namespace dom
@ -57,7 +57,7 @@ class SMILParserUtils {
GenericValueParser& aParser);
static bool ParseRepeatCount(const nsAString& aSpec,
nsSMILRepeatCount& aResult);
SMILRepeatCount& aResult);
static bool ParseTimeValueSpecParams(const nsAString& aSpec,
nsSMILTimeValueSpecParams& aResult);

View File

@ -4,7 +4,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsSMILRepeatCount.h"
#include "SMILRepeatCount.h"
namespace mozilla {
/*static*/ const double SMILRepeatCount::kNotSet = -1.0;
/*static*/ const double SMILRepeatCount::kIndefinite = -2.0;
} // namespace mozilla
/*static*/ const double nsSMILRepeatCount::kNotSet = -1.0;
/*static*/ const double nsSMILRepeatCount::kIndefinite = -2.0;

View File

@ -4,14 +4,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsSMILRepeatCount_h
#define nsSMILRepeatCount_h
#ifndef SMILRepeatCount_h
#define SMILRepeatCount_h
#include "nsDebug.h"
#include <math.h>
namespace mozilla {
//----------------------------------------------------------------------
// nsSMILRepeatCount
// SMILRepeatCount
//
// A tri-state non-negative floating point number for representing the number of
// times an animation repeat, i.e. the SMIL repeatCount attribute.
@ -21,10 +23,10 @@
// 2. set (with non-negative, non-zero count value)
// 3. indefinite
//
class nsSMILRepeatCount {
class SMILRepeatCount {
public:
nsSMILRepeatCount() : mCount(kNotSet) {}
explicit nsSMILRepeatCount(double aCount) : mCount(kNotSet) {
SMILRepeatCount() : mCount(kNotSet) {}
explicit SMILRepeatCount(double aCount) : mCount(kNotSet) {
SetCount(aCount);
}
@ -37,7 +39,7 @@ class nsSMILRepeatCount {
bool IsIndefinite() const { return mCount == kIndefinite; }
bool IsSet() const { return mCount != kNotSet; }
nsSMILRepeatCount& operator=(double aCount) {
SMILRepeatCount& operator=(double aCount) {
SetCount(aCount);
return *this;
}
@ -55,4 +57,6 @@ class nsSMILRepeatCount {
double mCount;
};
} // namespace mozilla
#endif

View File

@ -548,14 +548,14 @@ void SMILTimedElement::DoSampleAt(nsSMILTime aContainerTime, bool aEndOnly) {
switch (mElementState) {
case STATE_STARTUP: {
nsSMILInterval firstInterval;
SMILInterval firstInterval;
mElementState =
GetNextInterval(nullptr, nullptr, nullptr, firstInterval)
? STATE_WAITING
: STATE_POSTACTIVE;
stateChanged = true;
if (mElementState == STATE_WAITING) {
mCurrentInterval = MakeUnique<nsSMILInterval>(firstInterval);
mCurrentInterval = MakeUnique<SMILInterval>(firstInterval);
NotifyNewInterval();
}
} break;
@ -592,7 +592,7 @@ void SMILTimedElement::DoSampleAt(nsSMILTime aContainerTime, bool aEndOnly) {
bool didApplyEarlyEnd = ApplyEarlyEnd(sampleTime);
if (mCurrentInterval->End()->Time() <= sampleTime) {
nsSMILInterval newInterval;
SMILInterval newInterval;
mElementState = GetNextInterval(mCurrentInterval.get(), nullptr,
nullptr, newInterval)
? STATE_WAITING
@ -608,7 +608,7 @@ void SMILTimedElement::DoSampleAt(nsSMILTime aContainerTime, bool aEndOnly) {
mOldIntervals.AppendElement(std::move(mCurrentInterval));
SampleFillValue();
if (mElementState == STATE_WAITING) {
mCurrentInterval = MakeUnique<nsSMILInterval>(newInterval);
mCurrentInterval = MakeUnique<SMILInterval>(newInterval);
}
// We are now in a consistent state to dispatch notifications
if (didApplyEarlyEnd) {
@ -950,7 +950,7 @@ nsresult SMILTimedElement::SetRepeatCount(const nsAString& aRepeatCountSpec) {
// Update the current interval before returning
AutoIntervalUpdater updater(*this);
nsSMILRepeatCount newRepeatCount;
SMILRepeatCount newRepeatCount;
if (SMILParserUtils::ParseRepeatCount(aRepeatCountSpec, newRepeatCount)) {
mRepeatCount = newRepeatCount;
@ -1354,7 +1354,7 @@ void SMILTimedElement::DoPostSeek() {
}
void SMILTimedElement::UnpreserveInstanceTimes(InstanceTimeList& aList) {
const nsSMILInterval* prevInterval = GetPreviousInterval();
const SMILInterval* prevInterval = GetPreviousInterval();
const nsSMILInstanceTime* cutoff =
mCurrentInterval ? mCurrentInterval->Begin()
: prevInterval ? prevInterval->Begin() : nullptr;
@ -1409,7 +1409,7 @@ void SMILTimedElement::FilterIntervals() {
: 0;
IntervalList filteredList;
for (uint32_t i = 0; i < mOldIntervals.Length(); ++i) {
nsSMILInterval* interval = mOldIntervals[i].get();
SMILInterval* interval = mOldIntervals[i].get();
if (i != 0 && /*skip first interval*/
i + 1 < mOldIntervals.Length() && /*skip previous interval*/
(i < threshold || !interval->IsDependencyChainLink())) {
@ -1477,7 +1477,7 @@ void SMILTimedElement::FilterInstanceTimes(InstanceTimeList& aList) {
if (mCurrentInterval) {
timesToKeep.AppendElement(mCurrentInterval->Begin());
}
const nsSMILInterval* prevInterval = GetPreviousInterval();
const SMILInterval* prevInterval = GetPreviousInterval();
if (prevInterval) {
timesToKeep.AppendElement(prevInterval->End());
}
@ -1496,9 +1496,8 @@ void SMILTimedElement::FilterInstanceTimes(InstanceTimeList& aList) {
// http://www.w3.org/TR/2001/REC-smil-animation-20010904/#Timing-BeginEnd-LC-Start
//
bool SMILTimedElement::GetNextInterval(
const nsSMILInterval* aPrevInterval,
const nsSMILInterval* aReplacedInterval,
const nsSMILInstanceTime* aFixedBeginTime, nsSMILInterval& aResult) const {
const SMILInterval* aPrevInterval, const SMILInterval* aReplacedInterval,
const nsSMILInstanceTime* aFixedBeginTime, SMILInterval& aResult) const {
MOZ_ASSERT(!aFixedBeginTime || aFixedBeginTime->Time().IsDefinite(),
"Unresolved or indefinite begin time given for interval start");
static const nsSMILTimeValue zeroTime(0L);
@ -1860,13 +1859,13 @@ void SMILTimedElement::UpdateCurrentInterval(bool aForceChangeNotice) {
// If the interval is active the begin time is fixed.
const nsSMILInstanceTime* beginTime =
mElementState == STATE_ACTIVE ? mCurrentInterval->Begin() : nullptr;
nsSMILInterval updatedInterval;
SMILInterval updatedInterval;
if (GetNextInterval(GetPreviousInterval(), mCurrentInterval.get(), beginTime,
updatedInterval)) {
if (mElementState == STATE_POSTACTIVE) {
MOZ_ASSERT(!mCurrentInterval,
"In postactive state but the interval has been set");
mCurrentInterval = MakeUnique<nsSMILInterval>(updatedInterval);
mCurrentInterval = MakeUnique<SMILInterval>(updatedInterval);
mElementState = STATE_WAITING;
NotifyNewInterval();
@ -1930,7 +1929,7 @@ void SMILTimedElement::SampleFillValue() {
nsSMILTime activeTime;
if (mElementState == STATE_WAITING || mElementState == STATE_POSTACTIVE) {
const nsSMILInterval* prevInterval = GetPreviousInterval();
const SMILInterval* prevInterval = GetPreviousInterval();
MOZ_ASSERT(prevInterval,
"Attempting to sample fill value but there is no previous "
"interval");
@ -2091,7 +2090,7 @@ void SMILTimedElement::NotifyNewInterval() {
}
for (auto iter = mTimeDependents.Iter(); !iter.Done(); iter.Next()) {
nsSMILInterval* interval = mCurrentInterval.get();
SMILInterval* interval = mCurrentInterval.get();
// It's possible that in notifying one new time dependent of a new interval
// that a chain reaction is triggered which results in the original
// interval disappearing. If that's the case we can skip sending further
@ -2104,7 +2103,7 @@ void SMILTimedElement::NotifyNewInterval() {
}
}
void SMILTimedElement::NotifyChangedInterval(nsSMILInterval* aInterval,
void SMILTimedElement::NotifyChangedInterval(SMILInterval* aInterval,
bool aBeginObjectChanged,
bool aEndObjectChanged) {
MOZ_ASSERT(aInterval, "Null interval for change notification");
@ -2144,14 +2143,14 @@ const nsSMILInstanceTime* SMILTimedElement::GetEffectiveBeginInstance() const {
case STATE_WAITING:
case STATE_POSTACTIVE: {
const nsSMILInterval* prevInterval = GetPreviousInterval();
const SMILInterval* prevInterval = GetPreviousInterval();
return prevInterval ? prevInterval->Begin() : nullptr;
}
}
MOZ_CRASH("Invalid element state");
}
const nsSMILInterval* SMILTimedElement::GetPreviousInterval() const {
const SMILInterval* SMILTimedElement::GetPreviousInterval() const {
return mOldIntervals.IsEmpty()
? nullptr
: mOldIntervals[mOldIntervals.Length() - 1].get();

View File

@ -10,11 +10,11 @@
#include "mozilla/EventForwards.h"
#include "mozilla/Move.h"
#include "mozilla/SMILMilestone.h"
#include "mozilla/SMILInterval.h"
#include "mozilla/SMILRepeatCount.h"
#include "mozilla/UniquePtr.h"
#include "nsSMILInterval.h"
#include "nsSMILInstanceTime.h"
#include "nsSMILTimeValueSpec.h"
#include "nsSMILRepeatCount.h"
#include "nsSMILTypes.h"
#include "nsTArray.h"
#include "nsTHashtable.h"
@ -348,7 +348,7 @@ class SMILTimedElement {
// Typedefs
typedef nsTArray<UniquePtr<nsSMILTimeValueSpec>> TimeValueSpecList;
typedef nsTArray<RefPtr<nsSMILInstanceTime>> InstanceTimeList;
typedef nsTArray<UniquePtr<nsSMILInterval>> IntervalList;
typedef nsTArray<UniquePtr<SMILInterval>> IntervalList;
typedef nsPtrHashKey<nsSMILTimeValueSpec> TimeValueSpecPtrKey;
typedef nsTHashtable<TimeValueSpecPtrKey> TimeValueSpecHashSet;
@ -459,13 +459,13 @@ class SMILTimedElement {
/**
* Helper function to iterate through this element's accumulated timing
* information (specifically old nsSMILIntervals and nsSMILTimeInstanceTimes)
* information (specifically old SMILIntervals and nsSMILTimeInstanceTimes)
* and discard items that are no longer needed or exceed some threshold of
* accumulated state.
*/
void FilterHistory();
// Helper functions for FilterHistory to clear old nsSMILIntervals and
// Helper functions for FilterHistory to clear old SMILIntervals and
// nsSMILInstanceTimes respectively.
void FilterIntervals();
void FilterInstanceTimes(InstanceTimeList& aList);
@ -492,10 +492,10 @@ class SMILTimedElement {
* returned).
* @return true if a suitable interval was found, false otherwise.
*/
bool GetNextInterval(const nsSMILInterval* aPrevInterval,
const nsSMILInterval* aReplacedInterval,
bool GetNextInterval(const SMILInterval* aPrevInterval,
const SMILInterval* aReplacedInterval,
const nsSMILInstanceTime* aFixedBeginTime,
nsSMILInterval& aResult) const;
SMILInterval& aResult) const;
nsSMILInstanceTime* GetNextGreater(const InstanceTimeList& aList,
const nsSMILTimeValue& aBase,
int32_t& aPosition) const;
@ -525,12 +525,12 @@ class SMILTimedElement {
// (ii) after calling these methods we must assume that the state of the
// element may have changed.
void NotifyNewInterval();
void NotifyChangedInterval(nsSMILInterval* aInterval,
bool aBeginObjectChanged, bool aEndObjectChanged);
void NotifyChangedInterval(SMILInterval* aInterval, bool aBeginObjectChanged,
bool aEndObjectChanged);
void FireTimeEventAsync(EventMessage aMsg, int32_t aDetail);
const nsSMILInstanceTime* GetEffectiveBeginInstance() const;
const nsSMILInterval* GetPreviousInterval() const;
const SMILInterval* GetPreviousInterval() const;
bool HasPlayed() const { return !mOldIntervals.IsEmpty(); }
bool HasClientInFillRange() const;
bool EndHasEventConditions() const;
@ -557,7 +557,7 @@ class SMILTimedElement {
nsSMILTimeValue mSimpleDur;
nsSMILRepeatCount mRepeatCount;
SMILRepeatCount mRepeatCount;
nsSMILTimeValue mRepeatDur;
nsSMILTimeValue mMin;
@ -580,7 +580,7 @@ class SMILTimedElement {
uint32_t mInstanceSerialIndex;
SMILAnimationFunction* mClient;
UniquePtr<nsSMILInterval> mCurrentInterval;
UniquePtr<SMILInterval> mCurrentInterval;
IntervalList mOldIntervals;
uint32_t mCurrentRepeatIteration;
SMILMilestone mPrevRegisteredMilestone;

View File

@ -12,8 +12,6 @@ MOCHITEST_MANIFESTS += ['test/mochitest.ini']
EXPORTS += [
'nsISMILAttr.h',
'nsSMILInstanceTime.h',
'nsSMILInterval.h',
'nsSMILRepeatCount.h',
'nsSMILTimeValue.h',
'nsSMILTimeValueSpec.h',
'nsSMILTimeValueSpecParams.h',
@ -26,10 +24,12 @@ EXPORTS.mozilla += [
'SMILAnimationFunction.h',
'SMILCompositorTable.h',
'SMILCSSValueType.h',
'SMILInterval.h',
'SMILKeySpline.h',
'SMILMilestone.h',
'SMILNullType.h',
'SMILParserUtils.h',
'SMILRepeatCount.h',
'SMILSetAnimationFunction.h',
'SMILTargetIdentifier.h',
'SMILTimeContainer.h',
@ -43,8 +43,6 @@ EXPORTS.mozilla.dom += [
UNIFIED_SOURCES += [
'nsSMILInstanceTime.cpp',
'nsSMILInterval.cpp',
'nsSMILRepeatCount.cpp',
'nsSMILTimeValue.cpp',
'nsSMILTimeValueSpec.cpp',
'nsSMILValue.cpp',
@ -57,9 +55,11 @@ UNIFIED_SOURCES += [
'SMILEnumType.cpp',
'SMILFloatType.cpp',
'SMILIntegerType.cpp',
'SMILInterval.cpp',
'SMILKeySpline.cpp',
'SMILNullType.cpp',
'SMILParserUtils.cpp',
'SMILRepeatCount.cpp',
'SMILSetAnimationFunction.cpp',
'SMILStringType.cpp',
'SMILTimeContainer.cpp',

View File

@ -5,9 +5,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsSMILInstanceTime.h"
#include "nsSMILInterval.h"
#include "nsSMILTimeValueSpec.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/SMILInterval.h"
#include "nsSMILTimeValueSpec.h"
//----------------------------------------------------------------------
// Implementation
@ -15,7 +16,7 @@
nsSMILInstanceTime::nsSMILInstanceTime(const nsSMILTimeValue& aTime,
nsSMILInstanceTimeSource aSource,
nsSMILTimeValueSpec* aCreator,
nsSMILInterval* aBaseInterval)
SMILInterval* aBaseInterval)
: mTime(aTime),
mFlags(0),
mVisited(false),
@ -165,7 +166,7 @@ const nsSMILInstanceTime* nsSMILInstanceTime::GetBaseTime() const {
: mBaseInterval->End();
}
void nsSMILInstanceTime::SetBaseInterval(nsSMILInterval* aBaseInterval) {
void nsSMILInstanceTime::SetBaseInterval(SMILInterval* aBaseInterval) {
MOZ_ASSERT(!mBaseInterval,
"Attempting to reassociate an instance time with a different "
"interval.");

View File

@ -10,10 +10,10 @@
#include "nsISupportsImpl.h"
#include "nsSMILTimeValue.h"
class nsSMILInterval;
class nsSMILTimeValueSpec;
namespace mozilla {
class SMILInterval;
class SMILTimeContainer;
}
@ -29,15 +29,18 @@ class SMILTimeContainer;
// These objects are owned by an SMILTimedElement but MAY also be referenced
// by:
//
// a) nsSMILIntervals that belong to the same SMILTimedElement and which refer
// a) SMILIntervals that belong to the same SMILTimedElement and which refer
// to the nsSMILInstanceTimes which form the interval endpoints; and/or
// b) nsSMILIntervals that belong to other SMILTimedElements but which need to
// b) SMILIntervals that belong to other SMILTimedElements but which need to
// update dependent instance times when they change or are deleted.
// E.g. for begin='a.begin', 'a' needs to inform dependent
// nsSMILInstanceTimes if its begin time changes. This notification is
// performed by the nsSMILInterval.
// performed by the SMILInterval.
class nsSMILInstanceTime final {
typedef mozilla::SMILInterval SMILInterval;
typedef mozilla::SMILTimeContainer SMILTimeContainer;
public:
// Instance time source. Times generated by events, syncbase relationships,
// and DOM calls behave differently in some circumstances such as when a timed
@ -56,10 +59,10 @@ class nsSMILInstanceTime final {
explicit nsSMILInstanceTime(const nsSMILTimeValue& aTime,
nsSMILInstanceTimeSource aSource = SOURCE_NONE,
nsSMILTimeValueSpec* aCreator = nullptr,
nsSMILInterval* aBaseInterval = nullptr);
SMILInterval* aBaseInterval = nullptr);
void Unlink();
void HandleChangedInterval(const mozilla::SMILTimeContainer* aSrcContainer,
void HandleChangedInterval(const SMILTimeContainer* aSrcContainer,
bool aBeginObjectChanged, bool aEndObjectChanged);
void HandleDeletedInterval();
void HandleFilteredInterval();
@ -85,7 +88,7 @@ class nsSMILInstanceTime final {
bool IsDependent() const { return !!mBaseInterval; }
bool IsDependentOn(const nsSMILInstanceTime& aOther) const;
const nsSMILInterval* GetBaseInterval() const { return mBaseInterval; }
const SMILInterval* GetBaseInterval() const { return mBaseInterval; }
const nsSMILInstanceTime* GetBaseTime() const;
bool SameTimeAndBase(const nsSMILInstanceTime& aOther) const {
@ -103,7 +106,7 @@ class nsSMILInstanceTime final {
// Private destructor, to discourage deletion outside of Release():
~nsSMILInstanceTime();
void SetBaseInterval(nsSMILInterval* aBaseInterval);
void SetBaseInterval(SMILInterval* aBaseInterval);
nsSMILTimeValue mTime;
@ -159,7 +162,7 @@ class nsSMILInstanceTime final {
nsSMILTimeValueSpec* mCreator; // The nsSMILTimeValueSpec object that created
// us. (currently only needed for syncbase
// instance times.)
nsSMILInterval* mBaseInterval; // Interval from which this time is derived
SMILInterval* mBaseInterval; // Interval from which this time is derived
// (only used for syncbase instance times)
};

View File

@ -23,7 +23,7 @@
* nsSMILInstanceTime -- an nsSMILTimeValue used for constructing intervals. It
* contains additional fields to govern reset behavior
* and track timing dependencies (e.g. syncbase timing).
* nsSMILInterval -- a pair of nsSMILInstanceTimes that defines a begin and
* SMILInterval -- a pair of nsSMILInstanceTimes that defines a begin and
* an end time for animation.
* nsSMILTimeValueSpec -- a component of a begin or end attribute, such as the
* '5s' or 'a.end+2m' in begin="5s; a.end+2m". Acts as

View File

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/EventListenerManager.h"
#include "mozilla/SMILInterval.h"
#include "mozilla/SMILParserUtils.h"
#include "mozilla/SMILTimeContainer.h"
#include "mozilla/SMILTimedElement.h"
@ -12,7 +13,6 @@
#include "mozilla/dom/SVGAnimationElement.h"
#include "mozilla/dom/TimeEvent.h"
#include "nsSMILTimeValueSpec.h"
#include "nsSMILInterval.h"
#include "nsSMILTimeValue.h"
#include "nsSMILInstanceTime.h"
#include "nsString.h"
@ -108,7 +108,7 @@ bool nsSMILTimeValueSpec::IsEventBased() const {
}
void nsSMILTimeValueSpec::HandleNewInterval(
nsSMILInterval& aInterval, const SMILTimeContainer* aSrcContainer) {
SMILInterval& aInterval, const SMILTimeContainer* aSrcContainer) {
const nsSMILInstanceTime& baseInstance =
mParams.mSyncBegin ? *aInterval.Begin() : *aInterval.End();
nsSMILTimeValue newTime =

View File

@ -15,9 +15,9 @@
class nsSMILTimeValue;
class nsSMILInstanceTime;
class nsSMILInterval;
namespace mozilla {
class SMILInterval;
class SMILTimeContainer;
class SMILTimedElement;
namespace dom {
@ -40,6 +40,7 @@ class EventListenerManager;
class nsSMILTimeValueSpec {
public:
typedef mozilla::SMILInterval SMILInterval;
typedef mozilla::SMILTimeContainer SMILTimeContainer;
typedef mozilla::SMILTimedElement SMILTimedElement;
typedef mozilla::dom::Element Element;
@ -53,7 +54,7 @@ class nsSMILTimeValueSpec {
void ResolveReferences(Element& aContextElement);
bool IsEventBased() const;
void HandleNewInterval(nsSMILInterval& aInterval,
void HandleNewInterval(SMILInterval& aInterval,
const SMILTimeContainer* aSrcContainer);
void HandleTargetElementChange(Element* aNewTarget);