Files
palemoon27/widget/TextEventDispatcher.cpp
T
roytam1 b91a6a24cc import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1001637 - Make math tables implement the nsIAccessibleTable interface. r=surkov (ebbb4325d6)
- Bug 1149118 - Expose radio group with the correct role on OS X, r=surkov (4d4a95735c)
- Bug 1113153 - use 'paragraph' role for paragraphs only, introduce 'text' role for small text containers, r=marcoz (14c4fa5881)
- Bug 1175164 - Do not expose MathML semantics element in the accessibility tree. r=surkov (3945ae0367)
- Bug 930843 part.1 Add test for checking isTrust attribute value of DOMActivate event r=smaug (14a49dd447)
- Bug 930843 part.2 NS_UI_ACTIVATE event should be trusted event even if it's caused by an untrusted event r=smaug (e0af6165b5)
- Bug 1156315 - Call DispatchInputEvent in more places on OS X. r=dvander (e24f42c09f)
- Bug 1186015 part.1 Rename nsIMEContext to mozilla::widget::IMEContext r=jimm (077bf6e772)
- Bug 1186015 part.2 Rename nsIMM32Handler to mozilla::widget::IMMHandler r=jimm+m_kato (a2098e33b5)
- Bug 1184533 Rewrite range check in aOffset of nsIMM32Handler::GetCharacterRectOfSelectedTextAt() r=emk (fb68bc3c56)
- Bug 555642 part.1 nsCaret should have a way to override the caret visible state for hiding caret temporarily and nsEditor should hide caret if composition string doesn't have caret information r=roc (9de4aa366c)
- Bug 1171847 Remove unnecessary ',' in logging code in nsTextStore::Initialize() r=m_kato (78d0d43625)
- Bug 1181714 nsTextStore should store previous focused document manager until new document manager actually gets focus r=m_kato (fd7e820af2)
- Bug 1176950 nsTextStore should keep storing locked content until NOTIFY_IME_OF_COMPOSITION_UPDATE is notified r=emk (0a12349575)
- Bug 1137539 part.1 Implement TSFStaticSink::IsGoogleJapaneseInputActive() r=emk (68d1f9a0ec)
- Bug 1137539 part.2 Implement TSFStaticSink::IsATOKActive() r=emk (51a4208bfa)
- Bug 1137539 part.3 Implement TSFStaticSink::IsFreeChangJieActive() r=emk (affbb81b96)
- Bug 1137539 part.4 Implement TSFStaticSink::IsEasyChangjeiActive() r=emk (abd3e674b6)
- Bug 1186014 Rename nsTextStore to mozilla::widget::TSFTextStore r=jimm+m_kato (ca63351f94)
- Bug 1187351 TSFTextStore should forget modified range at notifying TSF of layout change since GetTextExt() shouldn't return TS_E_NOLAYOUT after that r=emk (48878793e0)
-  Bg 1187367 TSFTextStore shouldn't destroy native caret for ATOK until notifying TSF of layout change r=emk (a2a4022d15)
- Bug 1187566 TSFTextStore::Content should compute mMinTextModified Offset only with the latest composition string and original composition string, and also the hack should be enabled on Win10 r=emk (1368885efe)
- Bug 1050644 part.1 Add methods to check whether the active TIP is Chinese TIP which deosn't show candidate window in e10s mode r=emk (1b783e682e)
- Bug 1050644 part.2 Hack ITextStoreACP::GetTextExt()'s offset for some Chinese TIPs of MS r=emk (c05cec10ce)
- Bug 1187579 Enable TSF in e10s mode r=m_kato (1ae106231a)
- Bug 555642 part.2 IME handlers on Windows shouldn't append caret range if the caret is in the target clause which doesn't have specific style r=m_kato (88bae2c8da)
- Bug 1196124 Fix mismatch of printf style string and following arguments of MOZ_LOG() in IMMHandler::GetCharacterRectOfSelectedTextAt() r=m_kato (0f6debd0d3)
- Bug 90712 Cancel composition when Enter key message isn't consumed by IME r=m_kato (0febdb1fd9)
- pointer style (6c984274cd)
- Bug 1177268 - implement aria-rowcount/index and aria-colcount/index, r=marcoz (92ac300374)
- Bug 1153135 - Return possibility PEN working while APZC is enabled. r=jimm (8bc77ff84f)
- Bug 1171073 - Suppress content scrolling issue on 64-bit platforms. r=kats (62db0dead3)
- Bug 1121946, Implement e10 cursor drag feedback on Windows, r=jmathies (6e8218d202)
- Bug 1144650 - Don't dispatch touch-based mouse events when APZ is handling touch. r=jimm (53ebea0d90)
- Bug 1163056 - InkCollector activation at first PEN event. r=jimm (b28e0ee58b)
- Bug 895274 part.3 Make the enum of event messages a named enum IGNORE IDL r=smaug (32e04a4e90)
- spacing (b9249221dc)
- Bug 1182966 - Part 3: Add some final annotations to DomainSet. r=mrbkap (3455822e89)
- Bug 1050122 - Part 1: Enable Nuwa on debug builds, and kill it if the preference is false. r=khuey (46685a7bf3)
- Bug 1146229: Remove calling convention modifier from local variable. r=surkov (e5f4b6e5d5)
- bug 1168932 - Implement ProxyCreated and ProxyDestroyed to update mozAccessibles r=tbsaunde (77a007fa21)
- Bug 1169701 - Fire native OS X accessibility events for proxied accessibles r=tbsaunde (c4847135a8)
- bug 1172523 - fire useful text change events for proxies r=lsock (85b7f995b8)
- remove spurious file (229c787360)
- bug 1171117 - Fix cairo to build on iOS. r=jrmuizel (45709c8fe3)
- Bug 963738 - Annotate XPCNativeMember, r=terrence (d1afdde52b)
- Bug 1148383 - Add testcase for previously fixed object metadata issue r=terrence (2c1b762cba)
- Bug 1149797 - Update browser jstests to treat ecma_6/extensions tests as 1.8, so that let is interpreted as a statement and not as an expression. r=bustage in a CLOSED TREE (ac6127d6bc)
- Bug 1150858 - Unwrap the correct object in ArrayBuffer.transfer (r=sfink) (cf67906802)
- Bug 1150380 - IonMonkey: MIPS: Fix JitRuntime::generateProfilerExitFrameTailStub. r=rankov (eeac49ddce)
- use RootedValue for POW as in 1135708 (34c1c3d191)
- Bug 1196648: IonMonkey - Don't run the lazy link stub for asmjs to jit fastpath, r=nbp (686d495371)
- Bug 1121947, Implement e10 cursor drag feedback on Mac, r=smaug (f48df2d1)
- and sync widget/TextEvents.h and TextRange.h with AF.
2022-01-19 09:57:42 +08:00

555 lines
17 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Preferences.h"
#include "mozilla/TextEvents.h"
#include "mozilla/TextEventDispatcher.h"
#include "nsIDocShell.h"
#include "nsIFrame.h"
#include "nsIPresShell.h"
#include "nsIWidget.h"
#include "nsPIDOMWindow.h"
#include "nsView.h"
namespace mozilla {
namespace widget {
/******************************************************************************
* TextEventDispatcher
*****************************************************************************/
bool TextEventDispatcher::sDispatchKeyEventsDuringComposition = false;
TextEventDispatcher::TextEventDispatcher(nsIWidget* aWidget)
: mWidget(aWidget)
, mDispatchingEvent(0)
, mForTests(false)
, mIsComposing(false)
{
MOZ_RELEASE_ASSERT(mWidget, "aWidget must not be nullptr");
static bool sInitialized = false;
if (!sInitialized) {
Preferences::AddBoolVarCache(
&sDispatchKeyEventsDuringComposition,
"dom.keyboardevent.dispatch_during_composition",
false);
sInitialized = true;
}
}
nsresult
TextEventDispatcher::BeginInputTransaction(
TextEventDispatcherListener* aListener)
{
return BeginInputTransactionInternal(aListener, false);
}
nsresult
TextEventDispatcher::BeginInputTransactionForTests(
TextEventDispatcherListener* aListener)
{
return BeginInputTransactionInternal(aListener, true);
}
nsresult
TextEventDispatcher::BeginInputTransactionInternal(
TextEventDispatcherListener* aListener,
bool aForTests)
{
if (NS_WARN_IF(!aListener)) {
return NS_ERROR_INVALID_ARG;
}
nsCOMPtr<TextEventDispatcherListener> listener = do_QueryReferent(mListener);
if (listener) {
if (listener == aListener && mForTests == aForTests) {
return NS_OK;
}
// If this has composition or is dispatching an event, any other listener
// can steal ownership. Especially, if the latter case is allowed,
// nobody cannot begin input transaction with this if a modal dialog is
// opened during dispatching an event.
if (IsComposing() || IsDispatchingEvent()) {
return NS_ERROR_ALREADY_INITIALIZED;
}
}
mListener = do_GetWeakReference(aListener);
mForTests = aForTests;
if (listener && listener != aListener) {
listener->OnRemovedFrom(this);
}
return NS_OK;
}
void
TextEventDispatcher::OnDestroyWidget()
{
mWidget = nullptr;
mPendingComposition.Clear();
nsCOMPtr<TextEventDispatcherListener> listener = do_QueryReferent(mListener);
mListener = nullptr;
if (listener) {
listener->OnRemovedFrom(this);
}
}
nsresult
TextEventDispatcher::GetState() const
{
nsCOMPtr<TextEventDispatcherListener> listener = do_QueryReferent(mListener);
if (!listener) {
return NS_ERROR_NOT_INITIALIZED;
}
if (!mWidget || mWidget->Destroyed()) {
return NS_ERROR_NOT_AVAILABLE;
}
return NS_OK;
}
void
TextEventDispatcher::InitEvent(WidgetGUIEvent& aEvent) const
{
aEvent.time = PR_IntervalNow();
aEvent.refPoint = LayoutDeviceIntPoint(0, 0);
aEvent.mFlags.mIsSynthesizedForTests = mForTests;
}
nsresult
TextEventDispatcher::DispatchEvent(nsIWidget* aWidget,
WidgetGUIEvent& aEvent,
nsEventStatus& aStatus)
{
MOZ_ASSERT(!aEvent.AsInputEvent(), "Use DispatchInputEvent()");
nsRefPtr<TextEventDispatcher> kungFuDeathGrip(this);
nsCOMPtr<nsIWidget> widget(aWidget);
mDispatchingEvent++;
nsresult rv = widget->DispatchEvent(&aEvent, aStatus);
mDispatchingEvent--;
return rv;
}
nsresult
TextEventDispatcher::DispatchInputEvent(nsIWidget* aWidget,
WidgetInputEvent& aEvent,
nsEventStatus& aStatus,
DispatchTo aDispatchTo)
{
nsRefPtr<TextEventDispatcher> kungFuDeathGrip(this);
nsCOMPtr<nsIWidget> widget(aWidget);
mDispatchingEvent++;
// If the event is dispatched via nsIWidget::DispatchInputEvent(), it
// sends the event to the parent process first since APZ needs to handle it
// first. However, some callers (e.g., keyboard apps on B2G and tests
// expecting synchronous dispatch) don't want this to do that.
nsresult rv = NS_OK;
if (aDispatchTo == eDispatchToParentProcess) {
aStatus = widget->DispatchInputEvent(&aEvent);
} else {
rv = widget->DispatchEvent(&aEvent, aStatus);
}
mDispatchingEvent--;
return rv;
}
nsresult
TextEventDispatcher::StartComposition(nsEventStatus& aStatus)
{
aStatus = nsEventStatus_eIgnore;
nsresult rv = GetState();
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
if (NS_WARN_IF(mIsComposing)) {
return NS_ERROR_FAILURE;
}
mIsComposing = true;
WidgetCompositionEvent compositionStartEvent(true, NS_COMPOSITION_START,
mWidget);
InitEvent(compositionStartEvent);
rv = DispatchEvent(mWidget, compositionStartEvent, aStatus);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
return NS_OK;
}
nsresult
TextEventDispatcher::StartCompositionAutomaticallyIfNecessary(
nsEventStatus& aStatus)
{
if (IsComposing()) {
return NS_OK;
}
nsresult rv = StartComposition(aStatus);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
// If started composition has already been committed, we shouldn't dispatch
// the compositionchange event.
if (!IsComposing()) {
aStatus = nsEventStatus_eConsumeNoDefault;
return NS_OK;
}
// Note that the widget might be destroyed during a call of
// StartComposition(). In such case, we shouldn't keep dispatching next
// event.
rv = GetState();
if (NS_FAILED(rv)) {
MOZ_ASSERT(rv != NS_ERROR_NOT_INITIALIZED,
"aDispatcher must still be initialized in this case");
aStatus = nsEventStatus_eConsumeNoDefault;
return NS_OK; // Don't throw exception in this case
}
aStatus = nsEventStatus_eIgnore;
return NS_OK;
}
nsresult
TextEventDispatcher::CommitComposition(nsEventStatus& aStatus,
const nsAString* aCommitString)
{
aStatus = nsEventStatus_eIgnore;
nsresult rv = GetState();
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
// When there is no composition, caller shouldn't try to commit composition
// with non-existing composition string nor commit composition with empty
// string.
if (NS_WARN_IF(!IsComposing() &&
(!aCommitString || aCommitString->IsEmpty()))) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIWidget> widget(mWidget);
rv = StartCompositionAutomaticallyIfNecessary(aStatus);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
if (aStatus == nsEventStatus_eConsumeNoDefault) {
return NS_OK;
}
// End current composition and make this free for other IMEs.
mIsComposing = false;
EventMessage message = aCommitString ? NS_COMPOSITION_COMMIT :
NS_COMPOSITION_COMMIT_AS_IS;
WidgetCompositionEvent compositionCommitEvent(true, message, widget);
InitEvent(compositionCommitEvent);
if (message == NS_COMPOSITION_COMMIT) {
compositionCommitEvent.mData = *aCommitString;
}
rv = DispatchEvent(widget, compositionCommitEvent, aStatus);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
return NS_OK;
}
nsresult
TextEventDispatcher::NotifyIME(const IMENotification& aIMENotification)
{
nsCOMPtr<TextEventDispatcherListener> listener = do_QueryReferent(mListener);
if (!listener) {
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult rv = listener->NotifyIME(this, aIMENotification);
// If the listener isn't available, it means that it cannot handle the
// notification or request for now. In this case, we should return
// NS_ERROR_NOT_IMPLEMENTED because it's not implemented at such moment.
if (rv == NS_ERROR_NOT_AVAILABLE) {
return NS_ERROR_NOT_IMPLEMENTED;
}
return rv;
}
bool
TextEventDispatcher::DispatchKeyboardEvent(
EventMessage aMessage,
const WidgetKeyboardEvent& aKeyboardEvent,
nsEventStatus& aStatus,
DispatchTo aDispatchTo)
{
return DispatchKeyboardEventInternal(aMessage, aKeyboardEvent, aStatus,
aDispatchTo);
}
bool
TextEventDispatcher::DispatchKeyboardEventInternal(
EventMessage aMessage,
const WidgetKeyboardEvent& aKeyboardEvent,
nsEventStatus& aStatus,
DispatchTo aDispatchTo,
uint32_t aIndexOfKeypress)
{
MOZ_ASSERT(aMessage == NS_KEY_DOWN || aMessage == NS_KEY_UP ||
aMessage == NS_KEY_PRESS, "Invalid aMessage value");
nsresult rv = GetState();
if (NS_WARN_IF(NS_FAILED(rv))) {
return false;
}
// If the key shouldn't cause keypress events, don't this patch them.
if (aMessage == NS_KEY_PRESS && !aKeyboardEvent.ShouldCauseKeypressEvents()) {
return false;
}
// Basically, key events shouldn't be dispatched during composition.
if (IsComposing()) {
// However, if we need to behave like other browsers, we need the keydown
// and keyup events. Note that this behavior is also allowed by D3E spec.
// FYI: keypress events must not be fired during composition.
if (!sDispatchKeyEventsDuringComposition || aMessage == NS_KEY_PRESS) {
return false;
}
// XXX If there was mOnlyContentDispatch for this case, it might be useful
// because our chrome doesn't assume that key events are fired during
// composition.
}
WidgetKeyboardEvent keyEvent(true, aMessage, mWidget);
InitEvent(keyEvent);
keyEvent.AssignKeyEventData(aKeyboardEvent, false);
if (aStatus == nsEventStatus_eConsumeNoDefault) {
// If the key event should be dispatched as consumed event, marking it here.
// This is useful to prevent double action. E.g., when the key was already
// handled by system, our chrome shouldn't handle it.
keyEvent.mFlags.mDefaultPrevented = true;
}
// Corrects each member for the specific key event type.
if (aMessage == NS_KEY_DOWN || aMessage == NS_KEY_UP) {
MOZ_ASSERT(!aIndexOfKeypress,
"aIndexOfKeypress must be 0 for either NS_KEY_DOWN or NS_KEY_UP");
// charCode of keydown and keyup should be 0.
keyEvent.charCode = 0;
} else if (keyEvent.mKeyNameIndex != KEY_NAME_INDEX_USE_STRING) {
MOZ_ASSERT(!aIndexOfKeypress,
"aIndexOfKeypress must be 0 for NS_KEY_PRESS of non-printable key");
// If keypress event isn't caused by printable key, its charCode should
// be 0.
keyEvent.charCode = 0;
} else {
MOZ_RELEASE_ASSERT(
!aIndexOfKeypress || aIndexOfKeypress < keyEvent.mKeyValue.Length(),
"aIndexOfKeypress must be 0 - mKeyValue.Length() - 1");
keyEvent.keyCode = 0;
wchar_t ch =
keyEvent.mKeyValue.IsEmpty() ? 0 : keyEvent.mKeyValue[aIndexOfKeypress];
keyEvent.charCode = static_cast<uint32_t>(ch);
if (ch) {
keyEvent.mKeyValue.Assign(ch);
} else {
keyEvent.mKeyValue.Truncate();
}
}
if (aMessage == NS_KEY_UP) {
// mIsRepeat of keyup event must be false.
keyEvent.mIsRepeat = false;
}
// mIsComposing should be initialized later.
keyEvent.mIsComposing = false;
// XXX Currently, we don't support to dispatch key event with native key
// event information.
keyEvent.mNativeKeyEvent = nullptr;
// XXX Currently, we don't support to dispatch key events with data for
// plugins.
keyEvent.mPluginEvent.Clear();
// TODO: Manage mUniqueId here.
DispatchInputEvent(mWidget, keyEvent, aStatus, aDispatchTo);
return true;
}
bool
TextEventDispatcher::MaybeDispatchKeypressEvents(
const WidgetKeyboardEvent& aKeyboardEvent,
nsEventStatus& aStatus,
DispatchTo aDispatchTo)
{
// If the key event was consumed, keypress event shouldn't be fired.
if (aStatus == nsEventStatus_eConsumeNoDefault) {
return false;
}
// If the key isn't a printable key or just inputting one character or
// no character, we should dispatch only one keypress. Otherwise, i.e.,
// if the key is a printable key and inputs multiple characters, keypress
// event should be dispatched the count of inputting characters times.
size_t keypressCount =
aKeyboardEvent.mKeyNameIndex != KEY_NAME_INDEX_USE_STRING ?
1 : std::max(static_cast<nsAString::size_type>(1),
aKeyboardEvent.mKeyValue.Length());
bool isDispatched = false;
bool consumed = false;
for (size_t i = 0; i < keypressCount; i++) {
aStatus = nsEventStatus_eIgnore;
if (!DispatchKeyboardEventInternal(NS_KEY_PRESS, aKeyboardEvent,
aStatus, aDispatchTo, i)) {
// The widget must have been gone.
break;
}
isDispatched = true;
if (!consumed) {
consumed = (aStatus == nsEventStatus_eConsumeNoDefault);
}
}
// If one of the keypress event was consumed, return ConsumeNoDefault.
if (consumed) {
aStatus = nsEventStatus_eConsumeNoDefault;
}
return isDispatched;
}
/******************************************************************************
* TextEventDispatcher::PendingComposition
*****************************************************************************/
TextEventDispatcher::PendingComposition::PendingComposition()
{
Clear();
}
void
TextEventDispatcher::PendingComposition::Clear()
{
mString.Truncate();
mClauses = nullptr;
mCaret.mRangeType = 0;
}
void
TextEventDispatcher::PendingComposition::EnsureClauseArray()
{
if (mClauses) {
return;
}
mClauses = new TextRangeArray();
}
nsresult
TextEventDispatcher::PendingComposition::SetString(const nsAString& aString)
{
mString = aString;
return NS_OK;
}
nsresult
TextEventDispatcher::PendingComposition::AppendClause(uint32_t aLength,
uint32_t aAttribute)
{
if (NS_WARN_IF(!aLength)) {
return NS_ERROR_INVALID_ARG;
}
switch (aAttribute) {
case NS_TEXTRANGE_RAWINPUT:
case NS_TEXTRANGE_SELECTEDRAWTEXT:
case NS_TEXTRANGE_CONVERTEDTEXT:
case NS_TEXTRANGE_SELECTEDCONVERTEDTEXT: {
EnsureClauseArray();
TextRange textRange;
textRange.mStartOffset =
mClauses->IsEmpty() ? 0 : mClauses->LastElement().mEndOffset;
textRange.mEndOffset = textRange.mStartOffset + aLength;
textRange.mRangeType = aAttribute;
mClauses->AppendElement(textRange);
return NS_OK;
}
default:
return NS_ERROR_INVALID_ARG;
}
}
nsresult
TextEventDispatcher::PendingComposition::SetCaret(uint32_t aOffset,
uint32_t aLength)
{
mCaret.mStartOffset = aOffset;
mCaret.mEndOffset = mCaret.mStartOffset + aLength;
mCaret.mRangeType = NS_TEXTRANGE_CARETPOSITION;
return NS_OK;
}
nsresult
TextEventDispatcher::PendingComposition::Flush(TextEventDispatcher* aDispatcher,
nsEventStatus& aStatus)
{
aStatus = nsEventStatus_eIgnore;
nsresult rv = aDispatcher->GetState();
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
if (mClauses && !mClauses->IsEmpty() &&
mClauses->LastElement().mEndOffset != mString.Length()) {
NS_WARNING("Sum of length of the all clauses must be same as the string "
"length");
Clear();
return NS_ERROR_ILLEGAL_VALUE;
}
if (mCaret.mRangeType == NS_TEXTRANGE_CARETPOSITION) {
if (mCaret.mEndOffset > mString.Length()) {
NS_WARNING("Caret position is out of the composition string");
Clear();
return NS_ERROR_ILLEGAL_VALUE;
}
EnsureClauseArray();
mClauses->AppendElement(mCaret);
}
nsRefPtr<TextEventDispatcher> kungFuDeathGrip(aDispatcher);
nsCOMPtr<nsIWidget> widget(aDispatcher->mWidget);
WidgetCompositionEvent compChangeEvent(true, NS_COMPOSITION_CHANGE, widget);
aDispatcher->InitEvent(compChangeEvent);
compChangeEvent.mData = mString;
if (mClauses) {
MOZ_ASSERT(!mClauses->IsEmpty(),
"mClauses must be non-empty array when it's not nullptr");
compChangeEvent.mRanges = mClauses;
}
// While this method dispatches a composition event, some other event handler
// cause more clauses to be added. So, we should clear pending composition
// before dispatching the event.
Clear();
rv = aDispatcher->StartCompositionAutomaticallyIfNecessary(aStatus);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
if (aStatus == nsEventStatus_eConsumeNoDefault) {
return NS_OK;
}
rv = aDispatcher->DispatchEvent(widget, compChangeEvent, aStatus);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
return NS_OK;
}
} // namespace widget
} // namespace mozilla