зеркало из https://github.com/mozilla/gecko-dev.git
Bug 704171 part 2. Remove the no-argument form of mozRequestAnimationFrame. r=roc
This commit is contained in:
Родитель
81790fcb60
Коммит
c0fc9ee395
|
@ -1518,11 +1518,7 @@ public:
|
|||
*/
|
||||
virtual Element* LookupImageElement(const nsAString& aElementId) = 0;
|
||||
|
||||
void ScheduleBeforePaintEvent(nsIFrameRequestCallback* aCallback);
|
||||
void BeforePaintEventFiring()
|
||||
{
|
||||
mHavePendingPaint = false;
|
||||
}
|
||||
void ScheduleFrameRequestCallback(nsIFrameRequestCallback* aCallback);
|
||||
|
||||
typedef nsTArray< nsCOMPtr<nsIFrameRequestCallback> > FrameRequestCallbackList;
|
||||
/**
|
||||
|
@ -1746,9 +1742,6 @@ protected:
|
|||
// True if document has ever had script handling object.
|
||||
bool mHasHadScriptHandlingObject;
|
||||
|
||||
// True if we're waiting for a before-paint event.
|
||||
bool mHavePendingPaint;
|
||||
|
||||
// True if we're an SVG document being used as an image.
|
||||
bool mIsBeingUsedAsImage;
|
||||
|
||||
|
|
|
@ -3214,9 +3214,6 @@ nsDocument::MaybeRescheduleAnimationFrameNotifications()
|
|||
}
|
||||
|
||||
nsRefreshDriver* rd = mPresShell->GetPresContext()->RefreshDriver();
|
||||
if (mHavePendingPaint) {
|
||||
rd->ScheduleBeforePaintEvent(this);
|
||||
}
|
||||
if (!mFrameRequestCallbacks.IsEmpty()) {
|
||||
rd->ScheduleFrameRequestCallbacks(this);
|
||||
}
|
||||
|
@ -3243,9 +3240,6 @@ nsDocument::DeleteShell()
|
|||
void
|
||||
nsDocument::RevokeAnimationFrameNotifications()
|
||||
{
|
||||
if (mHavePendingPaint) {
|
||||
mPresShell->GetPresContext()->RefreshDriver()->RevokeBeforePaintEvent(this);
|
||||
}
|
||||
if (!mFrameRequestCallbacks.IsEmpty()) {
|
||||
mPresShell->GetPresContext()->RefreshDriver()->
|
||||
RevokeFrameRequestCallbacks(this);
|
||||
|
@ -8074,30 +8068,14 @@ nsIDocument::CreateStaticClone(nsISupports* aCloneContainer)
|
|||
}
|
||||
|
||||
void
|
||||
nsIDocument::ScheduleBeforePaintEvent(nsIFrameRequestCallback* aCallback)
|
||||
nsIDocument::ScheduleFrameRequestCallback(nsIFrameRequestCallback* aCallback)
|
||||
{
|
||||
if (aCallback) {
|
||||
bool alreadyRegistered = !mFrameRequestCallbacks.IsEmpty();
|
||||
if (mFrameRequestCallbacks.AppendElement(aCallback) &&
|
||||
!alreadyRegistered && mPresShell && IsEventHandlingEnabled()) {
|
||||
mPresShell->GetPresContext()->RefreshDriver()->
|
||||
ScheduleFrameRequestCallbacks(this);
|
||||
}
|
||||
|
||||
return;
|
||||
bool alreadyRegistered = !mFrameRequestCallbacks.IsEmpty();
|
||||
if (mFrameRequestCallbacks.AppendElement(aCallback) &&
|
||||
!alreadyRegistered && mPresShell && IsEventHandlingEnabled()) {
|
||||
mPresShell->GetPresContext()->RefreshDriver()->
|
||||
ScheduleFrameRequestCallbacks(this);
|
||||
}
|
||||
|
||||
if (!mHavePendingPaint) {
|
||||
// We don't want to use GetShell() here, because we want to schedule the
|
||||
// paint even if we're frozen. Either we'll get unfrozen and then the
|
||||
// event will fire, or we'll quietly go away at some point.
|
||||
mHavePendingPaint =
|
||||
!mPresShell ||
|
||||
!IsEventHandlingEnabled() ||
|
||||
mPresShell->GetPresContext()->RefreshDriver()->
|
||||
ScheduleBeforePaintEvent(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -3966,7 +3966,7 @@ nsGlobalWindow::MozRequestAnimationFrame(nsIFrameRequestCallback* aCallback)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
mDoc->ScheduleBeforePaintEvent(aCallback);
|
||||
mDoc->ScheduleFrameRequestCallback(aCallback);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 nsIFrameRequestCallback aCallback);
|
||||
mozRequestAnimationFrame(in nsIFrameRequestCallback aCallback);
|
||||
|
||||
/**
|
||||
* The current animation start time in milliseconds since the epoch.
|
||||
|
|
|
@ -269,7 +269,6 @@ nsRefreshDriver::ObserverCount() const
|
|||
// style changes, etc.
|
||||
sum += mStyleFlushObservers.Length();
|
||||
sum += mLayoutFlushObservers.Length();
|
||||
sum += mBeforePaintTargets.Length();
|
||||
sum += mFrameRequestCallbackDocs.Length();
|
||||
return sum;
|
||||
}
|
||||
|
@ -365,16 +364,7 @@ nsRefreshDriver::Notify(nsITimer *aTimer)
|
|||
}
|
||||
|
||||
if (i == 0) {
|
||||
// Don't just loop while we have things in mBeforePaintTargets,
|
||||
// the whole point is that event handlers should readd the
|
||||
// target as needed.
|
||||
nsTArray< nsCOMPtr<nsIDocument> > targets;
|
||||
targets.SwapElements(mBeforePaintTargets);
|
||||
for (PRUint32 i = 0; i < targets.Length(); ++i) {
|
||||
targets[i]->BeforePaintEventFiring();
|
||||
}
|
||||
|
||||
// Also grab all of our frame request callbacks up front.
|
||||
// Grab all of our frame request callbacks up front.
|
||||
nsIDocument::FrameRequestCallbackList frameRequestCallbacks;
|
||||
for (PRUint32 i = 0; i < mFrameRequestCallbackDocs.Length(); ++i) {
|
||||
mFrameRequestCallbackDocs[i]->
|
||||
|
@ -385,12 +375,6 @@ nsRefreshDriver::Notify(nsITimer *aTimer)
|
|||
mFrameRequestCallbackDocs.Clear();
|
||||
|
||||
PRInt64 eventTime = mMostRecentRefreshEpochTime / PR_USEC_PER_MSEC;
|
||||
for (PRUint32 i = 0; i < targets.Length(); ++i) {
|
||||
nsEvent ev(true, NS_BEFOREPAINT);
|
||||
ev.time = eventTime;
|
||||
nsEventDispatcher::Dispatch(targets[i], nsnull, &ev);
|
||||
}
|
||||
|
||||
for (PRUint32 i = 0; i < frameRequestCallbacks.Length(); ++i) {
|
||||
frameRequestCallbacks[i]->Sample(eventTime);
|
||||
}
|
||||
|
@ -541,17 +525,6 @@ nsRefreshDriver::IsRefreshObserver(nsARefreshObserver *aObserver,
|
|||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
nsRefreshDriver::ScheduleBeforePaintEvent(nsIDocument* aDocument)
|
||||
{
|
||||
NS_ASSERTION(mBeforePaintTargets.IndexOf(aDocument) ==
|
||||
mBeforePaintTargets.NoIndex,
|
||||
"Shouldn't have a paint event posted for this document");
|
||||
bool appended = mBeforePaintTargets.AppendElement(aDocument) != nsnull;
|
||||
EnsureTimerStarted(false);
|
||||
return appended;
|
||||
}
|
||||
|
||||
void
|
||||
nsRefreshDriver::ScheduleFrameRequestCallbacks(nsIDocument* aDocument)
|
||||
{
|
||||
|
@ -564,12 +537,6 @@ nsRefreshDriver::ScheduleFrameRequestCallbacks(nsIDocument* aDocument)
|
|||
EnsureTimerStarted(false);
|
||||
}
|
||||
|
||||
void
|
||||
nsRefreshDriver::RevokeBeforePaintEvent(nsIDocument* aDocument)
|
||||
{
|
||||
mBeforePaintTargets.RemoveElement(aDocument);
|
||||
}
|
||||
|
||||
void
|
||||
nsRefreshDriver::RevokeFrameRequestCallbacks(nsIDocument* aDocument)
|
||||
{
|
||||
|
|
|
@ -176,21 +176,11 @@ public:
|
|||
return mLayoutFlushObservers.Contains(aShell);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a document for which we should fire a MozBeforePaint event.
|
||||
*/
|
||||
bool ScheduleBeforePaintEvent(nsIDocument* aDocument);
|
||||
|
||||
/**
|
||||
* Add a document for which we have nsIFrameRequestCallbacks
|
||||
*/
|
||||
void ScheduleFrameRequestCallbacks(nsIDocument* aDocument);
|
||||
|
||||
/**
|
||||
* Remove a document for which we should fire a MozBeforePaint event.
|
||||
*/
|
||||
void RevokeBeforePaintEvent(nsIDocument* aDocument);
|
||||
|
||||
/**
|
||||
* Remove a document for which we have nsIFrameRequestCallbacks
|
||||
*/
|
||||
|
@ -283,8 +273,6 @@ private:
|
|||
nsAutoTArray<nsIPresShell*, 16> mStyleFlushObservers;
|
||||
nsAutoTArray<nsIPresShell*, 16> mLayoutFlushObservers;
|
||||
// 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*> mFrameRequestCallbackDocs;
|
||||
|
||||
// This is the last interval we used for our timer. May be 0 if we
|
||||
|
|
Загрузка…
Ссылка в новой задаче