2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-12-23 22:10:31 +03:00
|
|
|
|
2014-02-28 18:58:42 +04:00
|
|
|
#include "mozilla/dom/TransitionEvent.h"
|
2013-09-25 15:21:20 +04:00
|
|
|
#include "mozilla/ContentEvents.h"
|
2014-02-28 18:58:42 +04:00
|
|
|
#include "prtime.h"
|
2009-12-23 22:10:31 +03:00
|
|
|
|
2020-11-04 20:04:01 +03:00
|
|
|
namespace mozilla::dom {
|
2013-09-27 10:20:55 +04:00
|
|
|
|
2014-02-28 18:58:42 +04:00
|
|
|
TransitionEvent::TransitionEvent(EventTarget* aOwner,
|
|
|
|
nsPresContext* aPresContext,
|
|
|
|
InternalTransitionEvent* aEvent)
|
2014-03-05 04:37:43 +04:00
|
|
|
: Event(aOwner, aPresContext,
|
2015-08-29 02:58:26 +03:00
|
|
|
aEvent ? aEvent : new InternalTransitionEvent(false, eVoidEvent)) {
|
2009-12-23 22:10:31 +03:00
|
|
|
if (aEvent) {
|
2011-10-17 18:59:28 +04:00
|
|
|
mEventIsInternal = false;
|
2009-12-23 22:10:31 +03:00
|
|
|
} else {
|
2011-10-17 18:59:28 +04:00
|
|
|
mEventIsInternal = true;
|
2009-12-23 22:10:31 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-28 18:58:42 +04:00
|
|
|
// static
|
|
|
|
already_AddRefed<TransitionEvent> TransitionEvent::Constructor(
|
|
|
|
const GlobalObject& aGlobal, const nsAString& aType,
|
2019-09-11 17:35:28 +03:00
|
|
|
const TransitionEventInit& aParam) {
|
2014-02-28 18:58:42 +04:00
|
|
|
nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<TransitionEvent> e = new TransitionEvent(t, nullptr, nullptr);
|
2013-05-04 18:41:20 +04:00
|
|
|
bool trusted = e->Init(t);
|
2013-05-09 00:45:35 +04:00
|
|
|
|
2015-11-13 03:09:42 +03:00
|
|
|
e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
|
2013-05-09 00:45:35 +04:00
|
|
|
|
2013-10-18 10:10:22 +04:00
|
|
|
InternalTransitionEvent* internalEvent = e->mEvent->AsTransitionEvent();
|
2016-03-26 10:26:35 +03:00
|
|
|
internalEvent->mPropertyName = aParam.mPropertyName;
|
|
|
|
internalEvent->mElapsedTime = aParam.mElapsedTime;
|
|
|
|
internalEvent->mPseudoElement = aParam.mPseudoElement;
|
2013-05-09 00:45:35 +04:00
|
|
|
|
2013-05-04 18:41:20 +04:00
|
|
|
e->SetTrusted(trusted);
|
2016-08-31 06:16:11 +03:00
|
|
|
e->SetComposed(aParam.mComposed);
|
2013-05-04 18:41:20 +04:00
|
|
|
return e.forget();
|
|
|
|
}
|
|
|
|
|
2018-02-09 19:17:10 +03:00
|
|
|
void TransitionEvent::GetPropertyName(nsAString& aPropertyName) const {
|
2016-03-26 10:26:35 +03:00
|
|
|
aPropertyName = mEvent->AsTransitionEvent()->mPropertyName;
|
2009-12-23 22:10:31 +03:00
|
|
|
}
|
|
|
|
|
2014-02-28 18:58:42 +04:00
|
|
|
float TransitionEvent::ElapsedTime() {
|
2016-03-26 10:26:35 +03:00
|
|
|
return mEvent->AsTransitionEvent()->mElapsedTime;
|
2013-10-18 10:10:22 +04:00
|
|
|
}
|
|
|
|
|
2018-02-09 19:17:10 +03:00
|
|
|
void TransitionEvent::GetPseudoElement(nsAString& aPseudoElement) const {
|
2016-03-26 10:26:35 +03:00
|
|
|
aPseudoElement = mEvent->AsTransitionEvent()->mPseudoElement;
|
2013-05-04 18:41:20 +04:00
|
|
|
}
|
|
|
|
|
2020-11-04 20:04:01 +03:00
|
|
|
} // namespace mozilla::dom
|
2014-02-28 18:58:42 +04:00
|
|
|
|
|
|
|
using namespace mozilla;
|
|
|
|
using namespace mozilla::dom;
|
|
|
|
|
2015-08-12 14:39:31 +03:00
|
|
|
already_AddRefed<TransitionEvent> NS_NewDOMTransitionEvent(
|
2014-02-28 18:58:42 +04:00
|
|
|
EventTarget* aOwner, nsPresContext* aPresContext,
|
2013-09-27 10:20:55 +04:00
|
|
|
InternalTransitionEvent* aEvent) {
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<TransitionEvent> it =
|
2015-08-12 14:39:31 +03:00
|
|
|
new TransitionEvent(aOwner, aPresContext, aEvent);
|
|
|
|
return it.forget();
|
2009-12-23 22:10:31 +03:00
|
|
|
}
|