Bug 1688354 [wpt PR 27298] - Treat 'rem' as an absolute unit for font size, a=testonly
[gecko.git] / dom / smil / TimeEvent.cpp
blob104dc0d050d6df2face671004e0dcb1be128246e
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "mozilla/ContentEvents.h"
8 #include "mozilla/dom/TimeEvent.h"
9 #include "nsIDocShell.h"
10 #include "nsIInterfaceRequestorUtils.h"
11 #include "nsPresContext.h"
12 #include "nsGlobalWindow.h"
14 namespace mozilla {
15 namespace dom {
17 TimeEvent::TimeEvent(EventTarget* aOwner, nsPresContext* aPresContext,
18 InternalSMILTimeEvent* aEvent)
19 : Event(aOwner, aPresContext,
20 aEvent ? aEvent : new InternalSMILTimeEvent(false, eVoidEvent)),
21 mDetail(mEvent->AsSMILTimeEvent()->mDetail) {
22 if (aEvent) {
23 mEventIsInternal = false;
24 } else {
25 mEventIsInternal = true;
28 if (mPresContext) {
29 nsCOMPtr<nsIDocShell> docShell = mPresContext->GetDocShell();
30 if (docShell) {
31 mView = docShell->GetWindow();
36 NS_IMPL_CYCLE_COLLECTION_INHERITED(TimeEvent, Event, mView)
38 NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(TimeEvent, Event)
40 void TimeEvent::InitTimeEvent(const nsAString& aType,
41 nsGlobalWindowInner* aView, int32_t aDetail) {
42 NS_ENSURE_TRUE_VOID(!mEvent->mFlags.mIsBeingDispatched);
44 Event::InitEvent(aType, false /*doesn't bubble*/, false /*can't cancel*/);
45 mDetail = aDetail;
46 mView = aView ? aView->GetOuterWindow() : nullptr;
49 } // namespace dom
50 } // namespace mozilla
52 using namespace mozilla;
53 using namespace mozilla::dom;
55 already_AddRefed<TimeEvent> NS_NewDOMTimeEvent(EventTarget* aOwner,
56 nsPresContext* aPresContext,
57 InternalSMILTimeEvent* aEvent) {
58 RefPtr<TimeEvent> it = new TimeEvent(aOwner, aPresContext, aEvent);
59 return it.forget();