LCOV - code coverage report
Current view: top level - dom/events - UIEvent.h (source / functions) Hit Total Coverage
Test: output.info Lines: 7 17 41.2 %
Date: 2017-07-14 16:53:18 Functions: 8 38 21.1 %
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             : #ifndef mozilla_dom_UIEvent_h_
       8             : #define mozilla_dom_UIEvent_h_
       9             : 
      10             : #include "mozilla/Attributes.h"
      11             : #include "mozilla/dom/Event.h"
      12             : #include "mozilla/dom/UIEventBinding.h"
      13             : #include "nsDeviceContext.h"
      14             : #include "nsIDOMUIEvent.h"
      15             : #include "nsLayoutUtils.h"
      16             : #include "nsPresContext.h"
      17             : 
      18             : class nsINode;
      19             : 
      20             : namespace mozilla {
      21             : namespace dom {
      22             : 
      23             : class UIEvent : public Event,
      24             :                 public nsIDOMUIEvent
      25             : {
      26             : public:
      27             :   UIEvent(EventTarget* aOwner,
      28             :           nsPresContext* aPresContext,
      29             :           WidgetGUIEvent* aEvent);
      30             : 
      31             :   NS_DECL_ISUPPORTS_INHERITED
      32         148 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(UIEvent, Event)
      33             : 
      34             :   // nsIDOMUIEvent Interface
      35             :   NS_DECL_NSIDOMUIEVENT
      36             : 
      37             :   // Forward to Event
      38          44 :   NS_FORWARD_TO_EVENT_NO_SERIALIZATION_NO_DUPLICATION
      39             :   NS_IMETHOD DuplicatePrivateData() override;
      40             :   NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) override;
      41             :   NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) override;
      42             : 
      43             : 
      44             :   static already_AddRefed<UIEvent> Constructor(const GlobalObject& aGlobal,
      45             :                                                const nsAString& aType,
      46             :                                                const UIEventInit& aParam,
      47             :                                                ErrorResult& aRv);
      48             : 
      49           8 :   virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
      50             :   {
      51           8 :     return UIEventBinding::Wrap(aCx, this, aGivenProto);
      52             :   }
      53             : 
      54             :   void InitUIEvent(const nsAString& typeArg,
      55             :                    bool canBubbleArg,
      56             :                    bool cancelableArg,
      57             :                    nsGlobalWindow* viewArg,
      58             :                    int32_t detailArg);
      59             : 
      60           0 :   nsPIDOMWindowOuter* GetView() const
      61             :   {
      62           0 :     return mView;
      63             :   }
      64             : 
      65           7 :   int32_t Detail() const
      66             :   {
      67           7 :     return mDetail;
      68             :   }
      69             : 
      70           0 :   int32_t LayerX() const
      71             :   {
      72           0 :     return GetLayerPoint().x;
      73             :   }
      74             : 
      75           0 :   int32_t LayerY() const
      76             :   {
      77           0 :     return GetLayerPoint().y;
      78             :   }
      79             : 
      80             :   int32_t PageX() const;
      81             :   int32_t PageY() const;
      82             : 
      83           0 :   virtual uint32_t Which()
      84             :   {
      85           0 :     MOZ_ASSERT(mEvent->mClass != eKeyboardEventClass,
      86             :                "Key events should override Which()");
      87           0 :     MOZ_ASSERT(mEvent->mClass != eMouseEventClass,
      88             :                "Mouse events should override Which()");
      89           0 :     return 0;
      90             :   }
      91             : 
      92             :   already_AddRefed<nsINode> GetRangeParent();
      93             : 
      94             :   int32_t RangeOffset() const;
      95             : 
      96             : protected:
      97           2 :   ~UIEvent() {}
      98             : 
      99             :   // Internal helper functions
     100             :   nsIntPoint GetMovementPoint();
     101             :   nsIntPoint GetLayerPoint() const;
     102             : 
     103             :   nsCOMPtr<nsPIDOMWindowOuter> mView;
     104             :   int32_t mDetail;
     105             :   CSSIntPoint mClientPoint;
     106             :   // Screenpoint is mEvent->mRefPoint.
     107             :   nsIntPoint mLayerPoint;
     108             :   CSSIntPoint mPagePoint;
     109             :   nsIntPoint mMovementPoint;
     110             :   bool mIsPointerLocked;
     111             :   CSSIntPoint mLastClientPoint;
     112             : 
     113             :   static Modifiers ComputeModifierState(const nsAString& aModifiersList);
     114             :   bool GetModifierStateInternal(const nsAString& aKey);
     115             :   void InitModifiers(const EventModifierInit& aParam);
     116             : };
     117             : 
     118             : } // namespace dom
     119             : } // namespace mozilla
     120             : 
     121             : #define NS_FORWARD_TO_UIEVENT                               \
     122             :   NS_FORWARD_NSIDOMUIEVENT(UIEvent::)                       \
     123             :   NS_FORWARD_TO_EVENT_NO_SERIALIZATION_NO_DUPLICATION       \
     124             :   NS_IMETHOD DuplicatePrivateData() override                \
     125             :   {                                                         \
     126             :     return UIEvent::DuplicatePrivateData();                 \
     127             :   }                                                         \
     128             :   NS_IMETHOD_(void) Serialize(IPC::Message* aMsg,           \
     129             :                               bool aSerializeInterfaceType) \
     130             :     override                                                \
     131             :   {                                                         \
     132             :     UIEvent::Serialize(aMsg, aSerializeInterfaceType);      \
     133             :   }                                                         \
     134             :   NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg,   \
     135             :                                 PickleIterator* aIter) override \
     136             :   {                                                         \
     137             :     return UIEvent::Deserialize(aMsg, aIter);               \
     138             :   }
     139             : 
     140             : already_AddRefed<mozilla::dom::UIEvent>
     141             : NS_NewDOMUIEvent(mozilla::dom::EventTarget* aOwner,
     142             :                  nsPresContext* aPresContext,
     143             :                  mozilla::WidgetGUIEvent* aEvent);
     144             : 
     145             : #endif // mozilla_dom_UIEvent_h_

Generated by: LCOV version 1.13