LCOV - code coverage report
Current view: top level - dom/events - CommandEvent.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 27 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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/. */
       6             : 
       7             : #include "mozilla/dom/CommandEvent.h"
       8             : #include "mozilla/MiscEvents.h"
       9             : #include "prtime.h"
      10             : 
      11             : namespace mozilla {
      12             : namespace dom {
      13             : 
      14           0 : CommandEvent::CommandEvent(EventTarget* aOwner,
      15             :                            nsPresContext* aPresContext,
      16           0 :                            WidgetCommandEvent* aEvent)
      17             :   : Event(aOwner, aPresContext,
      18             :           aEvent ? aEvent :
      19           0 :                    new WidgetCommandEvent(false, nullptr, nullptr, nullptr))
      20             : {
      21           0 :   mEvent->mTime = PR_Now();
      22           0 :   if (aEvent) {
      23           0 :     mEventIsInternal = false;
      24             :   } else {
      25           0 :     mEventIsInternal = true;
      26             :   }
      27           0 : }
      28             : 
      29           0 : NS_INTERFACE_MAP_BEGIN(CommandEvent)
      30           0 :   NS_INTERFACE_MAP_ENTRY(nsIDOMCommandEvent)
      31           0 : NS_INTERFACE_MAP_END_INHERITING(Event)
      32             : 
      33           0 : NS_IMPL_ADDREF_INHERITED(CommandEvent, Event)
      34           0 : NS_IMPL_RELEASE_INHERITED(CommandEvent, Event)
      35             : 
      36             : NS_IMETHODIMP
      37           0 : CommandEvent::GetCommand(nsAString& aCommand)
      38             : {
      39           0 :   nsIAtom* command = mEvent->AsCommandEvent()->mCommand;
      40           0 :   if (command) {
      41           0 :     command->ToString(aCommand);
      42             :   } else {
      43           0 :     aCommand.Truncate();
      44             :   }
      45           0 :   return NS_OK;
      46             : }
      47             : 
      48             : NS_IMETHODIMP
      49           0 : CommandEvent::InitCommandEvent(const nsAString& aTypeArg,
      50             :                                bool aCanBubbleArg,
      51             :                                bool aCancelableArg,
      52             :                                const nsAString& aCommand)
      53             : {
      54           0 :   NS_ENSURE_TRUE(!mEvent->mFlags.mIsBeingDispatched, NS_OK);
      55             : 
      56           0 :   Event::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
      57             : 
      58           0 :   mEvent->AsCommandEvent()->mCommand = NS_Atomize(aCommand);
      59           0 :   return NS_OK;
      60             : }
      61             : 
      62             : } // namespace dom
      63             : } // namespace mozilla
      64             : 
      65             : using namespace mozilla;
      66             : using namespace mozilla::dom;
      67             : 
      68             : already_AddRefed<CommandEvent>
      69           0 : NS_NewDOMCommandEvent(EventTarget* aOwner,
      70             :                       nsPresContext* aPresContext,
      71             :                       WidgetCommandEvent* aEvent)
      72             : {
      73             :   RefPtr<CommandEvent> it =
      74           0 :     new CommandEvent(aOwner, aPresContext, aEvent);
      75           0 :   return it.forget();
      76             : }

Generated by: LCOV version 1.13