dom/events/MouseEvent.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef mozilla_dom_MouseEvent_h_
michael@0 7 #define mozilla_dom_MouseEvent_h_
michael@0 8
michael@0 9 #include "mozilla/dom/UIEvent.h"
michael@0 10 #include "mozilla/dom/MouseEventBinding.h"
michael@0 11 #include "mozilla/EventForwards.h"
michael@0 12 #include "nsIDOMMouseEvent.h"
michael@0 13
michael@0 14 namespace mozilla {
michael@0 15 namespace dom {
michael@0 16
michael@0 17 class MouseEvent : public UIEvent,
michael@0 18 public nsIDOMMouseEvent
michael@0 19 {
michael@0 20 public:
michael@0 21 MouseEvent(EventTarget* aOwner,
michael@0 22 nsPresContext* aPresContext,
michael@0 23 WidgetMouseEventBase* aEvent);
michael@0 24
michael@0 25 NS_DECL_ISUPPORTS_INHERITED
michael@0 26
michael@0 27 // nsIDOMMouseEvent Interface
michael@0 28 NS_DECL_NSIDOMMOUSEEVENT
michael@0 29
michael@0 30 // Forward to base class
michael@0 31 NS_FORWARD_TO_UIEVENT
michael@0 32
michael@0 33 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE
michael@0 34 {
michael@0 35 return MouseEventBinding::Wrap(aCx, this);
michael@0 36 }
michael@0 37
michael@0 38 // Web IDL binding methods
michael@0 39 virtual uint32_t Which() MOZ_OVERRIDE
michael@0 40 {
michael@0 41 return Button() + 1;
michael@0 42 }
michael@0 43
michael@0 44 int32_t ScreenX();
michael@0 45 int32_t ScreenY();
michael@0 46 int32_t ClientX();
michael@0 47 int32_t ClientY();
michael@0 48 bool CtrlKey();
michael@0 49 bool ShiftKey();
michael@0 50 bool AltKey();
michael@0 51 bool MetaKey();
michael@0 52 int16_t Button();
michael@0 53 uint16_t Buttons();
michael@0 54 already_AddRefed<EventTarget> GetRelatedTarget();
michael@0 55 void InitMouseEvent(const nsAString& aType, bool aCanBubble, bool aCancelable,
michael@0 56 nsIDOMWindow* aView, int32_t aDetail, int32_t aScreenX,
michael@0 57 int32_t aScreenY, int32_t aClientX, int32_t aClientY,
michael@0 58 bool aCtrlKey, bool aAltKey, bool aShiftKey,
michael@0 59 bool aMetaKey, uint16_t aButton,
michael@0 60 EventTarget* aRelatedTarget, ErrorResult& aRv)
michael@0 61 {
michael@0 62 aRv = InitMouseEvent(aType, aCanBubble, aCancelable,
michael@0 63 aView, aDetail, aScreenX, aScreenY,
michael@0 64 aClientX, aClientY, aCtrlKey, aAltKey,
michael@0 65 aShiftKey, aMetaKey, aButton,
michael@0 66 aRelatedTarget);
michael@0 67 }
michael@0 68 bool GetModifierState(const nsAString& aKeyArg)
michael@0 69 {
michael@0 70 return GetModifierStateInternal(aKeyArg);
michael@0 71 }
michael@0 72 static already_AddRefed<MouseEvent> Constructor(const GlobalObject& aGlobal,
michael@0 73 const nsAString& aType,
michael@0 74 const MouseEventInit& aParam,
michael@0 75 ErrorResult& aRv);
michael@0 76 int32_t MozMovementX()
michael@0 77 {
michael@0 78 return GetMovementPoint().x;
michael@0 79 }
michael@0 80 int32_t MozMovementY()
michael@0 81 {
michael@0 82 return GetMovementPoint().y;
michael@0 83 }
michael@0 84 float MozPressure() const;
michael@0 85 uint16_t MozInputSource() const;
michael@0 86 void InitNSMouseEvent(const nsAString& aType,
michael@0 87 bool aCanBubble, bool aCancelable,
michael@0 88 nsIDOMWindow* aView, int32_t aDetail, int32_t aScreenX,
michael@0 89 int32_t aScreenY, int32_t aClientX, int32_t aClientY,
michael@0 90 bool aCtrlKey, bool aAltKey, bool aShiftKey,
michael@0 91 bool aMetaKey, uint16_t aButton,
michael@0 92 EventTarget* aRelatedTarget,
michael@0 93 float aPressure, uint16_t aInputSource,
michael@0 94 ErrorResult& aRv)
michael@0 95 {
michael@0 96 aRv = InitNSMouseEvent(aType, aCanBubble, aCancelable,
michael@0 97 aView, aDetail, aScreenX, aScreenY,
michael@0 98 aClientX, aClientY, aCtrlKey, aAltKey,
michael@0 99 aShiftKey, aMetaKey, aButton,
michael@0 100 aRelatedTarget, aPressure, aInputSource);
michael@0 101 }
michael@0 102
michael@0 103 protected:
michael@0 104 nsresult InitMouseEvent(const nsAString& aType,
michael@0 105 bool aCanBubble,
michael@0 106 bool aCancelable,
michael@0 107 nsIDOMWindow* aView,
michael@0 108 int32_t aDetail,
michael@0 109 int32_t aScreenX,
michael@0 110 int32_t aScreenY,
michael@0 111 int32_t aClientX,
michael@0 112 int32_t aClientY,
michael@0 113 int16_t aButton,
michael@0 114 nsIDOMEventTarget* aRelatedTarget,
michael@0 115 const nsAString& aModifiersList);
michael@0 116 };
michael@0 117
michael@0 118 } // namespace dom
michael@0 119 } // namespace mozilla
michael@0 120
michael@0 121 #define NS_FORWARD_TO_MOUSEEVENT \
michael@0 122 NS_FORWARD_NSIDOMMOUSEEVENT(MouseEvent::) \
michael@0 123 NS_FORWARD_TO_UIEVENT
michael@0 124
michael@0 125 #endif // mozilla_dom_MouseEvent_h_

mercurial