1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
6 * You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #ifndef mozilla_WidgetUtils_h
9 #define mozilla_WidgetUtils_h
11 #include "mozilla/EventForwards.h"
12 #include "mozilla/gfx/Matrix.h"
14 #include "nsIDOMWindow.h"
15 #include "nsIWidget.h"
16 #include "nsPIDOMWindow.h"
21 // NB: these must match up with pseudo-enum in nsIScreen.idl.
31 gfx::Matrix
ComputeTransformForRotation(const nsIntRect
& aBounds
,
32 ScreenRotation aRotation
);
34 gfx::Matrix
ComputeTransformForUnRotation(const nsIntRect
& aBounds
,
35 ScreenRotation aRotation
);
37 nsIntRect
RotateRect(nsIntRect aRect
,
38 const nsIntRect
& aBounds
,
39 ScreenRotation aRotation
);
48 * Starting at the docshell item for the passed in DOM window this looks up
49 * the docshell tree until it finds a docshell item that has a widget.
51 static already_AddRefed
<nsIWidget
> DOMWindowToWidget(nsIDOMWindow
*aDOMWindow
);
54 * Compute our keyCode value (NS_VK_*) from an ASCII character.
56 static uint32_t ComputeKeyCodeFromChar(uint32_t aCharCode
);
59 * Get unshifted charCode and shifted charCode for aKeyCode if the keyboad
60 * layout is a Latin keyboard layout.
62 * @param aKeyCode Our keyCode (NS_VK_*).
63 * @param aIsCapsLock TRUE if CapsLock is Locked. Otherwise, FALSE.
64 * This is used only when aKeyCode is NS_VK_[0-9].
65 * @param aUnshiftedCharCode CharCode for aKeyCode without Shift key.
66 * This may be zero if aKeyCode key doesn't input
68 * Note that must not be nullptr.
69 * @param aShiftedCharCode CharCode for aKeyCOde with Shift key.
70 * This is always 0 when aKeyCode isn't
72 * Note that must not be nullptr.
74 static void GetLatinCharCodeForKeyCode(uint32_t aKeyCode
,
76 uint32_t* aUnshiftedCharCode
,
77 uint32_t* aShiftedCharCode
);
81 } // namespace mozilla
83 #endif // mozilla_WidgetUtils_h