diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 9a7694109030..69832c6d345f 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -505,8 +505,6 @@ nsContentUtils::InitializeEventTable() { { &nsGkAtoms::onMozRotateGesture, { NS_SIMPLE_GESTURE_ROTATE, EventNameType_None } }, { &nsGkAtoms::onMozTapGesture, { NS_SIMPLE_GESTURE_TAP, EventNameType_None } }, { &nsGkAtoms::onMozPressTapGesture, { NS_SIMPLE_GESTURE_PRESSTAP, EventNameType_None } }, - - { &nsGkAtoms::ontransitionend, { NS_TRANSITION_END, EventNameType_None }}, }; sEventTable = new nsDataHashtable; diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index 675b5c6eb852..a56787921c27 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -678,7 +678,6 @@ GK_ATOM(onselect, "onselect") GK_ATOM(onset, "onset") GK_ATOM(onsubmit, "onsubmit") GK_ATOM(ontext, "ontext") -GK_ATOM(ontransitionend, "ontransitionend") GK_ATOM(onunderflow, "onunderflow") GK_ATOM(onunload, "onunload") GK_ATOM(open, "open") diff --git a/content/events/public/nsIPrivateDOMEvent.h b/content/events/public/nsIPrivateDOMEvent.h index de50ca1acdbb..b71eb03824b7 100644 --- a/content/events/public/nsIPrivateDOMEvent.h +++ b/content/events/public/nsIPrivateDOMEvent.h @@ -115,6 +115,4 @@ nsresult NS_NewDOMSimpleGestureEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsSimpleGestureEvent* aEvent); nsresult NS_NewDOMScrollAreaEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsScrollAreaEvent* aEvent); -nsresult -NS_NewDOMTransitionEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsTransitionEvent* aEvent); #endif // nsIPrivateDOMEvent_h__ diff --git a/content/events/src/Makefile.in b/content/events/src/Makefile.in index ea0e17863c2f..e009fa0f7f94 100644 --- a/content/events/src/Makefile.in +++ b/content/events/src/Makefile.in @@ -81,7 +81,6 @@ CPPSRCS = \ nsDOMSimpleGestureEvent.cpp \ nsDOMEventTargetHelper.cpp \ nsDOMScrollAreaEvent.cpp \ - nsDOMTransitionEvent.cpp \ $(NULL) # we don't want the shared lib, but we want to force the creation of a static lib. diff --git a/content/events/src/nsDOMEvent.cpp b/content/events/src/nsDOMEvent.cpp index 41a784b16362..248df57ba853 100644 --- a/content/events/src/nsDOMEvent.cpp +++ b/content/events/src/nsDOMEvent.cpp @@ -92,8 +92,7 @@ static const char* const sEventNames[] = { "MozRotateGesture", "MozTapGesture", "MozPressTapGesture", - "MozScrolledAreaChanged", - "transitionend" + "MozScrolledAreaChanged" }; static char *sPopupAllowedEvents; @@ -706,10 +705,6 @@ nsDOMEvent::SetEventType(const nsAString& aEventTypeArg) else if (atom == nsGkAtoms::onMozTapGesture) mEvent->message = NS_SIMPLE_GESTURE_TAP; } - else if (mEvent->eventStructType == NS_TRANSITION_EVENT) { - if (atom == nsGkAtoms::ontransitionend) - mEvent->message = NS_TRANSITION_END; - } if (mEvent->message == NS_USER_DEFINED_EVENT) mEvent->userType = atom; @@ -1012,16 +1007,6 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData() newEvent = simpleGestureEvent; break; } - case NS_TRANSITION_EVENT: - { - nsTransitionEvent* oldTransitionEvent = - static_cast(mEvent); - newEvent = new nsTransitionEvent(PR_FALSE, msg, - oldTransitionEvent->propertyName, - oldTransitionEvent->elapsedTime); - NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY); - break; - } default: { NS_WARNING("Unknown event type!!!"); @@ -1510,8 +1495,6 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType) return sEventNames[eDOMEvents_MozPressTapGesture]; case NS_SCROLLEDAREACHANGED: return sEventNames[eDOMEvents_MozScrolledAreaChanged]; - case NS_TRANSITION_END: - return sEventNames[eDOMEvents_transitionend]; default: break; } diff --git a/content/events/src/nsDOMEvent.h b/content/events/src/nsDOMEvent.h index 888a8fd3a639..c40ef0db8659 100644 --- a/content/events/src/nsDOMEvent.h +++ b/content/events/src/nsDOMEvent.h @@ -171,8 +171,7 @@ public: eDOMEvents_MozRotateGesture, eDOMEvents_MozTapGesture, eDOMEvents_MozPressTapGesture, - eDOMEvents_MozScrolledAreaChanged, - eDOMEvents_transitionend + eDOMEvents_MozScrolledAreaChanged }; nsDOMEvent(nsPresContext* aPresContext, nsEvent* aEvent); diff --git a/content/events/src/nsDOMTransitionEvent.cpp b/content/events/src/nsDOMTransitionEvent.cpp deleted file mode 100644 index 5b1876cfb00a..000000000000 --- a/content/events/src/nsDOMTransitionEvent.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is nsDOMTransitionEvent. - * - * The Initial Developer of the Original Code is the Mozilla Foundation. - * Portions created by the Initial Developer are Copyright (C) 2009 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * L. David Baron , Mozilla Corporation (original author) - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsDOMTransitionEvent.h" -#include "nsGUIEvent.h" - -nsDOMTransitionEvent::nsDOMTransitionEvent(nsPresContext *aPresContext, - nsTransitionEvent *aEvent) - : nsDOMEvent(aPresContext, aEvent ? aEvent - : new nsTransitionEvent(PR_FALSE, 0, - EmptyString(), - 0.0)) -{ - if (aEvent) { - mEventIsInternal = PR_FALSE; - } - else { - mEventIsInternal = PR_TRUE; - mEvent->time = PR_Now(); - } -} - -nsDOMTransitionEvent::~nsDOMTransitionEvent() -{ - if (mEventIsInternal) { - delete TransitionEvent(); - mEvent = nsnull; - } -} - -NS_INTERFACE_MAP_BEGIN(nsDOMTransitionEvent) - NS_INTERFACE_MAP_ENTRY(nsIDOMTransitionEvent) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(TransitionEvent) -NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent) - -NS_IMPL_ADDREF_INHERITED(nsDOMTransitionEvent, nsDOMEvent) -NS_IMPL_RELEASE_INHERITED(nsDOMTransitionEvent, nsDOMEvent) - -NS_IMETHODIMP -nsDOMTransitionEvent::GetPropertyName(nsAString & aPropertyName) -{ - aPropertyName = TransitionEvent()->propertyName; - return NS_OK; -} - -NS_IMETHODIMP -nsDOMTransitionEvent::GetElapsedTime(float *aElapsedTime) -{ - *aElapsedTime = TransitionEvent()->elapsedTime; - return NS_OK; -} - -NS_IMETHODIMP -nsDOMTransitionEvent::InitTransitionEvent(const nsAString & typeArg, - PRBool canBubbleArg, - PRBool cancelableArg, - const nsAString & propertyNameArg, - float elapsedTimeArg) -{ - nsresult rv = nsDOMEvent::InitEvent(typeArg, canBubbleArg, cancelableArg); - NS_ENSURE_SUCCESS(rv, rv); - - TransitionEvent()->propertyName = propertyNameArg; - TransitionEvent()->elapsedTime = elapsedTimeArg; - - return NS_OK; -} - -nsresult -NS_NewDOMTransitionEvent(nsIDOMEvent **aInstancePtrResult, - nsPresContext *aPresContext, - nsTransitionEvent *aEvent) -{ - nsDOMTransitionEvent *it = new nsDOMTransitionEvent(aPresContext, aEvent); - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - return CallQueryInterface(it, aInstancePtrResult); -} diff --git a/content/events/src/nsDOMTransitionEvent.h b/content/events/src/nsDOMTransitionEvent.h deleted file mode 100644 index 0c7006b9e4be..000000000000 --- a/content/events/src/nsDOMTransitionEvent.h +++ /dev/null @@ -1,66 +0,0 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is nsDOMTransitionEvent. - * - * The Initial Developer of the Original Code is the Mozilla Foundation. - * Portions created by the Initial Developer are Copyright (C) 2009 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * L. David Baron , Mozilla Corporation (original author) - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#ifndef nsDOMTransitionEvent_h_ -#define nsDOMTransitionEvent_h_ - -#include "nsDOMEvent.h" -#include "nsIDOMTransitionEvent.h" -#include "nsString.h" - -class nsTransitionEvent; - -class nsDOMTransitionEvent : public nsDOMEvent, - public nsIDOMTransitionEvent -{ -public: - nsDOMTransitionEvent(nsPresContext *aPresContext, - nsTransitionEvent *aEvent); - ~nsDOMTransitionEvent(); - - NS_DECL_ISUPPORTS_INHERITED - NS_FORWARD_TO_NSDOMEVENT - NS_DECL_NSIDOMTRANSITIONEVENT - -private: - nsTransitionEvent* TransitionEvent() { - NS_ABORT_IF_FALSE(mEvent->eventStructType == NS_TRANSITION_EVENT, - "unexpected struct type"); - return static_cast(mEvent); - } -}; - -#endif /* !defined(nsDOMTransitionEvent_h_) */ diff --git a/content/events/src/nsEventDispatcher.cpp b/content/events/src/nsEventDispatcher.cpp index c3edf42700dc..2d9f32bb0bec 100644 --- a/content/events/src/nsEventDispatcher.cpp +++ b/content/events/src/nsEventDispatcher.cpp @@ -721,9 +721,6 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext, case NS_SIMPLE_GESTURE_EVENT: return NS_NewDOMSimpleGestureEvent(aDOMEvent, aPresContext, static_cast(aEvent)); - case NS_TRANSITION_EVENT: - return NS_NewDOMTransitionEvent(aDOMEvent, aPresContext, - static_cast(aEvent)); } // For all other types of events, create a vanilla event object. @@ -792,10 +789,6 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext, return NS_NewDOMPageTransitionEvent(aDOMEvent, aPresContext, nsnull); if (aEventType.LowerCaseEqualsLiteral("scrollareaevent")) return NS_NewDOMScrollAreaEvent(aDOMEvent, aPresContext, nsnull); - // FIXME: Should get spec to say what the right string is here! This - // is probably wrong! - if (aEventType.LowerCaseEqualsLiteral("transitionevent")) - return NS_NewDOMTransitionEvent(aDOMEvent, aPresContext, nsnull); return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index dd8ff6dd7d1b..c6181fca7541 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -234,7 +234,6 @@ #include "nsPaintRequest.h" #include "nsIDOMNotifyPaintEvent.h" #include "nsIDOMScrollAreaEvent.h" -#include "nsIDOMTransitionEvent.h" #include "nsIDOMNSDocumentStyle.h" #include "nsIDOMDocumentRange.h" #include "nsIDOMDocumentTraversal.h" @@ -1367,8 +1366,6 @@ static nsDOMClassInfoData sClassInfoData[] = { DOM_DEFAULT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(EventListenerInfo, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) - NS_DEFINE_CLASSINFO_DATA(TransitionEvent, nsDOMGenericSH, - DOM_DEFAULT_SCRIPTABLE_FLAGS) }; // Objects that shuld be constructable through |new Name();| @@ -3790,11 +3787,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIEventListenerInfo) DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN(TransitionEvent, nsIDOMTransitionEvent) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMTransitionEvent) - DOM_CLASSINFO_EVENT_MAP_ENTRIES - DOM_CLASSINFO_MAP_END - #ifdef NS_DEBUG { PRUint32 i = NS_ARRAY_LENGTH(sClassInfoData); diff --git a/dom/base/nsDOMClassInfoID.h b/dom/base/nsDOMClassInfoID.h index 1051a2e8d703..7fc9ed644e03 100644 --- a/dom/base/nsDOMClassInfoID.h +++ b/dom/base/nsDOMClassInfoID.h @@ -489,8 +489,6 @@ enum nsDOMClassInfoID { eDOMClassInfo_EventListenerInfo_id, - eDOMClassInfo_TransitionEvent_id, - // This one better be the last one in this list eDOMClassInfoIDCount }; diff --git a/dom/interfaces/events/Makefile.in b/dom/interfaces/events/Makefile.in index f7498ab1a73e..f311987adb5c 100644 --- a/dom/interfaces/events/Makefile.in +++ b/dom/interfaces/events/Makefile.in @@ -82,7 +82,6 @@ XPIDLSRCS = \ nsIDOMNSMouseEvent.idl \ nsIDOMOrientationEvent.idl \ nsIDOMScrollAreaEvent.idl \ - nsIDOMTransitionEvent.idl \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/dom/interfaces/events/nsIDOMTransitionEvent.idl b/dom/interfaces/events/nsIDOMTransitionEvent.idl deleted file mode 100644 index ffbdfcbc5830..000000000000 --- a/dom/interfaces/events/nsIDOMTransitionEvent.idl +++ /dev/null @@ -1,55 +0,0 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is nsIDOMTransitionEvent. - * - * The Initial Developer of the Original Code is the Mozilla Foundation. - * Portions created by the Initial Developer are Copyright (C) 2009 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * L. David Baron , Mozilla Corporation (original author) - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsIDOMEvent.idl" - -/** - * Transition events are defined in: - * http://www.w3.org/TR/css3-transitions/#transition-events- - * http://dev.w3.org/csswg/css3-transitions/#transition-events- - */ - -[scriptable, uuid(3e49ea4c-6f23-4aff-bd8f-e587edf514ec)] -interface nsIDOMTransitionEvent : nsIDOMEvent { - readonly attribute DOMString propertyName; - readonly attribute float elapsedTime; - void initTransitionEvent(in DOMString typeArg, - in boolean canBubbleArg, - in boolean cancelableArg, - in DOMString propertyNameArg, - in float elapsedTimeArg); -}; diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index adbcb8d40df0..1393f85847cd 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -259,15 +259,7 @@ nsPresContext::~nsPresContext() NS_PRECONDITION(!mShell, "Presshell forgot to clear our mShell pointer"); SetShell(nsnull); - if (mTransitionManager) { - mTransitionManager->Disconnect(); - } - - // Disconnect the refresh driver *after* the transition manager, which - // needs it. - if (mRefreshDriver) { - mRefreshDriver->Disconnect(); - } + delete mTransitionManager; if (mEventManager) { // unclear if these are needed, but can't hurt @@ -881,12 +873,6 @@ nsPresContext::Init(nsIDeviceContext* aDeviceContext) NS_ADDREF(mEventManager); mTransitionManager = new nsTransitionManager(this); - if (!mTransitionManager) - return NS_ERROR_OUT_OF_MEMORY; - - mRefreshDriver = new nsRefreshDriver(this); - if (!mRefreshDriver) - return NS_ERROR_OUT_OF_MEMORY; mLangService = do_GetService(NS_LANGUAGEATOMSERVICE_CONTRACTID); diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 564fca5c5f55..1c4b03702195 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -72,6 +72,7 @@ #include "nsContentUtils.h" #include "nsIWidget.h" #include "mozilla/TimeStamp.h" +#include "nsRefreshDriver.h" class nsImageLoader; #ifdef IBMBIDI @@ -102,7 +103,6 @@ class nsUserFontSet; struct nsFontFaceRuleContainer; class nsObjectFrame; class nsTransitionManager; -class nsRefreshDriver; class imgIContainer; #ifdef MOZ_REFLOW_PERF @@ -233,7 +233,13 @@ public: nsTransitionManager* TransitionManager() { return mTransitionManager; } - nsRefreshDriver* RefreshDriver() { return mRefreshDriver; } + nsRefreshDriver* RefreshDriver() { return &mRefreshDriver; } + + static nsPresContext* FromRefreshDriver(nsRefreshDriver* aRefreshDriver) { + return reinterpret_cast( + reinterpret_cast(aRefreshDriver) - + offsetof(nsPresContext, mRefreshDriver)); + } #endif /** @@ -951,8 +957,8 @@ protected: // from gfx back to layout. nsIEventStateManager* mEventManager; // [STRONG] nsILookAndFeel* mLookAndFeel; // [STRONG] - nsRefPtr mRefreshDriver; - nsRefPtr mTransitionManager; + nsRefreshDriver mRefreshDriver; + nsTransitionManager* mTransitionManager; // owns; it aggregates our refcount nsIAtom* mMedium; // initialized by subclass ctors; // weak pointer to static atom diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index 80bb2e033593..e6c36da572dd 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -44,7 +44,6 @@ #include "nsPresContext.h" #include "nsComponentManagerUtils.h" #include "prlog.h" -#include "nsAutoPtr.h" /* * TODO: @@ -57,8 +56,7 @@ using mozilla::TimeStamp; -nsRefreshDriver::nsRefreshDriver(nsPresContext *aPresContext) - : mPresContext(aPresContext) +nsRefreshDriver::nsRefreshDriver() { } @@ -172,7 +170,11 @@ nsRefreshDriver::ArrayFor(mozFlushType aFlushType) * nsISupports implementation */ -NS_IMPL_ISUPPORTS1(nsRefreshDriver, nsITimerCallback) +NS_IMPL_ADDREF_USING_AGGREGATOR(nsRefreshDriver, + nsPresContext::FromRefreshDriver(this)) +NS_IMPL_RELEASE_USING_AGGREGATOR(nsRefreshDriver, + nsPresContext::FromRefreshDriver(this)) +NS_IMPL_QUERY_INTERFACE1(nsRefreshDriver, nsITimerCallback) /* * nsITimerCallback implementation @@ -183,34 +185,18 @@ nsRefreshDriver::Notify(nsITimer *aTimer) { UpdateMostRecentRefresh(); - if (!mPresContext) { - // Things are being destroyed. - NS_ABORT_IF_FALSE(!mTimer, "timer should have been stopped"); - return NS_OK; - } - nsCOMPtr presShell = mPresContext->GetPresShell(); + nsPresContext *presContext = nsPresContext::FromRefreshDriver(this); + nsCOMPtr presShell = presContext->GetPresShell(); if (!presShell) { // Things are being destroyed. StopTimer(); return NS_OK; } - /* - * The timer holds a reference to |this| while calling |Notify|. - * However, implementations of |WillRefresh| are permitted to destroy - * the pres context, which will cause our |mPresContext| to become - * null. If this happens, we must stop notifying observers. - */ for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(mObservers); ++i) { ObserverArray::EndLimitedIterator etor(mObservers[i]); while (etor.HasMore()) { - nsRefPtr obs = etor.GetNext(); - obs->WillRefresh(mMostRecentRefresh); - - if (!mPresContext || !mPresContext->GetPresShell()) { - StopTimer(); - return NS_OK; - } + etor.GetNext()->WillRefresh(mMostRecentRefresh); } if (i == 0) { // This is the Flush_Style case. diff --git a/layout/base/nsRefreshDriver.h b/layout/base/nsRefreshDriver.h index a65cd44cba08..d767b99cb85d 100644 --- a/layout/base/nsRefreshDriver.h +++ b/layout/base/nsRefreshDriver.h @@ -49,8 +49,6 @@ #include "nsCOMPtr.h" #include "nsTObserverArray.h" -class nsPresContext; - /** * An abstract base class to be implemented by callers wanting to be * notified at refresh times. When nothing needs to be painted, callers @@ -58,29 +56,19 @@ class nsPresContext; */ class nsARefreshObserver { public: - // AddRef and Release signatures that match nsISupports. Implementors - // must implement reference counting, and those that do implement - // nsISupports will already have methods with the correct signature. - // - // The refresh driver does NOT hold references to refresh observers - // except while it is notifying them. - NS_IMETHOD_(nsrefcnt) AddRef(void) = 0; - NS_IMETHOD_(nsrefcnt) Release(void) = 0; - virtual void WillRefresh(mozilla::TimeStamp aTime) = 0; }; -class nsRefreshDriver : public nsITimerCallback { +/* + * nsRefreshDriver MUST ONLY be constructed as a sub-object of + * nsPresContext (since its reference counting methods forward to the + * pres context of which it is an mRefreshDriver) + */ +class nsRefreshDriver : private nsITimerCallback { public: - nsRefreshDriver(nsPresContext *aPresContext); + nsRefreshDriver(); ~nsRefreshDriver(); - // nsISupports implementation - NS_DECL_ISUPPORTS - - // nsITimerCallback implementation - NS_DECL_NSITIMERCALLBACK - /** * Return the time of the most recent refresh. This is intended to be * used by callers who want to start an animation now and want to know @@ -102,26 +90,18 @@ public: * painting, and, correspondingly, which get notified when there * is a flush during such suppression * and it must be either Flush_Style, Flush_Layout, or Flush_Display. - * - * The refresh driver does NOT own a reference to these observers; - * they must remove themselves before they are destroyed. */ PRBool AddRefreshObserver(nsARefreshObserver *aObserver, mozFlushType aFlushType); PRBool RemoveRefreshObserver(nsARefreshObserver *aObserver, mozFlushType aFlushType); - - /** - * Tell the refresh driver that it is done driving refreshes and - * should stop its timer and forget about its pres context. This may - * be called from within a refresh. - */ - void Disconnect() { - StopTimer(); - mPresContext = nsnull; - } - private: + // nsISupports implementation + NS_DECL_ISUPPORTS_INHERITED + + // nsITimerCallback implementation + NS_IMETHOD Notify(nsITimer *aTimer); + typedef nsTObserverArray ObserverArray; void EnsureTimerStarted(); @@ -133,9 +113,6 @@ private: nsCOMPtr mTimer; mozilla::TimeStamp mMostRecentRefresh; // only valid when mTimer non-null - nsPresContext *mPresContext; // weak; pres context passed in constructor - // and unset in Disconnect - // separate arrays for each flush type we support ObserverArray mObservers[3]; }; diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index a9b2372fbb73..e6f7ab55ffdf 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -717,8 +717,7 @@ CSS_PROP_BORDER( border_left_color_value, X, CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED | - CSS_PROPERTY_REPORT_OTHER_NAME, + CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED, Margin, mBorderColor.mLeft, eCSSType_Value, @@ -774,8 +773,7 @@ CSS_PROP_BORDER( border-left-style-value, border_left_style_value, X, - CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_REPORT_OTHER_NAME, + CSS_PROPERTY_APPLIES_TO_FIRST_LETTER, Margin, mBorderStyle.mLeft, eCSSType_Value, @@ -817,8 +815,7 @@ CSS_PROP_BORDER( border-left-width-value, border_left_width_value, X, - CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_REPORT_OTHER_NAME, + CSS_PROPERTY_APPLIES_TO_FIRST_LETTER, Margin, mBorderWidth.mLeft, eCSSType_Value, @@ -866,8 +863,7 @@ CSS_PROP_BORDER( border_right_color_value, X, CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED | - CSS_PROPERTY_REPORT_OTHER_NAME, + CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED, Margin, mBorderColor.mRight, eCSSType_Value, @@ -923,8 +919,7 @@ CSS_PROP_BORDER( border-right-style-value, border_right_style_value, X, - CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_REPORT_OTHER_NAME, + CSS_PROPERTY_APPLIES_TO_FIRST_LETTER, Margin, mBorderStyle.mRight, eCSSType_Value, @@ -966,8 +961,7 @@ CSS_PROP_BORDER( border-right-width-value, border_right_width_value, X, - CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_REPORT_OTHER_NAME, + CSS_PROPERTY_APPLIES_TO_FIRST_LETTER, Margin, mBorderWidth.mRight, eCSSType_Value, @@ -1657,8 +1651,7 @@ CSS_PROP_MARGIN( margin-left-value, margin_left_value, X, - CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_REPORT_OTHER_NAME, + CSS_PROPERTY_APPLIES_TO_FIRST_LETTER, Margin, mMargin.mLeft, eCSSType_Value, @@ -1700,8 +1693,7 @@ CSS_PROP_MARGIN( margin-right-value, margin_right_value, X, - CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_REPORT_OTHER_NAME, + CSS_PROPERTY_APPLIES_TO_FIRST_LETTER, Margin, mMargin.mRight, eCSSType_Value, @@ -1966,8 +1958,7 @@ CSS_PROP_PADDING( padding-left-value, padding_left_value, X, - CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_REPORT_OTHER_NAME, + CSS_PROPERTY_APPLIES_TO_FIRST_LETTER, Margin, mPadding.mLeft, eCSSType_Value, @@ -2009,8 +2000,7 @@ CSS_PROP_PADDING( padding-right-value, padding_right_value, X, - CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_REPORT_OTHER_NAME, + CSS_PROPERTY_APPLIES_TO_FIRST_LETTER, Margin, mPadding.mRight, eCSSType_Value, diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index ac6ac7b36a32..b313883994fb 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -370,35 +370,6 @@ nsCSSProps::GetStringValue(nsCSSFontDesc aFontDescID) } } -nsCSSProperty -nsCSSProps::OtherNameFor(nsCSSProperty aProperty) -{ - switch (aProperty) { - case eCSSProperty_border_left_color_value: - return eCSSProperty_border_left_color; - case eCSSProperty_border_left_style_value: - return eCSSProperty_border_left_style; - case eCSSProperty_border_left_width_value: - return eCSSProperty_border_left_width; - case eCSSProperty_border_right_color_value: - return eCSSProperty_border_right_color; - case eCSSProperty_border_right_style_value: - return eCSSProperty_border_right_style; - case eCSSProperty_border_right_width_value: - return eCSSProperty_border_right_width; - case eCSSProperty_margin_left_value: - return eCSSProperty_margin_left; - case eCSSProperty_margin_right_value: - return eCSSProperty_margin_right; - case eCSSProperty_padding_left_value: - return eCSSProperty_padding_left; - case eCSSProperty_padding_right_value: - return eCSSProperty_padding_right; - default: - NS_ABORT_IF_FALSE(PR_FALSE, "bad caller"); - } - return eCSSProperty_UNKNOWN; -} /***************************************************************************/ diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index 2681824b6eaa..bcbb0d95c361 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -79,13 +79,6 @@ // list. #define CSS_PROPERTY_IMAGE_IS_IN_ARRAY_0 (1<<6) -// This is a property for which the computed value should generally be -// reported as the computed value of a property of a different name. In -// particular, the directional box properties (margin-left-value, etc.) -// should be reported as being margin-left, etc. Call -// nsCSSProps::OtherNameFor to get the other property. -#define CSS_PROPERTY_REPORT_OTHER_NAME (1<<7) - /** * Types of animatable values. */ @@ -159,11 +152,6 @@ public: static const nsAFlatCString& GetStringValue(nsCSSProperty aProperty); static const nsAFlatCString& GetStringValue(nsCSSFontDesc aFontDesc); - // Get the property to report the computed value of aProperty as being - // the computed value of. aProperty must have the - // CSS_PROPERTY_REPORT_OTHER_NAME bit set. - static nsCSSProperty OtherNameFor(nsCSSProperty aProperty); - // Given a CSS Property and a Property Enum Value // Return back a const nsString& representation of the // value. Return back nullstr if no value is found diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index 741dbb0d2059..51a38edd648c 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -52,8 +52,6 @@ #include "nsCSSPropertySet.h" #include "nsStyleAnimation.h" #include "nsCSSDataBlock.h" -#include "nsEventDispatcher.h" -#include "nsGUIEvent.h" using mozilla::TimeStamp; using mozilla::TimeDuration; @@ -335,12 +333,6 @@ nsTransitionManager::nsTransitionManager(nsPresContext *aPresContext) } nsTransitionManager::~nsTransitionManager() -{ - NS_ABORT_IF_FALSE(!mPresContext, "Disconnect should have been called"); -} - -void -nsTransitionManager::Disconnect() { // Content nodes might outlive the transition manager. while (!PR_CLIST_IS_EMPTY(&mElementTransitions)) { @@ -348,8 +340,6 @@ nsTransitionManager::Disconnect() PR_LIST_HEAD(&mElementTransitions)); head->Destroy(); } - - mPresContext = nsnull; } static PRBool @@ -791,7 +781,9 @@ nsTransitionManager::AddElementTransitions(ElementTransitions* aElementTransitio * nsISupports implementation */ -NS_IMPL_ISUPPORTS1(nsTransitionManager, nsIStyleRuleProcessor) +NS_IMPL_ADDREF_USING_AGGREGATOR(nsTransitionManager, mPresContext) +NS_IMPL_RELEASE_USING_AGGREGATOR(nsTransitionManager, mPresContext) +NS_IMPL_QUERY_INTERFACE1(nsTransitionManager, nsIStyleRuleProcessor) /* * nsIStyleRuleProcessor implementation @@ -890,38 +882,9 @@ nsTransitionManager::MediumFeaturesChanged(nsPresContext* aPresContext, return NS_OK; } -struct TransitionEventInfo { - nsCOMPtr mElement; - nsTransitionEvent mEvent; - - TransitionEventInfo(nsIContent *aElement, nsCSSProperty aProperty, - TimeDuration aDuration) - : mElement(aElement), - mEvent(PR_TRUE, NS_TRANSITION_END, - NS_ConvertUTF8toUTF16(nsCSSProps::GetStringValue(aProperty)), - aDuration.ToSeconds()) - { - } - - // nsTransitionEvent doesn't support copy-construction, so we need - // to ourselves in order to work with nsTArray - TransitionEventInfo(const TransitionEventInfo &aOther) - : mElement(aOther.mElement), - mEvent(PR_TRUE, NS_TRANSITION_END, - aOther.mEvent.propertyName, aOther.mEvent.elapsedTime) - { - } -}; - /* virtual */ void nsTransitionManager::WillRefresh(mozilla::TimeStamp aTime) { - NS_ABORT_IF_FALSE(mPresContext, - "refresh driver should not notify additional observers " - "after pres context has been destroyed"); - - nsTArray events; - // Trim transitions that have completed, and post restyle events for // frames that are still transitioning. { @@ -942,13 +905,6 @@ nsTransitionManager::WillRefresh(mozilla::TimeStamp aTime) ElementPropertyTransition &pt = et->mPropertyTransitions[i]; if (pt.mStartTime + pt.mDuration <= aTime) { // This transition has completed. - nsCSSProperty prop = pt.mProperty; - if (nsCSSProps::PropHasFlags(prop, CSS_PROPERTY_REPORT_OTHER_NAME)) { - prop = nsCSSProps::OtherNameFor(prop); - } - events.AppendElement( - TransitionEventInfo(et->mElement, prop, pt.mDuration)); - et->mPropertyTransitions.RemoveElementAt(i); } } while (i != 0); @@ -967,15 +923,6 @@ nsTransitionManager::WillRefresh(mozilla::TimeStamp aTime) // We might have removed transitions above. TransitionsRemoved(); - - for (PRUint32 i = 0, i_end = events.Length(); i < i_end; ++i) { - TransitionEventInfo &info = events[i]; - nsEventDispatcher::Dispatch(info.mElement, mPresContext, &info.mEvent); - - if (!mPresContext) { - break; - } - } } void diff --git a/layout/style/nsTransitionManager.h b/layout/style/nsTransitionManager.h index f9761c381522..c91bb81efc60 100644 --- a/layout/style/nsTransitionManager.h +++ b/layout/style/nsTransitionManager.h @@ -52,17 +52,16 @@ class nsCSSPropertySet; struct nsTransition; struct ElementTransitions; +/** + * Must be created only as a sub-object of an nsPresContext (since its + * reference counting methods assume that). + */ class nsTransitionManager : public nsIStyleRuleProcessor, public nsARefreshObserver { public: nsTransitionManager(nsPresContext *aPresContext); ~nsTransitionManager(); - /** - * Notify the transition manager that the pres context is going away. - */ - void Disconnect(); - /** * StyleContextChanged * @@ -83,7 +82,7 @@ public: nsStyleContext *aNewStyleContext); // nsISupports - NS_DECL_ISUPPORTS + NS_DECL_ISUPPORTS_INHERITED // nsIStyleRuleProcessor NS_IMETHOD RulesMatching(ElementRuleProcessorData* aData); @@ -121,7 +120,7 @@ private: nsCSSPseudoElements::Type aPseudoType); PRCList mElementTransitions; - nsPresContext *mPresContext; // weak (non-null from ctor to Disconnect) + nsPresContext *mPresContext; }; #endif /* !defined(nsTransitionManager_h_) */ diff --git a/layout/style/test/Makefile.in b/layout/style/test/Makefile.in index fcad0b9cfc5e..6734f9acae1d 100644 --- a/layout/style/test/Makefile.in +++ b/layout/style/test/Makefile.in @@ -138,7 +138,6 @@ _TEST_FILES = test_acid3_test46.html \ test_system_font_serialization.html \ test_transitions_computed_values.html \ test_transitions_computed_value_combinations.html \ - test_transitions_events.html \ test_transitions.html \ test_transitions_per_property.html \ test_transitions_dynamic_changes.html \ diff --git a/layout/style/test/test_transitions_events.html b/layout/style/test/test_transitions_events.html deleted file mode 100644 index fc306f5ad891..000000000000 --- a/layout/style/test/test_transitions_events.html +++ /dev/null @@ -1,239 +0,0 @@ - - - - - Test for Bug 531585 (transitionend event) - - - - - - -Mozilla Bug 531585 -

- - - - - - - - -

-
-
-
- - diff --git a/widget/public/nsGUIEvent.h b/widget/public/nsGUIEvent.h index 62392f3d15ce..db73ebe72a7a 100644 --- a/widget/public/nsGUIEvent.h +++ b/widget/public/nsGUIEvent.h @@ -91,7 +91,7 @@ class nsHashKey; #define NS_POPUP_EVENT 23 #define NS_COMMAND_EVENT 24 #define NS_SCROLLAREA_EVENT 25 -#define NS_TRANSITION_EVENT 26 + #define NS_UI_EVENT 27 #ifdef MOZ_SVG @@ -448,8 +448,6 @@ class nsHashKey; #define NS_SCROLLAREA_EVENT_START 4100 #define NS_SCROLLEDAREACHANGED (NS_SCROLLAREA_EVENT_START) -#define NS_TRANSITION_EVENT_START 4200 -#define NS_TRANSITION_END (NS_TRANSITION_EVENT_START) /** * Return status for event processors, nsEventStatus, is defined in @@ -1331,21 +1329,6 @@ public: PRFloat64 delta; // Delta for magnify and rotate events }; -class nsTransitionEvent : public nsEvent -{ -public: - nsTransitionEvent(PRBool isTrusted, PRUint32 msg, - const nsString &propertyNameArg, float elapsedTimeArg) - : nsEvent(isTrusted, msg, NS_TRANSITION_EVENT), - propertyName(propertyNameArg), elapsedTime(elapsedTimeArg) - { - } - - nsString propertyName; - float elapsedTime; -}; - - /** * Event status for D&D Event */