dom/events/KeyboardEvent.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_KeyboardEvent_h_
michael@0 7 #define mozilla_dom_KeyboardEvent_h_
michael@0 8
michael@0 9 #include "mozilla/dom/UIEvent.h"
michael@0 10 #include "mozilla/dom/KeyboardEventBinding.h"
michael@0 11 #include "mozilla/EventForwards.h"
michael@0 12 #include "nsIDOMKeyEvent.h"
michael@0 13
michael@0 14 namespace mozilla {
michael@0 15 namespace dom {
michael@0 16
michael@0 17 class KeyboardEvent : public UIEvent,
michael@0 18 public nsIDOMKeyEvent
michael@0 19 {
michael@0 20 public:
michael@0 21 KeyboardEvent(EventTarget* aOwner,
michael@0 22 nsPresContext* aPresContext,
michael@0 23 WidgetKeyboardEvent* aEvent);
michael@0 24
michael@0 25 NS_DECL_ISUPPORTS_INHERITED
michael@0 26
michael@0 27 // nsIDOMKeyEvent Interface
michael@0 28 NS_DECL_NSIDOMKEYEVENT
michael@0 29
michael@0 30 // Forward to base class
michael@0 31 NS_FORWARD_TO_UIEVENT
michael@0 32
michael@0 33 static already_AddRefed<KeyboardEvent> Constructor(
michael@0 34 const GlobalObject& aGlobal,
michael@0 35 const nsAString& aType,
michael@0 36 const KeyboardEventInit& aParam,
michael@0 37 ErrorResult& aRv);
michael@0 38
michael@0 39 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE
michael@0 40 {
michael@0 41 return KeyboardEventBinding::Wrap(aCx, this);
michael@0 42 }
michael@0 43
michael@0 44 bool AltKey();
michael@0 45 bool CtrlKey();
michael@0 46 bool ShiftKey();
michael@0 47 bool MetaKey();
michael@0 48
michael@0 49 bool GetModifierState(const nsAString& aKey)
michael@0 50 {
michael@0 51 return GetModifierStateInternal(aKey);
michael@0 52 }
michael@0 53
michael@0 54 bool Repeat();
michael@0 55 bool IsComposing();
michael@0 56 uint32_t CharCode();
michael@0 57 uint32_t KeyCode();
michael@0 58 virtual uint32_t Which() MOZ_OVERRIDE;
michael@0 59 uint32_t Location();
michael@0 60
michael@0 61 void InitKeyEvent(const nsAString& aType, bool aCanBubble, bool aCancelable,
michael@0 62 nsIDOMWindow* aView, bool aCtrlKey, bool aAltKey,
michael@0 63 bool aShiftKey, bool aMetaKey,
michael@0 64 uint32_t aKeyCode, uint32_t aCharCode,
michael@0 65 ErrorResult& aRv)
michael@0 66 {
michael@0 67 aRv = InitKeyEvent(aType, aCanBubble, aCancelable, aView,
michael@0 68 aCtrlKey, aAltKey, aShiftKey,aMetaKey,
michael@0 69 aKeyCode, aCharCode);
michael@0 70 }
michael@0 71
michael@0 72 private:
michael@0 73 // True, if the instance is created with Constructor().
michael@0 74 bool mInitializedByCtor;
michael@0 75 // If the instance is created with Constructor(), which may have independent
michael@0 76 // value. mInitializedWhichValue stores it. I.e., this is invalid when
michael@0 77 // mInitializedByCtor is false.
michael@0 78 uint32_t mInitialzedWhichValue;
michael@0 79 };
michael@0 80
michael@0 81 } // namespace dom
michael@0 82 } // namespace mozilla
michael@0 83
michael@0 84 #endif // mozilla_dom_KeyboardEvent_h_

mercurial