mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 704175 part 2. Rename nsIAnimationFrameListener to nsIFrameRequestCallback. r=roc
--HG-- rename : dom/interfaces/base/nsIAnimationFrameListener.idl => dom/interfaces/base/nsIFrameRequestCallback.idl
This commit is contained in:
parent
425c3fb061
commit
736d324733
@ -64,7 +64,7 @@
|
||||
#include "nsSMILAnimationController.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsIAnimationFrameListener.h"
|
||||
#include "nsIFrameRequestCallback.h"
|
||||
#include "nsEventStates.h"
|
||||
#include "nsIStructuredCloneContainer.h"
|
||||
#include "nsIBFCacheEntry.h"
|
||||
@ -1518,18 +1518,18 @@ public:
|
||||
*/
|
||||
virtual Element* LookupImageElement(const nsAString& aElementId) = 0;
|
||||
|
||||
void ScheduleBeforePaintEvent(nsIAnimationFrameListener* aListener);
|
||||
void ScheduleBeforePaintEvent(nsIFrameRequestCallback* aCallback);
|
||||
void BeforePaintEventFiring()
|
||||
{
|
||||
mHavePendingPaint = false;
|
||||
}
|
||||
|
||||
typedef nsTArray< nsCOMPtr<nsIAnimationFrameListener> > AnimationListenerList;
|
||||
typedef nsTArray< nsCOMPtr<nsIFrameRequestCallback> > FrameRequestCallbackList;
|
||||
/**
|
||||
* Put this documents animation frame listeners into the provided
|
||||
* Put this document's frame request callbacks into the provided
|
||||
* list, and forget about them.
|
||||
*/
|
||||
void TakeAnimationFrameListeners(AnimationListenerList& aListeners);
|
||||
void TakeFrameRequestCallbacks(FrameRequestCallbackList& aCallbacks);
|
||||
|
||||
// This returns true when the document tree is being teared down.
|
||||
bool InUnlinkOrDeletion() { return mInUnlinkOrDeletion; }
|
||||
@ -1812,7 +1812,7 @@ protected:
|
||||
|
||||
nsCOMPtr<nsIDocumentEncoder> mCachedEncoder;
|
||||
|
||||
AnimationListenerList mAnimationFrameListeners;
|
||||
FrameRequestCallbackList mFrameRequestCallbacks;
|
||||
|
||||
// This object allows us to evict ourself from the back/forward cache. The
|
||||
// pointer is non-null iff we're currently in the bfcache.
|
||||
|
@ -1881,9 +1881,9 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(mCatalogSheets)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(mPreloadingImages)
|
||||
|
||||
for (PRUint32 i = 0; i < tmp->mAnimationFrameListeners.Length(); ++i) {
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mAnimationFrameListeners[i]");
|
||||
cb.NoteXPCOMChild(tmp->mAnimationFrameListeners[i]);
|
||||
for (PRUint32 i = 0; i < tmp->mFrameRequestCallbacks.Length(); ++i) {
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mFrameRequestCallbacks[i]");
|
||||
cb.NoteXPCOMChild(tmp->mFrameRequestCallbacks[i]);
|
||||
}
|
||||
|
||||
// Traverse animation components
|
||||
@ -1951,7 +1951,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
|
||||
tmp->mSubDocuments = nsnull;
|
||||
}
|
||||
|
||||
tmp->mAnimationFrameListeners.Clear();
|
||||
tmp->mFrameRequestCallbacks.Clear();
|
||||
|
||||
tmp->mRadioGroups.Clear();
|
||||
|
||||
@ -3217,16 +3217,16 @@ nsDocument::MaybeRescheduleAnimationFrameNotifications()
|
||||
if (mHavePendingPaint) {
|
||||
rd->ScheduleBeforePaintEvent(this);
|
||||
}
|
||||
if (!mAnimationFrameListeners.IsEmpty()) {
|
||||
rd->ScheduleAnimationFrameListeners(this);
|
||||
if (!mFrameRequestCallbacks.IsEmpty()) {
|
||||
rd->ScheduleFrameRequestCallbacks(this);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::TakeAnimationFrameListeners(AnimationListenerList& aListeners)
|
||||
nsIDocument::TakeFrameRequestCallbacks(FrameRequestCallbackList& aCallbacks)
|
||||
{
|
||||
aListeners.AppendElements(mAnimationFrameListeners);
|
||||
mAnimationFrameListeners.Clear();
|
||||
aCallbacks.AppendElements(mFrameRequestCallbacks);
|
||||
mFrameRequestCallbacks.Clear();
|
||||
}
|
||||
|
||||
void
|
||||
@ -3246,9 +3246,9 @@ nsDocument::RevokeAnimationFrameNotifications()
|
||||
if (mHavePendingPaint) {
|
||||
mPresShell->GetPresContext()->RefreshDriver()->RevokeBeforePaintEvent(this);
|
||||
}
|
||||
if (!mAnimationFrameListeners.IsEmpty()) {
|
||||
if (!mFrameRequestCallbacks.IsEmpty()) {
|
||||
mPresShell->GetPresContext()->RefreshDriver()->
|
||||
RevokeAnimationFrameListeners(this);
|
||||
RevokeFrameRequestCallbacks(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8074,14 +8074,14 @@ nsIDocument::CreateStaticClone(nsISupports* aCloneContainer)
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::ScheduleBeforePaintEvent(nsIAnimationFrameListener* aListener)
|
||||
nsIDocument::ScheduleBeforePaintEvent(nsIFrameRequestCallback* aCallback)
|
||||
{
|
||||
if (aListener) {
|
||||
bool alreadyRegistered = !mAnimationFrameListeners.IsEmpty();
|
||||
if (mAnimationFrameListeners.AppendElement(aListener) &&
|
||||
if (aCallback) {
|
||||
bool alreadyRegistered = !mFrameRequestCallbacks.IsEmpty();
|
||||
if (mFrameRequestCallbacks.AppendElement(aCallback) &&
|
||||
!alreadyRegistered && mPresShell && IsEventHandlingEnabled()) {
|
||||
mPresShell->GetPresContext()->RefreshDriver()->
|
||||
ScheduleAnimationFrameListeners(this);
|
||||
ScheduleFrameRequestCallbacks(this);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -3957,16 +3957,16 @@ nsGlobalWindow::GetMozPaintCount(PRUint64* aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::MozRequestAnimationFrame(nsIAnimationFrameListener* aListener)
|
||||
nsGlobalWindow::MozRequestAnimationFrame(nsIFrameRequestCallback* aCallback)
|
||||
{
|
||||
FORWARD_TO_INNER(MozRequestAnimationFrame, (aListener),
|
||||
FORWARD_TO_INNER(MozRequestAnimationFrame, (aCallback),
|
||||
NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
if (!mDoc) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mDoc->ScheduleBeforePaintEvent(aListener);
|
||||
mDoc->ScheduleBeforePaintEvent(aCallback);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ SDK_XPIDLSRCS = \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIAnimationFrameListener.idl \
|
||||
nsIFrameRequestCallback.idl \
|
||||
nsIBrowserDOMWindow.idl \
|
||||
nsIContentPermissionPrompt.idl \
|
||||
nsIContentPrefService.idl \
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
#include "domstubs.idl"
|
||||
|
||||
interface nsIAnimationFrameListener;
|
||||
interface nsIFrameRequestCallback;
|
||||
interface nsIControllers;
|
||||
interface nsIDOMBlob;
|
||||
interface nsIDOMLocation;
|
||||
@ -418,7 +418,7 @@ interface nsIDOMWindow : nsISupports
|
||||
* @see <http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html>
|
||||
*/
|
||||
void
|
||||
mozRequestAnimationFrame([optional] in nsIAnimationFrameListener aListener);
|
||||
mozRequestAnimationFrame([optional] in nsIFrameRequestCallback aCallback);
|
||||
|
||||
/**
|
||||
* The current animation start time in milliseconds since the epoch.
|
||||
|
@ -36,14 +36,13 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Interface that represents a listener to be passed to
|
||||
* mozRequestAnimationFrame
|
||||
* Interface that represents a callback to be passed to requestAnimationFrame
|
||||
*/
|
||||
|
||||
#include "domstubs.idl"
|
||||
|
||||
[scriptable, function, uuid(ba240e38-c15a-4fb2-802a-8a48f09331bd)]
|
||||
interface nsIAnimationFrameListener : nsISupports
|
||||
[scriptable, function, uuid(e8d887f0-2ed7-406f-9f1d-edeb2c54c0a2)]
|
||||
interface nsIFrameRequestCallback : nsISupports
|
||||
{
|
||||
/**
|
||||
* The timestamp is the time to be used for the animation sample.
|
@ -100,7 +100,7 @@ nsRefreshDriver::GetRefreshTimerType() const
|
||||
if (mThrottled) {
|
||||
return nsITimer::TYPE_ONE_SHOT;
|
||||
}
|
||||
if (HaveAnimationFrameListeners() || sPrecisePref) {
|
||||
if (HaveFrameRequestCallbacks() || sPrecisePref) {
|
||||
return nsITimer::TYPE_REPEATING_PRECISE_CAN_SKIP;
|
||||
}
|
||||
return nsITimer::TYPE_REPEATING_SLACK;
|
||||
@ -270,7 +270,7 @@ nsRefreshDriver::ObserverCount() const
|
||||
sum += mStyleFlushObservers.Length();
|
||||
sum += mLayoutFlushObservers.Length();
|
||||
sum += mBeforePaintTargets.Length();
|
||||
sum += mAnimationFrameListenerDocs.Length();
|
||||
sum += mFrameRequestCallbackDocs.Length();
|
||||
return sum;
|
||||
}
|
||||
|
||||
@ -374,15 +374,15 @@ nsRefreshDriver::Notify(nsITimer *aTimer)
|
||||
targets[i]->BeforePaintEventFiring();
|
||||
}
|
||||
|
||||
// Also grab all of our animation frame listeners up front.
|
||||
nsIDocument::AnimationListenerList animationListeners;
|
||||
for (PRUint32 i = 0; i < mAnimationFrameListenerDocs.Length(); ++i) {
|
||||
mAnimationFrameListenerDocs[i]->
|
||||
TakeAnimationFrameListeners(animationListeners);
|
||||
// Also grab all of our frame request callbacks up front.
|
||||
nsIDocument::FrameRequestCallbackList frameRequestCallbacks;
|
||||
for (PRUint32 i = 0; i < mFrameRequestCallbackDocs.Length(); ++i) {
|
||||
mFrameRequestCallbackDocs[i]->
|
||||
TakeFrameRequestCallbacks(frameRequestCallbacks);
|
||||
}
|
||||
// OK, now reset mAnimationFrameListenerDocs so they can be
|
||||
// OK, now reset mFrameRequestCallbackDocs so they can be
|
||||
// readded as needed.
|
||||
mAnimationFrameListenerDocs.Clear();
|
||||
mFrameRequestCallbackDocs.Clear();
|
||||
|
||||
PRInt64 eventTime = mMostRecentRefreshEpochTime / PR_USEC_PER_MSEC;
|
||||
for (PRUint32 i = 0; i < targets.Length(); ++i) {
|
||||
@ -391,8 +391,8 @@ nsRefreshDriver::Notify(nsITimer *aTimer)
|
||||
nsEventDispatcher::Dispatch(targets[i], nsnull, &ev);
|
||||
}
|
||||
|
||||
for (PRUint32 i = 0; i < animationListeners.Length(); ++i) {
|
||||
animationListeners[i]->Sample(eventTime);
|
||||
for (PRUint32 i = 0; i < frameRequestCallbacks.Length(); ++i) {
|
||||
frameRequestCallbacks[i]->Sample(eventTime);
|
||||
}
|
||||
|
||||
// This is the Flush_Style case.
|
||||
@ -553,12 +553,12 @@ nsRefreshDriver::ScheduleBeforePaintEvent(nsIDocument* aDocument)
|
||||
}
|
||||
|
||||
void
|
||||
nsRefreshDriver::ScheduleAnimationFrameListeners(nsIDocument* aDocument)
|
||||
nsRefreshDriver::ScheduleFrameRequestCallbacks(nsIDocument* aDocument)
|
||||
{
|
||||
NS_ASSERTION(mAnimationFrameListenerDocs.IndexOf(aDocument) ==
|
||||
mAnimationFrameListenerDocs.NoIndex,
|
||||
NS_ASSERTION(mFrameRequestCallbackDocs.IndexOf(aDocument) ==
|
||||
mFrameRequestCallbackDocs.NoIndex,
|
||||
"Don't schedule the same document multiple times");
|
||||
mAnimationFrameListenerDocs.AppendElement(aDocument);
|
||||
mFrameRequestCallbackDocs.AppendElement(aDocument);
|
||||
// No need to worry about restarting our timer in precise mode if it's
|
||||
// already running; that will happen automatically when it fires.
|
||||
EnsureTimerStarted(false);
|
||||
@ -571,9 +571,9 @@ nsRefreshDriver::RevokeBeforePaintEvent(nsIDocument* aDocument)
|
||||
}
|
||||
|
||||
void
|
||||
nsRefreshDriver::RevokeAnimationFrameListeners(nsIDocument* aDocument)
|
||||
nsRefreshDriver::RevokeFrameRequestCallbacks(nsIDocument* aDocument)
|
||||
{
|
||||
mAnimationFrameListenerDocs.RemoveElement(aDocument);
|
||||
mFrameRequestCallbackDocs.RemoveElement(aDocument);
|
||||
// No need to worry about restarting our timer in slack mode if it's already
|
||||
// running; that will happen automatically when it fires.
|
||||
}
|
||||
|
@ -182,9 +182,9 @@ public:
|
||||
bool ScheduleBeforePaintEvent(nsIDocument* aDocument);
|
||||
|
||||
/**
|
||||
* Add a document for which we have nsIAnimationFrameListeners
|
||||
* Add a document for which we have nsIFrameRequestCallbacks
|
||||
*/
|
||||
void ScheduleAnimationFrameListeners(nsIDocument* aDocument);
|
||||
void ScheduleFrameRequestCallbacks(nsIDocument* aDocument);
|
||||
|
||||
/**
|
||||
* Remove a document for which we should fire a MozBeforePaint event.
|
||||
@ -192,9 +192,9 @@ public:
|
||||
void RevokeBeforePaintEvent(nsIDocument* aDocument);
|
||||
|
||||
/**
|
||||
* Remove a document for which we have nsIAnimationFrameListeners
|
||||
* Remove a document for which we have nsIFrameRequestCallbacks
|
||||
*/
|
||||
void RevokeAnimationFrameListeners(nsIDocument* aDocument);
|
||||
void RevokeFrameRequestCallbacks(nsIDocument* aDocument);
|
||||
|
||||
/**
|
||||
* Tell the refresh driver that it is done driving refreshes and
|
||||
@ -256,8 +256,8 @@ private:
|
||||
PRInt32 GetRefreshTimerInterval() const;
|
||||
PRInt32 GetRefreshTimerType() const;
|
||||
|
||||
bool HaveAnimationFrameListeners() const {
|
||||
return mAnimationFrameListenerDocs.Length() != 0;
|
||||
bool HaveFrameRequestCallbacks() const {
|
||||
return mFrameRequestCallbackDocs.Length() != 0;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
@ -285,7 +285,7 @@ private:
|
||||
// nsTArray on purpose, because we want to be able to swap.
|
||||
nsTArray< nsCOMPtr<nsIDocument> > mBeforePaintTargets;
|
||||
// nsTArray on purpose, because we want to be able to swap.
|
||||
nsTArray<nsIDocument*> mAnimationFrameListenerDocs;
|
||||
nsTArray<nsIDocument*> mFrameRequestCallbackDocs;
|
||||
|
||||
// This is the last interval we used for our timer. May be 0 if we
|
||||
// haven't computed a timer interval yet.
|
||||
|
Loading…
Reference in New Issue
Block a user