Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / widget / shared / WidgetUtils.h
blob9d8cfd8f174c5f880f712329b42b28b31fac56db
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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 #ifndef __mozilla_widget_WidgetUtils_h__
8 #define __mozilla_widget_WidgetUtils_h__
10 #include "nsCOMPtr.h"
11 #include "nsIWidget.h"
12 #include "nsPIDOMWindow.h"
13 #include "nsIDOMWindow.h"
14 #include "mozilla/EventForwards.h"
16 namespace mozilla {
17 namespace widget {
19 class WidgetUtils
21 public:
23 /**
24 * Starting at the docshell item for the passed in DOM window this looks up
25 * the docshell tree until it finds a docshell item that has a widget.
27 static already_AddRefed<nsIWidget> DOMWindowToWidget(nsIDOMWindow *aDOMWindow);
29 /**
30 * Compute our keyCode value (NS_VK_*) from an ASCII character.
32 static uint32_t ComputeKeyCodeFromChar(uint32_t aCharCode);
34 /**
35 * Get unshifted charCode and shifted charCode for aKeyCode if the keyboad
36 * layout is a Latin keyboard layout.
38 * @param aKeyCode Our keyCode (NS_VK_*).
39 * @param aIsCapsLock TRUE if CapsLock is Locked. Otherwise, FALSE.
40 * This is used only when aKeyCode is NS_VK_[0-9].
41 * @param aUnshiftedCharCode CharCode for aKeyCode without Shift key.
42 * This may be zero if aKeyCode key doesn't input
43 * a Latin character.
44 * Note that must not be nullptr.
45 * @param aShiftedCharCode CharCode for aKeyCOde with Shift key.
46 * This is always 0 when aKeyCode isn't
47 * NS_VK_[A-Z].
48 * Note that must not be nullptr.
50 static void GetLatinCharCodeForKeyCode(uint32_t aKeyCode,
51 bool aIsCapsLock,
52 uint32_t* aUnshiftedCharCode,
53 uint32_t* aShiftedCharCode);
55 /**
56 * GetDeadKeyNameIndex() returns a key name index for dead key or
57 * "Unidentified". This method can return the index from non-combining
58 * unicode character, e.g., '`' returns KEY_NAME_INDEX_DeadGrave.
59 * So, you cannot use this method for checking if the char is a dead char.
61 static KeyNameIndex GetDeadKeyNameIndex(char16_t aChar);
64 } // namespace widget
65 } // namespace mozilla
67 #endif