Bug 1517108 - Move nsSMILTimeContainer, nsSMILMilestone and nsSMILTargetIdentifier to the mozilla namespace r=bbirtles

--HG--
rename : dom/smil/nsSMILMilestone.h => dom/smil/SMILMilestone.h
rename : dom/smil/nsSMILTargetIdentifier.h => dom/smil/SMILTargetIdentifier.h
rename : dom/smil/nsSMILTimeContainer.cpp => dom/smil/SMILTimeContainer.cpp
rename : dom/smil/nsSMILTimeContainer.h => dom/smil/SMILTimeContainer.h
This commit is contained in:
longsonr 2019-01-02 07:21:13 +00:00
Родитель cd45a0430c
Коммит ade1b15610
24 изменённых файлов: 178 добавлений и 162 удалений

Просмотреть файл

@ -4371,8 +4371,8 @@ void nsIDocument::SetScriptGlobalObject(
nsIScriptGlobalObject* aScriptGlobalObject) {
MOZ_ASSERT(aScriptGlobalObject || !mAnimationController ||
mAnimationController->IsPausedByType(
nsSMILTimeContainer::PAUSE_PAGEHIDE |
nsSMILTimeContainer::PAUSE_BEGIN),
SMILTimeContainer::PAUSE_PAGEHIDE |
SMILTimeContainer::PAUSE_BEGIN),
"Clearing window pointer while animations are unpaused");
if (mScriptGlobalObject && !aScriptGlobalObject) {
@ -6149,7 +6149,7 @@ SMILAnimationController* nsIDocument::GetAnimationController() {
nsPresContext* context = GetPresContext();
if (mAnimationController && context &&
context->ImageAnimationMode() == imgIContainer::kDontAnimMode) {
mAnimationController->Pause(nsSMILTimeContainer::PAUSE_USERPREF);
mAnimationController->Pause(SMILTimeContainer::PAUSE_USERPREF);
}
// If we're hidden (or being hidden), notify the newly-created animation

Просмотреть файл

@ -65,7 +65,7 @@ void SMILAnimationController::Disconnect() {
MOZ_ASSERT(mDocument, "disconnecting when we weren't connected...?");
MOZ_ASSERT(mRefCnt.get() == 1,
"Expecting to disconnect when doc is sole remaining owner");
NS_ASSERTION(mPauseState & nsSMILTimeContainer::PAUSE_PAGEHIDE,
NS_ASSERTION(mPauseState & SMILTimeContainer::PAUSE_PAGEHIDE,
"Expecting to be paused for pagehide before disconnect");
StopSampling(GetRefreshDriver());
@ -74,10 +74,10 @@ void SMILAnimationController::Disconnect() {
}
//----------------------------------------------------------------------
// nsSMILTimeContainer methods:
// SMILTimeContainer methods:
void SMILAnimationController::Pause(uint32_t aType) {
nsSMILTimeContainer::Pause(aType);
SMILTimeContainer::Pause(aType);
if (mPauseState) {
mDeferredStartSampling = false;
@ -91,7 +91,7 @@ void SMILAnimationController::Resume(uint32_t aType) {
// calculating parent offsets--are accurate
mCurrentSampleTime = mozilla::TimeStamp::Now();
nsSMILTimeContainer::Resume(aType);
SMILTimeContainer::Resume(aType);
if (wasPaused && !mPauseState && mChildContainerTable.Count()) {
MaybeStartSampling(GetRefreshDriver());
@ -184,11 +184,11 @@ void SMILAnimationController::UnregisterAnimationElement(
// Page show/hide
void SMILAnimationController::OnPageShow() {
Resume(nsSMILTimeContainer::PAUSE_PAGEHIDE);
Resume(SMILTimeContainer::PAUSE_PAGEHIDE);
}
void SMILAnimationController::OnPageHide() {
Pause(nsSMILTimeContainer::PAUSE_PAGEHIDE);
Pause(SMILTimeContainer::PAUSE_PAGEHIDE);
}
//----------------------------------------------------------------------
@ -309,12 +309,12 @@ void SMILAnimationController::DoSample(bool aSkipUnchangedContainers) {
// time in document time.
TimeContainerHashtable activeContainers(mChildContainerTable.Count());
for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
nsSMILTimeContainer* container = iter.Get()->GetKey();
SMILTimeContainer* container = iter.Get()->GetKey();
if (!container) {
continue;
}
if (!container->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN) &&
if (!container->IsPausedByType(SMILTimeContainer::PAUSE_BEGIN) &&
(container->NeedsSample() || !aSkipUnchangedContainers)) {
container->ClearMilestones();
container->Sample();
@ -424,7 +424,7 @@ void SMILAnimationController::DoSample(bool aSkipUnchangedContainers) {
void SMILAnimationController::RewindElements() {
bool rewindNeeded = false;
for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
nsSMILTimeContainer* container = iter.Get()->GetKey();
SMILTimeContainer* container = iter.Get()->GetKey();
if (container->NeedsRewind()) {
rewindNeeded = true;
break;
@ -435,7 +435,7 @@ void SMILAnimationController::RewindElements() {
for (auto iter = mAnimationElementTable.Iter(); !iter.Done(); iter.Next()) {
SVGAnimationElement* animElem = iter.Get()->GetKey();
nsSMILTimeContainer* timeContainer = animElem->GetTimeContainer();
SMILTimeContainer* timeContainer = animElem->GetTimeContainer();
if (timeContainer && timeContainer->NeedsRewind()) {
animElem->TimedElement().Rewind();
}
@ -472,13 +472,13 @@ void SMILAnimationController::DoMilestoneSamples() {
// precise) the current sample time and see if there are any milestones
// before that. Any other milestones will be dealt with in a subsequent
// sample.
nsSMILMilestone nextMilestone(GetCurrentTimeAsSMILTime() + 1, true);
SMILMilestone nextMilestone(GetCurrentTimeAsSMILTime() + 1, true);
for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
nsSMILTimeContainer* container = iter.Get()->GetKey();
if (container->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN)) {
SMILTimeContainer* container = iter.Get()->GetKey();
if (container->IsPausedByType(SMILTimeContainer::PAUSE_BEGIN)) {
continue;
}
nsSMILMilestone thisMilestone;
SMILMilestone thisMilestone;
bool didGetMilestone =
container->GetNextMilestoneInParentTime(thisMilestone);
if (didGetMilestone && thisMilestone < nextMilestone) {
@ -492,8 +492,8 @@ void SMILAnimationController::DoMilestoneSamples() {
nsTArray<RefPtr<mozilla::dom::SVGAnimationElement>> elements;
for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
nsSMILTimeContainer* container = iter.Get()->GetKey();
if (container->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN)) {
SMILTimeContainer* container = iter.Get()->GetKey();
if (container->IsPausedByType(SMILTimeContainer::PAUSE_BEGIN)) {
continue;
}
container->PopMilestoneElementsAtMilestone(nextMilestone, elements);
@ -515,7 +515,7 @@ void SMILAnimationController::DoMilestoneSamples() {
for (uint32_t i = 0; i < length; ++i) {
SVGAnimationElement* elem = elements[i].get();
MOZ_ASSERT(elem, "nullptr animation element in list");
nsSMILTimeContainer* container = elem->GetTimeContainer();
SMILTimeContainer* container = elem->GetTimeContainer();
if (!container)
// The container may be nullptr if the element has been detached from
// its parent since registering a milestone.
@ -540,7 +540,7 @@ void SMILAnimationController::DoMilestoneSamples() {
/*static*/ void SMILAnimationController::SampleTimedElement(
SVGAnimationElement* aElement, TimeContainerHashtable* aActiveContainers) {
nsSMILTimeContainer* timeContainer = aElement->GetTimeContainer();
SMILTimeContainer* timeContainer = aElement->GetTimeContainer();
if (!timeContainer) return;
// We'd like to call timeContainer->NeedsSample() here and skip all timed
@ -565,7 +565,7 @@ void SMILAnimationController::DoMilestoneSamples() {
SVGAnimationElement* aElement, SMILCompositorTable* aCompositorTable,
bool& aStyleFlushNeeded) {
// Add a compositor to the hash table if there's not already one there
nsSMILTargetIdentifier key;
SMILTargetIdentifier key;
if (!GetTargetIdentifierForAnimation(aElement, key))
// Something's wrong/missing about animation's target; skip this animation
return;
@ -607,10 +607,10 @@ static inline bool IsTransformAttribute(int32_t aNamespaceID,
}
// Helper function that, given a SVGAnimationElement, looks up its target
// element & target attribute and populates a nsSMILTargetIdentifier
// element & target attribute and populates a SMILTargetIdentifier
// for this target.
/*static*/ bool SMILAnimationController::GetTargetIdentifierForAnimation(
SVGAnimationElement* aAnimElem, nsSMILTargetIdentifier& aResult) {
SVGAnimationElement* aAnimElem, SMILTargetIdentifier& aResult) {
// Look up target (animated) element
Element* targetElem = aAnimElem->GetTargetElementContent();
if (!targetElem)
@ -661,7 +661,7 @@ bool SMILAnimationController::PreTraverseInSubtree(Element* aRoot) {
for (auto iter = mAnimationElementTable.Iter(); !iter.Done(); iter.Next()) {
SVGAnimationElement* animElement = iter.Get()->GetKey();
nsSMILTargetIdentifier key;
SMILTargetIdentifier key;
if (!GetTargetIdentifierForAnimation(animElement, key)) {
// Something's wrong/missing about animation's target; skip this animation
continue;
@ -693,7 +693,7 @@ bool SMILAnimationController::PreTraverseInSubtree(Element* aRoot) {
//----------------------------------------------------------------------
// Add/remove child time containers
nsresult SMILAnimationController::AddChild(nsSMILTimeContainer& aChild) {
nsresult SMILAnimationController::AddChild(SMILTimeContainer& aChild) {
TimeContainerPtrKey* key = mChildContainerTable.PutEntry(&aChild);
NS_ENSURE_TRUE(key, NS_ERROR_OUT_OF_MEMORY);
@ -705,7 +705,7 @@ nsresult SMILAnimationController::AddChild(nsSMILTimeContainer& aChild) {
return NS_OK;
}
void SMILAnimationController::RemoveChild(nsSMILTimeContainer& aChild) {
void SMILAnimationController::RemoveChild(SMILTimeContainer& aChild) {
mChildContainerTable.RemoveEntry(&aChild);
if (!mPauseState && mChildContainerTable.Count() == 0) {

Просмотреть файл

@ -9,20 +9,20 @@
#include "mozilla/Attributes.h"
#include "mozilla/SMILCompositorTable.h"
#include "mozilla/SMILMilestone.h"
#include "mozilla/SMILTimeContainer.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsTArray.h"
#include "nsITimer.h"
#include "nsTHashtable.h"
#include "nsHashKeys.h"
#include "nsSMILTimeContainer.h"
#include "nsSMILMilestone.h"
#include "nsRefreshDriver.h"
struct nsSMILTargetIdentifier;
class nsIDocument;
namespace mozilla {
struct SMILTargetIdentifier;
namespace dom {
class Element;
class SVGAnimationElement;
@ -41,8 +41,8 @@ class SVGAnimationElement;
// a compound document. These time containers can be paused individually or
// here, at the document level.
//
class SMILAnimationController final : public nsSMILTimeContainer,
public nsARefreshObserver {
class SMILAnimationController final : public SMILTimeContainer,
public nsARefreshObserver {
public:
explicit SMILAnimationController(nsIDocument* aDoc);
@ -114,7 +114,7 @@ class SMILAnimationController final : public nsSMILTimeContainer,
~SMILAnimationController();
// Typedefs
typedef nsPtrHashKey<nsSMILTimeContainer> TimeContainerPtrKey;
typedef nsPtrHashKey<SMILTimeContainer> TimeContainerPtrKey;
typedef nsTHashtable<TimeContainerPtrKey> TimeContainerHashtable;
typedef nsPtrHashKey<mozilla::dom::SVGAnimationElement>
AnimationElementPtrKey;
@ -147,11 +147,11 @@ class SMILAnimationController final : public nsSMILTimeContainer,
static bool GetTargetIdentifierForAnimation(
mozilla::dom::SVGAnimationElement* aAnimElem,
nsSMILTargetIdentifier& aResult);
SMILTargetIdentifier& aResult);
// Methods for adding/removing time containers
virtual nsresult AddChild(nsSMILTimeContainer& aChild) override;
virtual void RemoveChild(nsSMILTimeContainer& aChild) override;
virtual nsresult AddChild(SMILTimeContainer& aChild) override;
virtual void RemoveChild(SMILTimeContainer& aChild) override;
void FlagDocumentNeedsFlush();

Просмотреть файл

@ -287,7 +287,7 @@ bool SMILAnimationFunction::HasChanged() const {
}
bool SMILAnimationFunction::UpdateCachedTarget(
const nsSMILTargetIdentifier& aNewTarget) {
const SMILTargetIdentifier& aNewTarget) {
if (!mLastTarget.Equals(aNewTarget)) {
mLastTarget = aNewTarget;
return true;

Просмотреть файл

@ -7,10 +7,10 @@
#ifndef NS_SMILANIMATIONFUNCTION_H_
#define NS_SMILANIMATIONFUNCTION_H_
#include "mozilla/SMILTargetIdentifier.h"
#include "nsISMILAttr.h"
#include "nsGkAtoms.h"
#include "nsString.h"
#include "nsSMILTargetIdentifier.h"
#include "nsSMILTimeValue.h"
#include "nsSMILKeySpline.h"
#include "nsSMILValue.h"
@ -214,12 +214,12 @@ class SMILAnimationFunction {
* functions have changed value or target since the last sample. If none of
* them have, then the compositor doesn't need to do anything.)
*
* @param aNewTarget A nsSMILTargetIdentifier representing the animation
* @param aNewTarget A SMILTargetIdentifier representing the animation
* target of this function for this sample.
* @return true if |aNewTarget| is different from the old cached value;
* otherwise, false.
*/
bool UpdateCachedTarget(const nsSMILTargetIdentifier& aNewTarget);
bool UpdateCachedTarget(const SMILTargetIdentifier& aNewTarget);
/**
* Returns true if this function was skipped in the previous sample (because

Просмотреть файл

@ -13,7 +13,7 @@
#include "mozilla/SMILCompositorTable.h"
#include "nsTHashtable.h"
#include "nsString.h"
#include "nsSMILTargetIdentifier.h"
#include "SMILTargetIdentifier.h"
#include "PLDHashTable.h"
namespace mozilla {
@ -27,7 +27,7 @@ namespace mozilla {
class SMILCompositor : public PLDHashEntryHdr {
public:
typedef nsSMILTargetIdentifier KeyType;
typedef SMILTargetIdentifier KeyType;
typedef const KeyType& KeyTypeRef;
typedef const KeyType* KeyTypePointer;

Просмотреть файл

@ -7,6 +7,10 @@
#ifndef NS_SMILMILESTONE_H_
#define NS_SMILMILESTONE_H_
#include "nsSMILTypes.h"
namespace mozilla {
/*
* A significant moment in an SMILTimedElement's lifetime where a sample is
* required.
@ -32,32 +36,31 @@
* of instance times available before committing to a new interval. Once an
* interval is entered, the begin time is fixed.
*/
class nsSMILMilestone {
class SMILMilestone {
public:
nsSMILMilestone(nsSMILTime aTime, bool aIsEnd)
: mTime(aTime), mIsEnd(aIsEnd) {}
SMILMilestone(nsSMILTime aTime, bool aIsEnd) : mTime(aTime), mIsEnd(aIsEnd) {}
nsSMILMilestone() : mTime(0), mIsEnd(false) {}
SMILMilestone() : mTime(0), mIsEnd(false) {}
bool operator==(const nsSMILMilestone& aOther) const {
bool operator==(const SMILMilestone& aOther) const {
return mTime == aOther.mTime && mIsEnd == aOther.mIsEnd;
}
bool operator!=(const nsSMILMilestone& aOther) const {
bool operator!=(const SMILMilestone& aOther) const {
return !(*this == aOther);
}
bool operator<(const nsSMILMilestone& aOther) const {
bool operator<(const SMILMilestone& aOther) const {
// Earlier times sort first, and for equal times end milestones sort first
return mTime < aOther.mTime ||
(mTime == aOther.mTime && mIsEnd && !aOther.mIsEnd);
}
bool operator<=(const nsSMILMilestone& aOther) const {
bool operator<=(const SMILMilestone& aOther) const {
return *this == aOther || *this < aOther;
}
bool operator>=(const nsSMILMilestone& aOther) const {
bool operator>=(const SMILMilestone& aOther) const {
return !(*this < aOther);
}
@ -67,4 +70,6 @@ class nsSMILMilestone {
// end, false otherwise.
};
} // namespace mozilla
#endif // NS_SMILMILESTONE_H_

Просмотреть файл

@ -9,8 +9,10 @@
#include "mozilla/dom/Element.h"
namespace mozilla {
/**
* Struct: nsSMILTargetIdentifier
* Struct: SMILTargetIdentifier
*
* Tuple of: { Animated Element, Attribute Name }
*
@ -22,13 +24,13 @@
* future, and we need to make sure their target isn't deleted in that time.
*/
struct nsSMILTargetIdentifier {
nsSMILTargetIdentifier()
struct SMILTargetIdentifier {
SMILTargetIdentifier()
: mElement(nullptr),
mAttributeName(nullptr),
mAttributeNamespaceID(kNameSpaceID_Unknown) {}
inline bool Equals(const nsSMILTargetIdentifier& aOther) const {
inline bool Equals(const SMILTargetIdentifier& aOther) const {
return (aOther.mElement == mElement &&
aOther.mAttributeName == mAttributeName &&
aOther.mAttributeNamespaceID == mAttributeNamespaceID);
@ -55,14 +57,14 @@ class nsSMILWeakTargetIdentifier {
nsSMILWeakTargetIdentifier() : mElement(nullptr), mAttributeName(nullptr) {}
// Allow us to update a weak identifier to match a given non-weak identifier
nsSMILWeakTargetIdentifier& operator=(const nsSMILTargetIdentifier& aOther) {
nsSMILWeakTargetIdentifier& operator=(const SMILTargetIdentifier& aOther) {
mElement = aOther.mElement;
mAttributeName = aOther.mAttributeName;
return *this;
}
// Allow for comparison vs. non-weak identifier
inline bool Equals(const nsSMILTargetIdentifier& aOther) const {
inline bool Equals(const SMILTargetIdentifier& aOther) const {
return (aOther.mElement == mElement &&
aOther.mAttributeName == mAttributeName);
}
@ -72,4 +74,6 @@ class nsSMILWeakTargetIdentifier {
const nsAtom* mAttributeName;
};
} // namespace mozilla
#endif // NS_SMILTARGETIDENTIFIER_H_

Просмотреть файл

@ -4,16 +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/. */
#include "nsSMILTimeContainer.h"
#include "SMILTimeContainer.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/SMILTimedElement.h"
#include "nsSMILTimeValue.h"
#include <algorithm>
using namespace mozilla;
namespace mozilla {
nsSMILTimeContainer::nsSMILTimeContainer()
SMILTimeContainer::SMILTimeContainer()
: mParent(nullptr),
mCurrentTime(0L),
mParentOffset(0L),
@ -27,13 +27,13 @@ nsSMILTimeContainer::nsSMILTimeContainer()
mPauseState(PAUSE_BEGIN) {
}
nsSMILTimeContainer::~nsSMILTimeContainer() {
SMILTimeContainer::~SMILTimeContainer() {
if (mParent) {
mParent->RemoveChild(*this);
}
}
nsSMILTimeValue nsSMILTimeContainer::ContainerToParentTime(
nsSMILTimeValue SMILTimeContainer::ContainerToParentTime(
nsSMILTime aContainerTime) const {
// If we're paused, then future times are indefinite
if (IsPaused() && aContainerTime > mCurrentTime)
@ -42,7 +42,7 @@ nsSMILTimeValue nsSMILTimeContainer::ContainerToParentTime(
return nsSMILTimeValue(aContainerTime + mParentOffset);
}
nsSMILTimeValue nsSMILTimeContainer::ParentToContainerTime(
nsSMILTimeValue SMILTimeContainer::ParentToContainerTime(
nsSMILTime aParentTime) const {
// If we're paused, then any time after when we paused is indefinite
if (IsPaused() && aParentTime > mPauseStart)
@ -51,7 +51,7 @@ nsSMILTimeValue nsSMILTimeContainer::ParentToContainerTime(
return nsSMILTimeValue(aParentTime - mParentOffset);
}
void nsSMILTimeContainer::Begin() {
void SMILTimeContainer::Begin() {
Resume(PAUSE_BEGIN);
if (mPauseState) {
mNeedsPauseSample = true;
@ -67,7 +67,7 @@ void nsSMILTimeContainer::Begin() {
UpdateCurrentTime();
}
void nsSMILTimeContainer::Pause(uint32_t aType) {
void SMILTimeContainer::Pause(uint32_t aType) {
bool didStartPause = false;
if (!mPauseState && aType) {
@ -83,7 +83,7 @@ void nsSMILTimeContainer::Pause(uint32_t aType) {
}
}
void nsSMILTimeContainer::Resume(uint32_t aType) {
void SMILTimeContainer::Resume(uint32_t aType) {
if (!mPauseState) return;
mPauseState &= ~aType;
@ -95,7 +95,7 @@ void nsSMILTimeContainer::Resume(uint32_t aType) {
}
}
nsSMILTime nsSMILTimeContainer::GetCurrentTimeAsSMILTime() const {
nsSMILTime SMILTimeContainer::GetCurrentTimeAsSMILTime() const {
// The following behaviour is consistent with:
// http://www.w3.org/2003/01/REC-SVG11-20030114-errata
// #getCurrentTime_setCurrentTime_undefined_before_document_timeline_begin
@ -106,7 +106,7 @@ nsSMILTime nsSMILTimeContainer::GetCurrentTimeAsSMILTime() const {
return mCurrentTime;
}
void nsSMILTimeContainer::SetCurrentTime(nsSMILTime aSeekTo) {
void SMILTimeContainer::SetCurrentTime(nsSMILTime aSeekTo) {
// SVG 1.1 doesn't specify what to do for negative times so we adopt SVGT1.2's
// behaviour of clamping negative times to 0.
aSeekTo = std::max<nsSMILTime>(0, aSeekTo);
@ -138,13 +138,13 @@ void nsSMILTimeContainer::SetCurrentTime(nsSMILTime aSeekTo) {
NotifyTimeChange();
}
nsSMILTime nsSMILTimeContainer::GetParentTime() const {
nsSMILTime SMILTimeContainer::GetParentTime() const {
if (mParent) return mParent->GetCurrentTimeAsSMILTime();
return 0L;
}
void nsSMILTimeContainer::SyncPauseTime() {
void SMILTimeContainer::SyncPauseTime() {
if (IsPaused()) {
nsSMILTime parentTime = GetParentTime();
nsSMILTime extraOffset = parentTime - mPauseStart;
@ -153,7 +153,7 @@ void nsSMILTimeContainer::SyncPauseTime() {
}
}
void nsSMILTimeContainer::Sample() {
void SMILTimeContainer::Sample() {
if (!NeedsSample()) return;
UpdateCurrentTime();
@ -162,7 +162,7 @@ void nsSMILTimeContainer::Sample() {
mNeedsPauseSample = false;
}
nsresult nsSMILTimeContainer::SetParent(nsSMILTimeContainer* aParent) {
nsresult SMILTimeContainer::SetParent(SMILTimeContainer* aParent) {
if (mParent) {
mParent->RemoveChild(*this);
// When we're not attached to a parent time container, GetParentTime() will
@ -185,8 +185,8 @@ nsresult nsSMILTimeContainer::SetParent(nsSMILTimeContainer* aParent) {
return rv;
}
bool nsSMILTimeContainer::AddMilestone(
const nsSMILMilestone& aMilestone,
bool SMILTimeContainer::AddMilestone(
const SMILMilestone& aMilestone,
mozilla::dom::SVGAnimationElement& aElement) {
// We record the milestone time and store it along with the element but this
// time may change (e.g. if attributes are changed on the timed element in
@ -196,34 +196,34 @@ bool nsSMILTimeContainer::AddMilestone(
return mMilestoneEntries.Push(MilestoneEntry(aMilestone, aElement));
}
void nsSMILTimeContainer::ClearMilestones() {
void SMILTimeContainer::ClearMilestones() {
MOZ_ASSERT(!mHoldingEntries);
mMilestoneEntries.Clear();
}
bool nsSMILTimeContainer::GetNextMilestoneInParentTime(
nsSMILMilestone& aNextMilestone) const {
bool SMILTimeContainer::GetNextMilestoneInParentTime(
SMILMilestone& aNextMilestone) const {
if (mMilestoneEntries.IsEmpty()) return false;
nsSMILTimeValue parentTime =
ContainerToParentTime(mMilestoneEntries.Top().mMilestone.mTime);
if (!parentTime.IsDefinite()) return false;
aNextMilestone = nsSMILMilestone(parentTime.GetMillis(),
mMilestoneEntries.Top().mMilestone.mIsEnd);
aNextMilestone = SMILMilestone(parentTime.GetMillis(),
mMilestoneEntries.Top().mMilestone.mIsEnd);
return true;
}
bool nsSMILTimeContainer::PopMilestoneElementsAtMilestone(
const nsSMILMilestone& aMilestone, AnimElemArray& aMatchedElements) {
bool SMILTimeContainer::PopMilestoneElementsAtMilestone(
const SMILMilestone& aMilestone, AnimElemArray& aMatchedElements) {
if (mMilestoneEntries.IsEmpty()) return false;
nsSMILTimeValue containerTime = ParentToContainerTime(aMilestone.mTime);
if (!containerTime.IsDefinite()) return false;
nsSMILMilestone containerMilestone(containerTime.GetMillis(),
aMilestone.mIsEnd);
SMILMilestone containerMilestone(containerTime.GetMillis(),
aMilestone.mIsEnd);
MOZ_ASSERT(mMilestoneEntries.Top().mMilestone >= containerMilestone,
"Trying to pop off earliest times but we have earlier ones that "
@ -241,7 +241,7 @@ bool nsSMILTimeContainer::PopMilestoneElementsAtMilestone(
return gotOne;
}
void nsSMILTimeContainer::Traverse(
void SMILTimeContainer::Traverse(
nsCycleCollectionTraversalCallback* aCallback) {
#ifdef DEBUG
AutoRestore<bool> saveHolding(mHoldingEntries);
@ -255,18 +255,18 @@ void nsSMILTimeContainer::Traverse(
}
}
void nsSMILTimeContainer::Unlink() {
void SMILTimeContainer::Unlink() {
MOZ_ASSERT(!mHoldingEntries);
mMilestoneEntries.Clear();
}
void nsSMILTimeContainer::UpdateCurrentTime() {
void SMILTimeContainer::UpdateCurrentTime() {
nsSMILTime now = IsPaused() ? mPauseStart : GetParentTime();
mCurrentTime = now - mParentOffset;
MOZ_ASSERT(mCurrentTime >= 0, "Container has negative time");
}
void nsSMILTimeContainer::NotifyTimeChange() {
void SMILTimeContainer::NotifyTimeChange() {
// Called when the container time is changed with respect to the document
// time. When this happens time dependencies in other time containers need to
// re-resolve their times because begin and end times are stored in container
@ -297,3 +297,5 @@ void nsSMILTimeContainer::NotifyTimeChange() {
elem->TimedElement().HandleContainerTimeChange();
}
}
} // namespace mozilla

Просмотреть файл

@ -8,22 +8,24 @@
#define NS_SMILTIMECONTAINER_H_
#include "mozilla/dom/SVGAnimationElement.h"
#include "mozilla/SMILMilestone.h"
#include "nscore.h"
#include "nsSMILTypes.h"
#include "nsTPriorityQueue.h"
#include "nsSMILMilestone.h"
class nsSMILTimeValue;
namespace mozilla {
//----------------------------------------------------------------------
// nsSMILTimeContainer
// SMILTimeContainer
//
// Common base class for a time base that can be paused, resumed, and sampled.
//
class nsSMILTimeContainer {
class SMILTimeContainer {
public:
nsSMILTimeContainer();
virtual ~nsSMILTimeContainer();
SMILTimeContainer();
virtual ~SMILTimeContainer();
/*
* Pause request types.
@ -158,7 +160,7 @@ class nsSMILTimeContainer {
*
* The callee still retains ownership of the time container.
*/
nsresult SetParent(nsSMILTimeContainer* aParent);
nsresult SetParent(SMILTimeContainer* aParent);
/*
* Registers an element for a sample at the given time.
@ -168,7 +170,7 @@ class nsSMILTimeContainer {
* aMilestone.
* @return true if the element was successfully added, false otherwise.
*/
bool AddMilestone(const nsSMILMilestone& aMilestone,
bool AddMilestone(const SMILMilestone& aMilestone,
mozilla::dom::SVGAnimationElement& aElement);
/*
@ -185,7 +187,7 @@ class nsSMILTimeContainer {
* @return true if there exists another milestone, false otherwise in
* which case aNextMilestone will be unmodified.
*/
bool GetNextMilestoneInParentTime(nsSMILMilestone& aNextMilestone) const;
bool GetNextMilestoneInParentTime(SMILMilestone& aNextMilestone) const;
typedef nsTArray<RefPtr<mozilla::dom::SVGAnimationElement> > AnimElemArray;
@ -199,7 +201,7 @@ class nsSMILTimeContainer {
* appended.
* @return true if one or more elements match, false otherwise.
*/
bool PopMilestoneElementsAtMilestone(const nsSMILMilestone& aMilestone,
bool PopMilestoneElementsAtMilestone(const SMILMilestone& aMilestone,
AnimElemArray& aMatchedElements);
// Cycle-collection support
@ -221,14 +223,14 @@ class nsSMILTimeContainer {
/*
* Adds a child time container.
*/
virtual nsresult AddChild(nsSMILTimeContainer& aChild) {
virtual nsresult AddChild(SMILTimeContainer& aChild) {
return NS_ERROR_FAILURE;
}
/*
* Removes a child time container.
*/
virtual void RemoveChild(nsSMILTimeContainer& aChild) {}
virtual void RemoveChild(SMILTimeContainer& aChild) {}
/*
* Implementation helper to update the current time.
@ -242,7 +244,7 @@ class nsSMILTimeContainer {
void NotifyTimeChange();
// The parent time container, if any
nsSMILTimeContainer* mParent;
SMILTimeContainer* mParent;
// The current time established at the last call to Sample()
nsSMILTime mCurrentTime;
@ -273,7 +275,7 @@ class nsSMILTimeContainer {
uint32_t mPauseState;
struct MilestoneEntry {
MilestoneEntry(const nsSMILMilestone& aMilestone,
MilestoneEntry(const SMILMilestone& aMilestone,
mozilla::dom::SVGAnimationElement& aElement)
: mMilestone(aMilestone), mTimebase(&aElement) {}
@ -281,7 +283,7 @@ class nsSMILTimeContainer {
return mMilestone < aOther.mMilestone;
}
nsSMILMilestone mMilestone; // In container time.
SMILMilestone mMilestone; // In container time.
RefPtr<mozilla::dom::SVGAnimationElement> mTimebase;
};
@ -293,4 +295,6 @@ class nsSMILTimeContainer {
nsTPriorityQueue<MilestoneEntry> mMilestoneEntries;
};
} // namespace mozilla
#endif // NS_SMILTIMECONTAINER_H_

Просмотреть файл

@ -11,6 +11,7 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/SMILAnimationFunction.h"
#include "mozilla/SMILTimeContainer.h"
#include "mozilla/TaskCategory.h"
#include "mozilla/dom/SVGAnimationElement.h"
#include "nsAttrValueInlines.h"
@ -18,7 +19,6 @@
#include "nsSMILTimeValueSpec.h"
#include "nsSMILInstanceTime.h"
#include "nsSMILParserUtils.h"
#include "nsSMILTimeContainer.h"
#include "nsGkAtoms.h"
#include "nsReadableUtils.h"
#include "nsMathUtils.h"
@ -198,7 +198,7 @@ const nsAttrValue::EnumTable SMILTimedElement::sRestartModeTable[] = {
{"never", RESTART_NEVER},
{nullptr, 0}};
const nsSMILMilestone SMILTimedElement::sMaxMilestone(
const SMILMilestone SMILTimedElement::sMaxMilestone(
std::numeric_limits<nsSMILTime>::max(), false);
// The thresholds at which point we start filtering intervals and instance times
@ -269,7 +269,7 @@ void SMILTimedElement::SetAnimationElement(SVGAnimationElement* aElement) {
mAnimationElement = aElement;
}
nsSMILTimeContainer* SMILTimedElement::GetTimeContainer() {
SMILTimeContainer* SMILTimedElement::GetTimeContainer() {
return mAnimationElement ? mAnimationElement->GetTimeContainer() : nullptr;
}
@ -295,7 +295,7 @@ dom::Element* SMILTimedElement::GetTargetElement() {
// without first checking the restart mode.
nsresult SMILTimedElement::BeginElementAt(double aOffsetSeconds) {
nsSMILTimeContainer* container = GetTimeContainer();
SMILTimeContainer* container = GetTimeContainer();
if (!container) return NS_ERROR_FAILURE;
nsSMILTime currentTime = container->GetCurrentTimeAsSMILTime();
@ -303,7 +303,7 @@ nsresult SMILTimedElement::BeginElementAt(double aOffsetSeconds) {
}
nsresult SMILTimedElement::EndElementAt(double aOffsetSeconds) {
nsSMILTimeContainer* container = GetTimeContainer();
SMILTimeContainer* container = GetTimeContainer();
if (!container) return NS_ERROR_FAILURE;
nsSMILTime currentTime = container->GetCurrentTimeAsSMILTime();
@ -503,7 +503,7 @@ void SMILTimedElement::DoSampleAt(nsSMILTime aContainerTime, bool aEndOnly) {
// start) we transfer a node from another document fragment that has already
// started. In such a case we might receive milestone samples registered with
// the already active container.
if (GetTimeContainer()->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN))
if (GetTimeContainer()->IsPausedByType(SMILTimeContainer::PAUSE_BEGIN))
return;
// We use an end-sample to start animation since an end-sample lets us
@ -1993,16 +1993,16 @@ nsresult SMILTimedElement::AddInstanceTimeFromCurrentTime(
}
void SMILTimedElement::RegisterMilestone() {
nsSMILTimeContainer* container = GetTimeContainer();
SMILTimeContainer* container = GetTimeContainer();
if (!container) return;
MOZ_ASSERT(mAnimationElement,
"Got a time container without an owning animation element");
nsSMILMilestone nextMilestone;
SMILMilestone nextMilestone;
if (!GetNextMilestone(nextMilestone)) return;
// This method is called every time we might possibly have updated our
// current interval, but since nsSMILTimeContainer makes no attempt to filter
// current interval, but since SMILTimeContainer makes no attempt to filter
// out redundant milestones we do some rudimentary filtering here. It's not
// perfect, but unnecessary samples are fairly cheap.
if (nextMilestone >= mPrevRegisteredMilestone) return;
@ -2011,7 +2011,7 @@ void SMILTimedElement::RegisterMilestone() {
mPrevRegisteredMilestone = nextMilestone;
}
bool SMILTimedElement::GetNextMilestone(nsSMILMilestone& aNextMilestone) const {
bool SMILTimedElement::GetNextMilestone(SMILMilestone& aNextMilestone) const {
// Return the next key moment in our lifetime.
//
// XXX It may be possible in future to optimise this so that we only register
@ -2086,7 +2086,7 @@ void SMILTimedElement::NotifyNewInterval() {
"Attempting to notify dependents of a new interval but the "
"interval is not set");
nsSMILTimeContainer* container = GetTimeContainer();
SMILTimeContainer* container = GetTimeContainer();
if (container) {
container->SyncPauseTime();
}
@ -2110,7 +2110,7 @@ void SMILTimedElement::NotifyChangedInterval(nsSMILInterval* aInterval,
bool aEndObjectChanged) {
MOZ_ASSERT(aInterval, "Null interval for change notification");
nsSMILTimeContainer* container = GetTimeContainer();
SMILTimeContainer* container = GetTimeContainer();
if (container) {
container->SyncPauseTime();
}

Просмотреть файл

@ -9,10 +9,10 @@
#include "mozilla/EventForwards.h"
#include "mozilla/Move.h"
#include "mozilla/SMILMilestone.h"
#include "mozilla/UniquePtr.h"
#include "nsSMILInterval.h"
#include "nsSMILInstanceTime.h"
#include "nsSMILMilestone.h"
#include "nsSMILTimeValueSpec.h"
#include "nsSMILRepeatCount.h"
#include "nsSMILTypes.h"
@ -22,12 +22,12 @@
#include "nsAutoPtr.h"
#include "nsAttrValue.h"
class nsSMILTimeContainer;
class nsSMILTimeValue;
class nsAtom;
namespace mozilla {
class SMILAnimationFunction;
class SMILTimeContainer;
namespace dom {
class SVGAnimationElement;
} // namespace dom
@ -52,7 +52,7 @@ class SMILTimedElement {
* Returns the time container with which this timed element is associated or
* nullptr if it is not associated with a time container.
*/
nsSMILTimeContainer* GetTimeContainer();
SMILTimeContainer* GetTimeContainer();
/*
* Returns the element targeted by the animation element. Needed for
@ -516,7 +516,7 @@ class SMILTimedElement {
nsresult AddInstanceTimeFromCurrentTime(nsSMILTime aCurrentTime,
double aOffsetSeconds, bool aIsBegin);
void RegisterMilestone();
bool GetNextMilestone(nsSMILMilestone& aNextMilestone) const;
bool GetNextMilestone(SMILMilestone& aNextMilestone) const;
// Notification methods. Note that these notifications can result in nested
// calls to this same object. Therefore,
@ -583,8 +583,8 @@ class SMILTimedElement {
UniquePtr<nsSMILInterval> mCurrentInterval;
IntervalList mOldIntervals;
uint32_t mCurrentRepeatIteration;
nsSMILMilestone mPrevRegisteredMilestone;
static const nsSMILMilestone sMaxMilestone;
SMILMilestone mPrevRegisteredMilestone;
static const SMILMilestone sMaxMilestone;
static const uint8_t sMaxNumIntervals;
static const uint8_t sMaxNumInstanceTimes;

Просмотреть файл

@ -15,10 +15,7 @@ EXPORTS += [
'nsSMILInstanceTime.h',
'nsSMILInterval.h',
'nsSMILKeySpline.h',
'nsSMILMilestone.h',
'nsSMILRepeatCount.h',
'nsSMILTargetIdentifier.h',
'nsSMILTimeContainer.h',
'nsSMILTimeValue.h',
'nsSMILTimeValueSpec.h',
'nsSMILTimeValueSpecParams.h',
@ -33,7 +30,10 @@ EXPORTS.mozilla += [
'SMILAnimationController.h',
'SMILAnimationFunction.h',
'SMILCompositorTable.h',
'SMILMilestone.h',
'SMILSetAnimationFunction.h',
'SMILTargetIdentifier.h',
'SMILTimeContainer.h',
'SMILTimedElement.h',
]
@ -48,7 +48,6 @@ UNIFIED_SOURCES += [
'nsSMILKeySpline.cpp',
'nsSMILParserUtils.cpp',
'nsSMILRepeatCount.cpp',
'nsSMILTimeContainer.cpp',
'nsSMILTimeValue.cpp',
'nsSMILTimeValueSpec.cpp',
'nsSMILValue.cpp',
@ -63,6 +62,7 @@ UNIFIED_SOURCES += [
'SMILNullType.cpp',
'SMILSetAnimationFunction.cpp',
'SMILStringType.cpp',
'SMILTimeContainer.cpp',
'SMILTimedElement.cpp',
'TimeEvent.cpp',
]

Просмотреть файл

@ -64,7 +64,7 @@ void nsSMILInstanceTime::Unlink() {
}
void nsSMILInstanceTime::HandleChangedInterval(
const nsSMILTimeContainer* aSrcContainer, bool aBeginObjectChanged,
const SMILTimeContainer* aSrcContainer, bool aBeginObjectChanged,
bool aEndObjectChanged) {
// It's possible a sequence of notifications might cause our base interval to
// be updated and then deleted. Furthermore, the delete might happen whilst

Просмотреть файл

@ -7,12 +7,16 @@
#ifndef NS_SMILINSTANCETIME_H_
#define NS_SMILINSTANCETIME_H_
#include "nsISupportsImpl.h"
#include "nsSMILTimeValue.h"
class nsSMILInterval;
class nsSMILTimeContainer;
class nsSMILTimeValueSpec;
namespace mozilla {
class SMILTimeContainer;
}
//----------------------------------------------------------------------
// nsSMILInstanceTime
//
@ -55,7 +59,7 @@ class nsSMILInstanceTime final {
nsSMILInterval* aBaseInterval = nullptr);
void Unlink();
void HandleChangedInterval(const nsSMILTimeContainer* aSrcContainer,
void HandleChangedInterval(const mozilla::SMILTimeContainer* aSrcContainer,
bool aBeginObjectChanged, bool aEndObjectChanged);
void HandleDeletedInterval();
void HandleFilteredInterval();

Просмотреть файл

@ -5,13 +5,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/EventListenerManager.h"
#include "mozilla/SMILTimeContainer.h"
#include "mozilla/SMILTimedElement.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/SVGAnimationElement.h"
#include "mozilla/dom/TimeEvent.h"
#include "nsSMILTimeValueSpec.h"
#include "nsSMILInterval.h"
#include "nsSMILTimeContainer.h"
#include "nsSMILTimeValue.h"
#include "nsSMILInstanceTime.h"
#include "nsSMILParserUtils.h"
@ -108,7 +108,7 @@ bool nsSMILTimeValueSpec::IsEventBased() const {
}
void nsSMILTimeValueSpec::HandleNewInterval(
nsSMILInterval& aInterval, const nsSMILTimeContainer* aSrcContainer) {
nsSMILInterval& aInterval, const SMILTimeContainer* aSrcContainer) {
const nsSMILInstanceTime& baseInstance =
mParams.mSyncBegin ? *aInterval.Begin() : *aInterval.End();
nsSMILTimeValue newTime =
@ -133,8 +133,7 @@ void nsSMILTimeValueSpec::HandleTargetElementChange(Element* aNewTarget) {
}
void nsSMILTimeValueSpec::HandleChangedInstanceTime(
const nsSMILInstanceTime& aBaseTime,
const nsSMILTimeContainer* aSrcContainer,
const nsSMILInstanceTime& aBaseTime, const SMILTimeContainer* aSrcContainer,
nsSMILInstanceTime& aInstanceTimeToUpdate, bool aObjectChanged) {
// If the instance time is fixed (e.g. because it's being used as the begin
// time of an active or postactive interval) we just ignore the change.
@ -294,7 +293,7 @@ void nsSMILTimeValueSpec::HandleEvent(Event* aEvent) {
// XXX In the long run we should get the time from the event itself which will
// store the time in global document time which we'll need to convert to our
// time container
nsSMILTimeContainer* container = mOwner->GetTimeContainer();
SMILTimeContainer* container = mOwner->GetTimeContainer();
if (!container) return;
if (mParams.mType == nsSMILTimeValueSpecParams::REPEAT &&
@ -326,13 +325,13 @@ bool nsSMILTimeValueSpec::CheckRepeatEventDetail(Event* aEvent) {
}
nsSMILTimeValue nsSMILTimeValueSpec::ConvertBetweenTimeContainers(
const nsSMILTimeValue& aSrcTime, const nsSMILTimeContainer* aSrcContainer) {
const nsSMILTimeValue& aSrcTime, const SMILTimeContainer* aSrcContainer) {
// If the source time is either indefinite or unresolved the result is going
// to be the same
if (!aSrcTime.IsDefinite()) return aSrcTime;
// Convert from source time container to our parent time container
const nsSMILTimeContainer* dstContainer = mOwner->GetTimeContainer();
const SMILTimeContainer* dstContainer = mOwner->GetTimeContainer();
if (dstContainer == aSrcContainer) return aSrcTime;
// If one of the elements is not attached to a time container then we can't do

Просмотреть файл

@ -14,11 +14,11 @@
#include "nsIDOMEventListener.h"
class nsSMILTimeValue;
class nsSMILTimeContainer;
class nsSMILInstanceTime;
class nsSMILInterval;
namespace mozilla {
class SMILTimeContainer;
class SMILTimedElement;
namespace dom {
class Event;
@ -40,6 +40,7 @@ class EventListenerManager;
class nsSMILTimeValueSpec {
public:
typedef mozilla::SMILTimeContainer SMILTimeContainer;
typedef mozilla::SMILTimedElement SMILTimedElement;
typedef mozilla::dom::Element Element;
typedef mozilla::dom::Event Event;
@ -53,13 +54,13 @@ class nsSMILTimeValueSpec {
bool IsEventBased() const;
void HandleNewInterval(nsSMILInterval& aInterval,
const nsSMILTimeContainer* aSrcContainer);
const SMILTimeContainer* aSrcContainer);
void HandleTargetElementChange(Element* aNewTarget);
// For created nsSMILInstanceTime objects
bool DependsOnBegin() const;
void HandleChangedInstanceTime(const nsSMILInstanceTime& aBaseTime,
const nsSMILTimeContainer* aSrcContainer,
const SMILTimeContainer* aSrcContainer,
nsSMILInstanceTime& aInstanceTimeToUpdate,
bool aObjectChanged);
void HandleDeletedInstanceTime(nsSMILInstanceTime& aInstanceTime);
@ -78,8 +79,7 @@ class nsSMILTimeValueSpec {
void HandleEvent(Event* aEvent);
bool CheckRepeatEventDetail(Event* aEvent);
nsSMILTimeValue ConvertBetweenTimeContainers(
const nsSMILTimeValue& aSrcTime,
const nsSMILTimeContainer* aSrcContainer);
const nsSMILTimeValue& aSrcTime, const SMILTimeContainer* aSrcContainer);
bool ApplyOffset(nsSMILTimeValue& aTime) const;
SMILTimedElement* mOwner;

Просмотреть файл

@ -9,7 +9,7 @@
#include "mozilla/dom/ElementInlines.h"
#include "mozilla/SMILAnimationController.h"
#include "mozilla/SMILAnimationFunction.h"
#include "nsSMILTimeContainer.h"
#include "mozilla/SMILTimeContainer.h"
#include "nsContentUtils.h"
#include "nsIContentInlines.h"
#include "nsIURI.h"
@ -110,7 +110,7 @@ float SVGAnimationElement::GetStartTime(ErrorResult& rv) {
float SVGAnimationElement::GetCurrentTimeAsFloat() {
// Not necessary to call FlushAnimations() for this
nsSMILTimeContainer* root = GetTimeContainer();
SMILTimeContainer* root = GetTimeContainer();
if (root) {
return float(double(root->GetCurrentTimeAsSMILTime()) / PR_MSEC_PER_SEC);
}
@ -299,7 +299,7 @@ void SVGAnimationElement::ActivateByHyperlink() {
// http://www.w3.org/TR/smil-animation/#HyperlinkSemantics
nsSMILTimeValue seekTime = mTimedElement.GetHyperlinkTime();
if (seekTime.IsDefinite()) {
nsSMILTimeContainer* timeContainer = GetTimeContainer();
SMILTimeContainer* timeContainer = GetTimeContainer();
if (timeContainer) {
timeContainer->SetCurrentTime(seekTime.GetMillis());
AnimationNeedsResample();
@ -317,7 +317,7 @@ void SVGAnimationElement::ActivateByHyperlink() {
//----------------------------------------------------------------------
// Implementation helpers
nsSMILTimeContainer* SVGAnimationElement::GetTimeContainer() {
SMILTimeContainer* SVGAnimationElement::GetTimeContainer() {
SVGSVGElement* element = SVGContentUtils::GetOuterSVGElement(this);
if (element) {

Просмотреть файл

@ -8,10 +8,10 @@
#define mozilla_dom_SVGAnimationElement_h
#include "mozilla/Attributes.h"
#include "mozilla/SMILTimedElement.h"
#include "mozilla/dom/IDTracker.h"
#include "mozilla/dom/SVGElement.h"
#include "mozilla/dom/SVGTests.h"
#include "mozilla/SMILTimedElement.h"
namespace mozilla {
namespace dom {
@ -62,7 +62,7 @@ class SVGAnimationElement : public SVGAnimationElementBase, public SVGTests {
virtual bool GetTargetAttributeName(int32_t* aNamespaceID,
nsAtom** aLocalName) const;
mozilla::SMILTimedElement& TimedElement();
nsSMILTimeContainer* GetTimeContainer();
mozilla::SMILTimeContainer* GetTimeContainer();
virtual SMILAnimationFunction& AnimationFunction() = 0;
virtual bool IsEventAttributeNameInternal(nsAtom* aName) override;

Просмотреть файл

@ -13,6 +13,7 @@
#include "mozilla/dom/SVGViewElement.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/SMILAnimationController.h"
#include "mozilla/SMILTimeContainer.h"
#include "DOMSVGAngle.h"
#include "DOMSVGLength.h"
@ -22,7 +23,6 @@
#include "nsLayoutStylesheetCache.h"
#include "nsIFrame.h"
#include "nsISVGSVGFrame.h"
#include "nsSMILTimeContainer.h"
#include "nsSVGDisplayableFrame.h"
#include "nsSVGUtils.h"
@ -196,25 +196,25 @@ void SVGSVGElement::ForceRedraw() {
void SVGSVGElement::PauseAnimations() {
if (mTimedDocumentRoot) {
mTimedDocumentRoot->Pause(nsSMILTimeContainer::PAUSE_SCRIPT);
mTimedDocumentRoot->Pause(SMILTimeContainer::PAUSE_SCRIPT);
}
// else we're not the outermost <svg> or not bound to a tree, so silently fail
}
void SVGSVGElement::UnpauseAnimations() {
if (mTimedDocumentRoot) {
mTimedDocumentRoot->Resume(nsSMILTimeContainer::PAUSE_SCRIPT);
mTimedDocumentRoot->Resume(SMILTimeContainer::PAUSE_SCRIPT);
}
// else we're not the outermost <svg> or not bound to a tree, so silently fail
}
bool SVGSVGElement::AnimationsPaused() {
nsSMILTimeContainer* root = GetTimedDocumentRoot();
return root && root->IsPausedByType(nsSMILTimeContainer::PAUSE_SCRIPT);
SMILTimeContainer* root = GetTimedDocumentRoot();
return root && root->IsPausedByType(SMILTimeContainer::PAUSE_SCRIPT);
}
float SVGSVGElement::GetCurrentTimeAsFloat() {
nsSMILTimeContainer* root = GetTimedDocumentRoot();
SMILTimeContainer* root = GetTimedDocumentRoot();
if (root) {
double fCurrentTimeMs = double(root->GetCurrentTimeAsSMILTime());
return (float)(fCurrentTimeMs / PR_MSEC_PER_SEC);
@ -358,7 +358,7 @@ void SVGSVGElement::SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv) {
}
//----------------------------------------------------------------------
nsSMILTimeContainer* SVGSVGElement::GetTimedDocumentRoot() {
SMILTimeContainer* SVGSVGElement::GetTimedDocumentRoot() {
if (mTimedDocumentRoot) {
return mTimedDocumentRoot;
}
@ -385,7 +385,7 @@ nsresult SVGSVGElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (WillBeOutermostSVG(aParent, aBindingParent)) {
// We'll be the outermost <svg> element. We'll need a time container.
if (!mTimedDocumentRoot) {
mTimedDocumentRoot = new nsSMILTimeContainer();
mTimedDocumentRoot = new SMILTimeContainer();
}
} else {
// We're a child of some other <svg> element, so we don't need our own

Просмотреть файл

@ -13,10 +13,9 @@ nsresult NS_NewSVGSVGElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
mozilla::dom::FromParser aFromParser);
class nsSMILTimeContainer;
namespace mozilla {
class AutoSVGViewHandler;
class SMILTimeContainer;
class SVGFragmentIdentifier;
class EventChainPreVisitor;
@ -160,7 +159,7 @@ class SVGSVGElement final : public SVGSVGElementBase {
return mCurrentViewID && mCurrentViewID->Equals(aViewID);
}
nsSMILTimeContainer* GetTimedDocumentRoot();
SMILTimeContainer* GetTimedDocumentRoot();
// public helpers:
@ -231,7 +230,7 @@ class SVGSVGElement final : public SVGSVGElementBase {
// The time container for animations within this SVG document fragment. Set
// for all outermost <svg> elements (not nested <svg> elements).
nsAutoPtr<nsSMILTimeContainer> mTimedDocumentRoot;
nsAutoPtr<SMILTimeContainer> mTimedDocumentRoot;
// zoom and pan
// IMPORTANT: see the comment in RecordCurrentScaleTranslate before writing

Просмотреть файл

@ -156,8 +156,7 @@ nsresult gfxSVGGlyphsDocument::SetupPresentation() {
mDocument->FlushPendingNotifications(FlushType::Layout);
if (mDocument->HasAnimationController()) {
mDocument->GetAnimationController()->Resume(
nsSMILTimeContainer::PAUSE_IMAGE);
mDocument->GetAnimationController()->Resume(SMILTimeContainer::PAUSE_IMAGE);
}
mDocument->ImageTracker()->SetAnimatingState(true);

Просмотреть файл

@ -131,7 +131,7 @@ void SVGDocumentWrapper::StartAnimation() {
if (doc) {
SMILAnimationController* controller = doc->GetAnimationController();
if (controller) {
controller->Resume(nsSMILTimeContainer::PAUSE_IMAGE);
controller->Resume(SMILTimeContainer::PAUSE_IMAGE);
}
doc->ImageTracker()->SetAnimatingState(true);
}
@ -148,7 +148,7 @@ void SVGDocumentWrapper::StopAnimation() {
if (doc) {
SMILAnimationController* controller = doc->GetAnimationController();
if (controller) {
controller->Pause(nsSMILTimeContainer::PAUSE_IMAGE);
controller->Pause(SMILTimeContainer::PAUSE_IMAGE);
}
doc->ImageTracker()->SetAnimatingState(false);
}

Просмотреть файл

@ -1097,12 +1097,12 @@ void nsPresContext::SetSMILAnimations(nsIDocument* aDoc, uint16_t aNewMode,
case imgIContainer::kNormalAnimMode:
case imgIContainer::kLoopOnceAnimMode:
if (aOldMode == imgIContainer::kDontAnimMode)
controller->Resume(nsSMILTimeContainer::PAUSE_USERPREF);
controller->Resume(SMILTimeContainer::PAUSE_USERPREF);
break;
case imgIContainer::kDontAnimMode:
if (aOldMode != imgIContainer::kDontAnimMode)
controller->Pause(nsSMILTimeContainer::PAUSE_USERPREF);
controller->Pause(SMILTimeContainer::PAUSE_USERPREF);
break;
}
}