mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Back out all the pieces of bug 531585 (transitioned event for end of CSS transitions) because of timeouts in test_transitions_events.html
This commit is contained in:
parent
bb1ff4abd3
commit
df57e102fe
@ -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<nsISupportsHashKey, EventNameMapping>;
|
||||
|
@ -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")
|
||||
|
@ -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__
|
||||
|
@ -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.
|
||||
|
@ -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<nsTransitionEvent*>(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;
|
||||
}
|
||||
|
@ -171,8 +171,7 @@ public:
|
||||
eDOMEvents_MozRotateGesture,
|
||||
eDOMEvents_MozTapGesture,
|
||||
eDOMEvents_MozPressTapGesture,
|
||||
eDOMEvents_MozScrolledAreaChanged,
|
||||
eDOMEvents_transitionend
|
||||
eDOMEvents_MozScrolledAreaChanged
|
||||
};
|
||||
|
||||
nsDOMEvent(nsPresContext* aPresContext, nsEvent* aEvent);
|
||||
|
@ -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 <dbaron@dbaron.org>, 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);
|
||||
}
|
@ -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 <dbaron@dbaron.org>, 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<nsTransitionEvent*>(mEvent);
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* !defined(nsDOMTransitionEvent_h_) */
|
@ -721,9 +721,6 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext,
|
||||
case NS_SIMPLE_GESTURE_EVENT:
|
||||
return NS_NewDOMSimpleGestureEvent(aDOMEvent, aPresContext,
|
||||
static_cast<nsSimpleGestureEvent*>(aEvent));
|
||||
case NS_TRANSITION_EVENT:
|
||||
return NS_NewDOMTransitionEvent(aDOMEvent, aPresContext,
|
||||
static_cast<nsTransitionEvent*>(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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -489,8 +489,6 @@ enum nsDOMClassInfoID {
|
||||
|
||||
eDOMClassInfo_EventListenerInfo_id,
|
||||
|
||||
eDOMClassInfo_TransitionEvent_id,
|
||||
|
||||
// This one better be the last one in this list
|
||||
eDOMClassInfoIDCount
|
||||
};
|
||||
|
@ -82,7 +82,6 @@ XPIDLSRCS = \
|
||||
nsIDOMNSMouseEvent.idl \
|
||||
nsIDOMOrientationEvent.idl \
|
||||
nsIDOMScrollAreaEvent.idl \
|
||||
nsIDOMTransitionEvent.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -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 <dbaron@dbaron.org>, 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);
|
||||
};
|
@ -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);
|
||||
|
||||
|
@ -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<nsPresContext*>(
|
||||
reinterpret_cast<char*>(aRefreshDriver) -
|
||||
offsetof(nsPresContext, mRefreshDriver));
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -951,8 +957,8 @@ protected:
|
||||
// from gfx back to layout.
|
||||
nsIEventStateManager* mEventManager; // [STRONG]
|
||||
nsILookAndFeel* mLookAndFeel; // [STRONG]
|
||||
nsRefPtr<nsRefreshDriver> mRefreshDriver;
|
||||
nsRefPtr<nsTransitionManager> mTransitionManager;
|
||||
nsRefreshDriver mRefreshDriver;
|
||||
nsTransitionManager* mTransitionManager; // owns; it aggregates our refcount
|
||||
nsIAtom* mMedium; // initialized by subclass ctors;
|
||||
// weak pointer to static atom
|
||||
|
||||
|
@ -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<nsIPresShell> presShell = mPresContext->GetPresShell();
|
||||
nsPresContext *presContext = nsPresContext::FromRefreshDriver(this);
|
||||
nsCOMPtr<nsIPresShell> 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<nsARefreshObserver> 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.
|
||||
|
@ -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<nsARefreshObserver*> ObserverArray;
|
||||
|
||||
void EnsureTimerStarted();
|
||||
@ -133,9 +113,6 @@ private:
|
||||
nsCOMPtr<nsITimer> 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];
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
|
@ -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
|
||||
|
@ -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<nsIContent> 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<TransitionEventInfo> 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
|
||||
|
@ -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_) */
|
||||
|
@ -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 \
|
||||
|
@ -1,239 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=531585
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 531585 (transitionend event)</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<style type="text/css">
|
||||
|
||||
.bar { margin: 10px; }
|
||||
|
||||
#one { -moz-transition-duration: 500ms; -moz-transition-property: all; }
|
||||
#two { -moz-transition: margin-left 1s; }
|
||||
#three { -moz-transition: margin 0.5s 0.25s; }
|
||||
|
||||
#four, #five, #six {
|
||||
-moz-transition: 500ms color;
|
||||
border-color: black; /* don't derive from color */
|
||||
}
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=531585">Mozilla Bug 531585</a>
|
||||
<p id="display">
|
||||
|
||||
<span id="one" style="color:blue"></span>
|
||||
<span id="two"></span>
|
||||
<span id="three"></span>
|
||||
<span id="four" style="color: blue"></span>
|
||||
<span id="five" style="color: blue"></span>
|
||||
<span id="six" style="color: blue"></span>
|
||||
|
||||
</p>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 531585 (transitionend event) **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var gTestCount = 0;
|
||||
function started_test() { ++gTestCount; }
|
||||
function finished_test() { if (--gTestCount == 0) { SimpleTest.finish(); } }
|
||||
|
||||
function $(id) { return document.getElementById(id); }
|
||||
function cs(id) { return getComputedStyle($(id), ""); }
|
||||
|
||||
var got_one_root = false;
|
||||
var got_one_target = false;
|
||||
var got_one_target_bordertop = false;
|
||||
var got_one_target_borderright = false;
|
||||
var got_one_target_borderbottom = false;
|
||||
var got_one_target_borderleft = false;
|
||||
var got_two_target = false;
|
||||
var got_three_top = false;
|
||||
var got_three_right = false;
|
||||
var got_three_bottom = false;
|
||||
var got_three_left = false;
|
||||
var got_four_root = false;
|
||||
var got_body = false;
|
||||
|
||||
document.documentElement.addEventListener("transitionend",
|
||||
function(event) {
|
||||
if (event.target == $("one")) {
|
||||
ok(!got_one_root, "transitionend on one on root");
|
||||
is(event.propertyName, "border-right-color",
|
||||
"propertyName for transitionend on one");
|
||||
is(event.elapsedTime, 0.5,
|
||||
"elapsedTime for transitionend on one");
|
||||
is(cs("one").borderRightColor, "rgb(0, 255, 0)",
|
||||
"computed style for transitionend on one");
|
||||
got_one_root = true;
|
||||
finished_test();
|
||||
} else if (event.target == $("four")) {
|
||||
ok(!got_four_root, "transitionend on four on root");
|
||||
is(event.propertyName, "color",
|
||||
"propertyName for transitionend on four");
|
||||
// Reported time should (really?) be shortened by reversing.
|
||||
ok(event.elapsedTime < 0.5,
|
||||
"elapsedTime for transitionend on four");
|
||||
is(cs("four").color, "rgb(0, 0, 255)",
|
||||
"computed style for transitionend on four (end of reverse transition)");
|
||||
got_four_root = true;
|
||||
finished_test();
|
||||
} else if (event.target == document.body) {
|
||||
// A synthesized event.
|
||||
ok(!got_body, "transitionend on body on root");
|
||||
is(event.propertyName, "some-unknown-prop",
|
||||
"propertyName for transitionend on body");
|
||||
// Reported time should (really?) be shortened by reversing.
|
||||
is(event.elapsedTime, -4.75,
|
||||
"elapsedTime for transitionend on body");
|
||||
got_body = true;
|
||||
finished_test();
|
||||
} else {
|
||||
ok(false, "unexpected event");
|
||||
}
|
||||
}, false);
|
||||
|
||||
$("one").addEventListener("transitionend",
|
||||
function(event) {
|
||||
switch (event.propertyName) {
|
||||
case "color":
|
||||
ok(!got_one_target, "transitionend on one on target");
|
||||
got_one_target = true;
|
||||
event.stopPropagation();
|
||||
break;
|
||||
case "border-top-color":
|
||||
ok(!got_one_target_bordertop, "transitionend on one on target");
|
||||
got_one_target_bordertop = true;
|
||||
event.stopPropagation();
|
||||
break;
|
||||
case "border-right-color":
|
||||
ok(!got_one_target_borderright, "transitionend on one on target");
|
||||
got_one_target_borderright = true;
|
||||
// Let this event through to body
|
||||
break;
|
||||
case "border-bottom-color":
|
||||
ok(!got_one_target_borderbottom, "transitionend on one on target");
|
||||
got_one_target_borderbottom = true;
|
||||
event.stopPropagation();
|
||||
break;
|
||||
case "border-left-color":
|
||||
ok(!got_one_target_borderleft, "transitionend on one on target");
|
||||
got_one_target_borderleft = true;
|
||||
event.stopPropagation();
|
||||
break;
|
||||
default:
|
||||
ok(false, "unexpected property name " + event.propertyName +
|
||||
" for transitionend on one on target");
|
||||
}
|
||||
is(event.elapsedTime, 0.5,
|
||||
"elapsedTime for transitionend on one");
|
||||
is(cs("one").getPropertyValue(event.propertyName), "rgb(0, 255, 0)",
|
||||
"computed style of " + event.propertyName + " for transitionend on one");
|
||||
got_one_target = true;
|
||||
finished_test();
|
||||
}, false);
|
||||
|
||||
started_test();
|
||||
started_test();
|
||||
started_test();
|
||||
started_test();
|
||||
started_test();
|
||||
started_test();
|
||||
$("one").style.color = "lime";
|
||||
|
||||
|
||||
$("two").addEventListener("transitionend",
|
||||
function(event) {
|
||||
event.stopPropagation();
|
||||
|
||||
ok(!got_two_target, "transitionend on two on target");
|
||||
is(event.propertyName, "margin-left",
|
||||
"propertyName for transitionend on two");
|
||||
is(event.elapsedTime, 1,
|
||||
"elapsedTime for transitionend on two");
|
||||
is(cs("two").marginLeft, "10px",
|
||||
"computed style for transitionend on two");
|
||||
got_two_target = true;
|
||||
finished_test();
|
||||
}, false);
|
||||
|
||||
started_test();
|
||||
$("two").className = "bar";
|
||||
|
||||
$("three").addEventListener("transitionend",
|
||||
function(event) {
|
||||
event.stopPropagation();
|
||||
|
||||
switch (event.propertyName) {
|
||||
case "margin-top":
|
||||
ok(!got_three_top, "should only get margin-top once");
|
||||
got_three_top = true;
|
||||
break;
|
||||
case "margin-right":
|
||||
ok(!got_three_right, "should only get margin-right once");
|
||||
got_three_right = true;
|
||||
break;
|
||||
case "margin-bottom":
|
||||
ok(!got_three_bottom, "should only get margin-bottom once");
|
||||
got_three_bottom = true;
|
||||
break;
|
||||
case "margin-left":
|
||||
ok(!got_three_left, "should only get margin-left once");
|
||||
got_three_left = true;
|
||||
break;
|
||||
default:
|
||||
ok(false, "unexpected property name " + event.propertyName +
|
||||
" for transitionend on three");
|
||||
}
|
||||
is(event.elapsedTime, 0.5,
|
||||
"elapsedTime for transitionend on three");
|
||||
is(cs("three").getPropertyValue(event.propertyName), "10px",
|
||||
"computed style for transitionend on three");
|
||||
finished_test();
|
||||
}, true);
|
||||
|
||||
started_test();
|
||||
started_test();
|
||||
started_test();
|
||||
started_test();
|
||||
$("three").className = "bar";
|
||||
|
||||
// We reverse the transition on four, and we should only get an event
|
||||
// at the end of the second transition.
|
||||
started_test();
|
||||
$("four").style.color = "lime";
|
||||
|
||||
// We cancel the transition on five by changing 'transition-property',
|
||||
// and should thus get no event.
|
||||
$("five").style.color = "lime";
|
||||
|
||||
// We cancel the transition on six by changing 'transition-duration' and
|
||||
// then changing the value, so we should get no event.
|
||||
$("six").style.color = "lime";
|
||||
|
||||
setTimeout(function() {
|
||||
$("four").style.color = "blue";
|
||||
$("five").style.MozTransitionProperty = "margin-left";
|
||||
$("six").style.MozTransitionDuration = "0s";
|
||||
$("six").style.MozTransitionDelay = "0s";
|
||||
$("six").style.color = "blue";
|
||||
}, 100);
|
||||
|
||||
// And make our own event to dispatch to the body.
|
||||
started_test();
|
||||
var ev = document.createEvent("TransitionEvent"); // FIXME: un-specified
|
||||
ev.initTransitionEvent("transitionend", true, true,
|
||||
"some-unknown-prop", -4.75);
|
||||
document.body.dispatchEvent(ev);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user