From 776acd167ea436323af0a51662f49de29a77a9c0 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Sat, 14 Sep 2013 11:39:41 +0900 Subject: [PATCH] Bug 912956 part.1 Rename all event stuff in mozilla::widget to mozilla::* r=roc --- content/base/public/Element.h | 2 +- content/base/src/Element.cpp | 2 +- content/events/src/DOMWheelEvent.cpp | 14 +-- content/events/src/DOMWheelEvent.h | 10 +-- content/events/src/TextComposition.cpp | 1 - content/events/src/TextComposition.h | 1 + content/events/src/nsDOMEvent.cpp | 6 +- content/events/src/nsDOMMouseEvent.cpp | 8 +- content/events/src/nsDOMUIEvent.cpp | 26 +++--- content/events/src/nsDOMUIEvent.h | 2 +- content/events/src/nsEventDispatcher.cpp | 2 +- content/events/src/nsEventStateManager.cpp | 87 +++++++++---------- content/events/src/nsEventStateManager.h | 36 ++++---- content/html/content/src/HTMLLabelElement.cpp | 2 +- content/xbl/src/nsXBLPrototypeHandler.cpp | 2 +- dom/base/nsDOMWindowUtils.cpp | 28 +++--- dom/base/nsDOMWindowUtils.h | 2 +- dom/interfaces/events/nsIDOMEvent.idl | 5 +- dom/ipc/PBrowser.ipdl | 2 +- dom/ipc/TabChild.h | 2 +- dom/ipc/TabParent.h | 2 +- extensions/widgetutils/src/nsWidgetUtils.cpp | 2 +- layout/base/nsPresShell.cpp | 2 +- layout/generic/nsSelection.cpp | 2 +- layout/xul/base/public/nsXULPopupManager.h | 2 +- widget/cocoa/TextInputHandler.mm | 6 +- widget/nsEvent.h | 17 ---- widget/nsGUIEvent.h | 56 ++++++------ widget/nsGUIEventIPC.h | 12 +-- widget/nsIWidget.h | 15 ++++ widget/os2/nsWindow.cpp | 10 +-- widget/qt/nsQtKeyUtils.h | 2 +- widget/qt/nsWindow.cpp | 8 +- widget/tests/test_assign_event_data.html | 6 +- widget/windows/WinMouseScrollHandler.h | 3 +- widget/windows/nsWinGesture.h | 2 +- 36 files changed, 188 insertions(+), 199 deletions(-) diff --git a/content/base/public/Element.h b/content/base/public/Element.h index 3605e2b51f4a..3ae358e2cb2f 100644 --- a/content/base/public/Element.h +++ b/content/base/public/Element.h @@ -764,7 +764,7 @@ public: nsInputEvent* aSourceEvent, nsIContent* aTarget, bool aFullDispatch, - const widget::EventFlags* aFlags, + const EventFlags* aFlags, nsEventStatus* aStatus); /** diff --git a/content/base/src/Element.cpp b/content/base/src/Element.cpp index 08170e10477b..ed4e6bb81948 100644 --- a/content/base/src/Element.cpp +++ b/content/base/src/Element.cpp @@ -1405,7 +1405,7 @@ Element::DispatchClickEvent(nsPresContext* aPresContext, nsInputEvent* aSourceEvent, nsIContent* aTarget, bool aFullDispatch, - const widget::EventFlags* aExtraEventFlags, + const EventFlags* aExtraEventFlags, nsEventStatus* aStatus) { NS_PRECONDITION(aTarget, "Must have target"); diff --git a/content/events/src/DOMWheelEvent.cpp b/content/events/src/DOMWheelEvent.cpp index d56016b39f3f..6e4edc407a74 100644 --- a/content/events/src/DOMWheelEvent.cpp +++ b/content/events/src/DOMWheelEvent.cpp @@ -13,10 +13,10 @@ namespace dom { DOMWheelEvent::DOMWheelEvent(EventTarget* aOwner, nsPresContext* aPresContext, - widget::WheelEvent* aWheelEvent) + WheelEvent* aWheelEvent) : nsDOMMouseEvent(aOwner, aPresContext, aWheelEvent ? aWheelEvent : - new widget::WheelEvent(false, 0, nullptr)) + new WheelEvent(false, 0, nullptr)) { if (aWheelEvent) { mEventIsInternal = false; @@ -24,7 +24,7 @@ DOMWheelEvent::DOMWheelEvent(EventTarget* aOwner, mEventIsInternal = true; mEvent->time = PR_Now(); mEvent->refPoint.x = mEvent->refPoint.y = 0; - static_cast(mEvent)->inputSource = + static_cast(mEvent)->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN; } } @@ -34,7 +34,7 @@ DOMWheelEvent::~DOMWheelEvent() if (mEventIsInternal && mEvent) { MOZ_ASSERT(mEvent->eventStructType == NS_WHEEL_EVENT, "The mEvent must be WheelEvent"); - delete static_cast(mEvent); + delete static_cast(mEvent); mEvent = nullptr; } } @@ -71,7 +71,7 @@ DOMWheelEvent::InitWheelEvent(const nsAString & aType, aRelatedTarget, aModifiersList); NS_ENSURE_SUCCESS(rv, rv); - widget::WheelEvent* wheelEvent = static_cast(mEvent); + WheelEvent* wheelEvent = static_cast(mEvent); wheelEvent->deltaX = aDeltaX; wheelEvent->deltaY = aDeltaY; wheelEvent->deltaZ = aDeltaZ; @@ -163,7 +163,7 @@ DOMWheelEvent::Constructor(const GlobalObject& aGlobal, aParam.mButton, aParam.mRelatedTarget, modifierList, aParam.mDeltaX, aParam.mDeltaY, aParam.mDeltaZ, aParam.mDeltaMode); - static_cast(e->mEvent)->buttons = aParam.mButtons; + static_cast(e->mEvent)->buttons = aParam.mButtons; e->SetTrusted(trusted); return e.forget(); } @@ -176,7 +176,7 @@ using namespace mozilla; nsresult NS_NewDOMWheelEvent(nsIDOMEvent** aInstancePtrResult, mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext, - widget::WheelEvent *aEvent) + WheelEvent *aEvent) { dom::DOMWheelEvent* it = new dom::DOMWheelEvent(aOwner, aPresContext, aEvent); return CallQueryInterface(it, aInstancePtrResult); diff --git a/content/events/src/DOMWheelEvent.h b/content/events/src/DOMWheelEvent.h index 931cdfebeb3c..a065a1160666 100644 --- a/content/events/src/DOMWheelEvent.h +++ b/content/events/src/DOMWheelEvent.h @@ -20,7 +20,7 @@ class DOMWheelEvent : public nsDOMMouseEvent, public: DOMWheelEvent(mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext, - widget::WheelEvent* aWheelEvent); + WheelEvent* aWheelEvent); virtual ~DOMWheelEvent(); NS_DECL_ISUPPORTS_INHERITED @@ -45,22 +45,22 @@ public: double DeltaX() { - return static_cast(mEvent)->deltaX; + return static_cast(mEvent)->deltaX; } double DeltaY() { - return static_cast(mEvent)->deltaY; + return static_cast(mEvent)->deltaY; } double DeltaZ() { - return static_cast(mEvent)->deltaZ; + return static_cast(mEvent)->deltaZ; } uint32_t DeltaMode() { - return static_cast(mEvent)->deltaMode; + return static_cast(mEvent)->deltaMode; } }; diff --git a/content/events/src/TextComposition.cpp b/content/events/src/TextComposition.cpp index 53edc76ab049..fc6aa8bf5c4f 100644 --- a/content/events/src/TextComposition.cpp +++ b/content/events/src/TextComposition.cpp @@ -12,7 +12,6 @@ #include "nsIContent.h" #include "nsIMEStateManager.h" #include "nsIPresShell.h" -#include "nsIWidget.h" #include "nsPresContext.h" namespace mozilla { diff --git a/content/events/src/TextComposition.h b/content/events/src/TextComposition.h index 51dbbb5e9600..fd25793f01e7 100644 --- a/content/events/src/TextComposition.h +++ b/content/events/src/TextComposition.h @@ -10,6 +10,7 @@ #include "nsCOMPtr.h" #include "nsEvent.h" #include "nsINode.h" +#include "nsIWidget.h" #include "nsTArray.h" #include "nsThreadUtils.h" #include "mozilla/Attributes.h" diff --git a/content/events/src/nsDOMEvent.cpp b/content/events/src/nsDOMEvent.cpp index 3470fafecf02..058dffe3afd4 100644 --- a/content/events/src/nsDOMEvent.cpp +++ b/content/events/src/nsDOMEvent.cpp @@ -601,10 +601,8 @@ nsDOMEvent::DuplicatePrivateData() } case NS_WHEEL_EVENT: { - widget::WheelEvent* oldWheelEvent = - static_cast(mEvent); - widget::WheelEvent* wheelEvent = - new widget::WheelEvent(false, msg, nullptr); + WheelEvent* oldWheelEvent = static_cast(mEvent); + WheelEvent* wheelEvent = new WheelEvent(false, msg, nullptr); wheelEvent->AssignWheelEventData(*oldWheelEvent, true); newEvent = wheelEvent; break; diff --git a/content/events/src/nsDOMMouseEvent.cpp b/content/events/src/nsDOMMouseEvent.cpp index ab172d3df645..d4a242168969 100644 --- a/content/events/src/nsDOMMouseEvent.cpp +++ b/content/events/src/nsDOMMouseEvent.cpp @@ -126,10 +126,10 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString& aType, nsresult rv = InitMouseEvent(aType, aCanBubble, aCancelable, aView, aDetail, aScreenX, aScreenY, aClientX, aClientY, - (modifiers & widget::MODIFIER_CONTROL) != 0, - (modifiers & widget::MODIFIER_ALT) != 0, - (modifiers & widget::MODIFIER_SHIFT) != 0, - (modifiers & widget::MODIFIER_META) != 0, + (modifiers & MODIFIER_CONTROL) != 0, + (modifiers & MODIFIER_ALT) != 0, + (modifiers & MODIFIER_SHIFT) != 0, + (modifiers & MODIFIER_META) != 0, aButton, aRelatedTarget); NS_ENSURE_SUCCESS(rv, rv); diff --git a/content/events/src/nsDOMUIEvent.cpp b/content/events/src/nsDOMUIEvent.cpp index a52c9982997e..de200c9319de 100644 --- a/content/events/src/nsDOMUIEvent.cpp +++ b/content/events/src/nsDOMUIEvent.cpp @@ -406,25 +406,25 @@ nsDOMUIEvent::Deserialize(const IPC::Message* aMsg, void** aIter) // we fail to build on Mac at calling mozilla::ArrayLength(). struct nsModifierPair { - mozilla::widget::Modifier modifier; + mozilla::Modifier modifier; const char* name; }; static const nsModifierPair kPairs[] = { - { widget::MODIFIER_ALT, NS_DOM_KEYNAME_ALT }, - { widget::MODIFIER_ALTGRAPH, NS_DOM_KEYNAME_ALTGRAPH }, - { widget::MODIFIER_CAPSLOCK, NS_DOM_KEYNAME_CAPSLOCK }, - { widget::MODIFIER_CONTROL, NS_DOM_KEYNAME_CONTROL }, - { widget::MODIFIER_FN, NS_DOM_KEYNAME_FN }, - { widget::MODIFIER_META, NS_DOM_KEYNAME_META }, - { widget::MODIFIER_NUMLOCK, NS_DOM_KEYNAME_NUMLOCK }, - { widget::MODIFIER_SCROLLLOCK, NS_DOM_KEYNAME_SCROLLLOCK }, - { widget::MODIFIER_SHIFT, NS_DOM_KEYNAME_SHIFT }, - { widget::MODIFIER_SYMBOLLOCK, NS_DOM_KEYNAME_SYMBOLLOCK }, - { widget::MODIFIER_OS, NS_DOM_KEYNAME_OS } + { MODIFIER_ALT, NS_DOM_KEYNAME_ALT }, + { MODIFIER_ALTGRAPH, NS_DOM_KEYNAME_ALTGRAPH }, + { MODIFIER_CAPSLOCK, NS_DOM_KEYNAME_CAPSLOCK }, + { MODIFIER_CONTROL, NS_DOM_KEYNAME_CONTROL }, + { MODIFIER_FN, NS_DOM_KEYNAME_FN }, + { MODIFIER_META, NS_DOM_KEYNAME_META }, + { MODIFIER_NUMLOCK, NS_DOM_KEYNAME_NUMLOCK }, + { MODIFIER_SCROLLLOCK, NS_DOM_KEYNAME_SCROLLLOCK }, + { MODIFIER_SHIFT, NS_DOM_KEYNAME_SHIFT }, + { MODIFIER_SYMBOLLOCK, NS_DOM_KEYNAME_SYMBOLLOCK }, + { MODIFIER_OS, NS_DOM_KEYNAME_OS } }; /* static */ -mozilla::widget::Modifiers +mozilla::Modifiers nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList) { if (aModifiersList.IsEmpty()) { diff --git a/content/events/src/nsDOMUIEvent.h b/content/events/src/nsDOMUIEvent.h index 2bef4408ee3f..41818efff7b4 100644 --- a/content/events/src/nsDOMUIEvent.h +++ b/content/events/src/nsDOMUIEvent.h @@ -158,7 +158,7 @@ protected: bool mIsPointerLocked; CSSIntPoint mLastClientPoint; - typedef mozilla::widget::Modifiers Modifiers; + typedef mozilla::Modifiers Modifiers; static Modifiers ComputeModifierState(const nsAString& aModifiersList); bool GetModifierStateInternal(const nsAString& aKey); }; diff --git a/content/events/src/nsEventDispatcher.cpp b/content/events/src/nsEventDispatcher.cpp index 1d672f1a5c39..11ec147c1d4e 100644 --- a/content/events/src/nsEventDispatcher.cpp +++ b/content/events/src/nsEventDispatcher.cpp @@ -712,7 +712,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner, static_cast(aEvent)); case NS_WHEEL_EVENT: return NS_NewDOMWheelEvent(aDOMEvent, aOwner, aPresContext, - static_cast(aEvent)); + static_cast(aEvent)); case NS_DRAG_EVENT: return NS_NewDOMDragEvent(aDOMEvent, aOwner, aPresContext, static_cast(aEvent)); diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 891d5e0db4a7..8beb30b68ff2 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -255,7 +255,7 @@ struct DeltaValues { } - explicit DeltaValues(widget::WheelEvent* aEvent) : + explicit DeltaValues(WheelEvent* aEvent) : deltaX(aEvent->deltaX), deltaY(aEvent->deltaY) { } @@ -268,17 +268,17 @@ class nsMouseWheelTransaction { public: static nsIFrame* GetTargetFrame() { return sTargetFrame; } static void BeginTransaction(nsIFrame* aTargetFrame, - widget::WheelEvent* aEvent); + WheelEvent* aEvent); // Be careful, UpdateTransaction may fire a DOM event, therefore, the target // frame might be destroyed in the event handler. - static bool UpdateTransaction(widget::WheelEvent* aEvent); + static bool UpdateTransaction(WheelEvent* aEvent); static void EndTransaction(); static void OnEvent(nsEvent* aEvent); static void Shutdown(); static uint32_t GetTimeoutTime(); - static DeltaValues AccelerateWheelDelta(widget::WheelEvent* aEvent, + static DeltaValues AccelerateWheelDelta(WheelEvent* aEvent, bool aAllowScrollSpeedOverride); enum { @@ -292,7 +292,7 @@ protected: static uint32_t GetIgnoreMoveDelayTime(); static int32_t GetAccelerationStart(); static int32_t GetAccelerationFactor(); - static DeltaValues OverrideSystemScrollSpeed(widget::WheelEvent* aEvent); + static DeltaValues OverrideSystemScrollSpeed(WheelEvent* aEvent); static double ComputeAcceleratedWheelDelta(double aDelta, int32_t aFactor); static nsWeakFrame sTargetFrame; @@ -341,7 +341,7 @@ CanScrollOn(nsIScrollableFrame* aScrollFrame, double aDeltaX, double aDeltaY) void nsMouseWheelTransaction::BeginTransaction(nsIFrame* aTargetFrame, - widget::WheelEvent* aEvent) + WheelEvent* aEvent) { NS_ASSERTION(!sTargetFrame, "previous transaction is not finished!"); sTargetFrame = aTargetFrame; @@ -353,7 +353,7 @@ nsMouseWheelTransaction::BeginTransaction(nsIFrame* aTargetFrame, } bool -nsMouseWheelTransaction::UpdateTransaction(widget::WheelEvent* aEvent) +nsMouseWheelTransaction::UpdateTransaction(WheelEvent* aEvent) { nsIScrollableFrame* sf = GetTargetFrame()->GetScrollTargetFrame(); NS_ENSURE_TRUE(sf, false); @@ -538,7 +538,7 @@ nsMouseWheelTransaction::GetIgnoreMoveDelayTime() } DeltaValues -nsMouseWheelTransaction::AccelerateWheelDelta(widget::WheelEvent* aEvent, +nsMouseWheelTransaction::AccelerateWheelDelta(WheelEvent* aEvent, bool aAllowScrollSpeedOverride) { DeltaValues result(aEvent); @@ -589,7 +589,7 @@ nsMouseWheelTransaction::GetAccelerationFactor() } DeltaValues -nsMouseWheelTransaction::OverrideSystemScrollSpeed(widget::WheelEvent* aEvent) +nsMouseWheelTransaction::OverrideSystemScrollSpeed(WheelEvent* aEvent) { MOZ_ASSERT(sTargetFrame, "We don't have mouse scrolling transaction"); MOZ_ASSERT(aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE); @@ -972,7 +972,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext, if (content) mCurrentTargetContent = content; - widget::WheelEvent* wheelEvent = static_cast(aEvent); + WheelEvent* wheelEvent = static_cast(aEvent); WheelPrefs::GetInstance()->ApplyUserPrefsToDelta(wheelEvent); // If we won't dispatch a DOM event for this event, nothing to do anymore. @@ -1388,7 +1388,7 @@ nsEventStateManager::DispatchCrossProcessEvent(nsEvent* aEvent, return remote->SendRealKeyEvent(*keyEvent); } case NS_WHEEL_EVENT: { - widget::WheelEvent* wheelEvent = static_cast(aEvent); + WheelEvent* wheelEvent = static_cast(aEvent); return remote->SendMouseWheelEvent(*wheelEvent); } case NS_TOUCH_EVENT: { @@ -2011,7 +2011,7 @@ nsEventStateManager::DetermineDragTarget(nsPresContext* aPresContext, // occurred, and aSelectionTarget is the node to use when a selection is used bool canDrag; nsCOMPtr dragDataNode; - bool wasAlt = (mGestureModifiers & widget::MODIFIER_ALT) != 0; + bool wasAlt = (mGestureModifiers & MODIFIER_ALT) != 0; nsresult rv = nsContentAreaDragDrop::GetDragData(window, mGestureDownContent, aSelectionTarget, wasAlt, aDataTransfer, &canDrag, aSelection, @@ -2331,7 +2331,7 @@ GetParentFrameToScroll(nsIFrame* aFrame) void nsEventStateManager::DispatchLegacyMouseScrollEvents(nsIFrame* aTargetFrame, - widget::WheelEvent* aEvent, + WheelEvent* aEvent, nsEventStatus* aStatus) { MOZ_ASSERT(aEvent); @@ -2456,7 +2456,7 @@ nsEventStateManager::DispatchLegacyMouseScrollEvents(nsIFrame* aTargetFrame, void nsEventStateManager::SendLineScrollEvent(nsIFrame* aTargetFrame, - widget::WheelEvent* aEvent, + WheelEvent* aEvent, nsEventStatus* aStatus, int32_t aDelta, DeltaDirection aDeltaDirection) @@ -2491,7 +2491,7 @@ nsEventStateManager::SendLineScrollEvent(nsIFrame* aTargetFrame, void nsEventStateManager::SendPixelScrollEvent(nsIFrame* aTargetFrame, - widget::WheelEvent* aEvent, + WheelEvent* aEvent, nsEventStatus* aStatus, int32_t aPixelDelta, DeltaDirection aDeltaDirection) @@ -2527,7 +2527,7 @@ nsEventStateManager::SendPixelScrollEvent(nsIFrame* aTargetFrame, nsIScrollableFrame* nsEventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame, - widget::WheelEvent* aEvent, + WheelEvent* aEvent, ComputeScrollTargetOptions aOptions) { if (aOptions & PREFER_MOUSE_WHEEL_TRANSACTION) { @@ -2615,7 +2615,7 @@ nsEventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame, nsSize nsEventStateManager::GetScrollAmount(nsPresContext* aPresContext, - widget::WheelEvent* aEvent, + WheelEvent* aEvent, nsIScrollableFrame* aScrollableFrame) { MOZ_ASSERT(aPresContext); @@ -2646,7 +2646,7 @@ nsEventStateManager::GetScrollAmount(nsPresContext* aPresContext, void nsEventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame, - widget::WheelEvent* aEvent) + WheelEvent* aEvent) { MOZ_ASSERT(aScrollableFrame); MOZ_ASSERT(aEvent); @@ -2733,20 +2733,20 @@ nsEventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame, nsIScrollableFrame::ScrollMode mode; switch (aEvent->scrollType) { - case widget::WheelEvent::SCROLL_DEFAULT: + case WheelEvent::SCROLL_DEFAULT: if (isDeltaModePixel) { mode = nsIScrollableFrame::NORMAL; } else { mode = nsIScrollableFrame::SMOOTH; } break; - case widget::WheelEvent::SCROLL_SYNCHRONOUSLY: + case WheelEvent::SCROLL_SYNCHRONOUSLY: mode = nsIScrollableFrame::INSTANT; break; - case widget::WheelEvent::SCROLL_ASYNCHRONOUSELY: + case WheelEvent::SCROLL_ASYNCHRONOUSELY: mode = nsIScrollableFrame::NORMAL; break; - case widget::WheelEvent::SCROLL_SMOOTHLY: + case WheelEvent::SCROLL_SMOOTHLY: mode = nsIScrollableFrame::SMOOTH; break; default: @@ -3159,7 +3159,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, break; } - widget::WheelEvent* wheelEvent = static_cast(aEvent); + WheelEvent* wheelEvent = static_cast(aEvent); switch (WheelPrefs::GetInstance()->ComputeActionFor(wheelEvent)) { case WheelPrefs::ACTION_SCROLL: { if (!wheelEvent->deltaX && !wheelEvent->deltaY) { @@ -5086,7 +5086,7 @@ void nsEventStateManager::DeltaAccumulator::InitLineOrPageDelta( nsIFrame* aTargetFrame, nsEventStateManager* aESM, - widget::WheelEvent* aEvent) + WheelEvent* aEvent) { MOZ_ASSERT(aESM); MOZ_ASSERT(aEvent); @@ -5189,7 +5189,7 @@ nsEventStateManager::DeltaAccumulator::Reset() nsIntPoint nsEventStateManager::DeltaAccumulator::ComputeScrollAmountForDefaultAction( - widget::WheelEvent* aEvent, + WheelEvent* aEvent, const nsIntSize& aScrollAmountInDevPixels) { MOZ_ASSERT(aEvent); @@ -5273,29 +5273,29 @@ nsEventStateManager::WheelPrefs::Reset() } nsEventStateManager::WheelPrefs::Index -nsEventStateManager::WheelPrefs::GetIndexFor(widget::WheelEvent* aEvent) +nsEventStateManager::WheelPrefs::GetIndexFor(WheelEvent* aEvent) { if (!aEvent) { return INDEX_DEFAULT; } - widget::Modifiers modifiers = - (aEvent->modifiers & (widget::MODIFIER_ALT | - widget::MODIFIER_CONTROL | - widget::MODIFIER_META | - widget::MODIFIER_SHIFT | - widget::MODIFIER_OS)); + Modifiers modifiers = + (aEvent->modifiers & (MODIFIER_ALT | + MODIFIER_CONTROL | + MODIFIER_META | + MODIFIER_SHIFT | + MODIFIER_OS)); switch (modifiers) { - case widget::MODIFIER_ALT: + case MODIFIER_ALT: return INDEX_ALT; - case widget::MODIFIER_CONTROL: + case MODIFIER_CONTROL: return INDEX_CONTROL; - case widget::MODIFIER_META: + case MODIFIER_META: return INDEX_META; - case widget::MODIFIER_SHIFT: + case MODIFIER_SHIFT: return INDEX_SHIFT; - case widget::MODIFIER_OS: + case MODIFIER_OS: return INDEX_OS; default: // If two or more modifier keys are pressed, we should use default @@ -5384,8 +5384,7 @@ nsEventStateManager::WheelPrefs::Init( } void -nsEventStateManager::WheelPrefs::ApplyUserPrefsToDelta( - widget::WheelEvent* aEvent) +nsEventStateManager::WheelPrefs::ApplyUserPrefsToDelta(WheelEvent* aEvent) { Index index = GetIndexFor(aEvent); Init(index); @@ -5412,7 +5411,7 @@ nsEventStateManager::WheelPrefs::ApplyUserPrefsToDelta( void nsEventStateManager::WheelPrefs::CancelApplyingUserPrefsFromOverflowDelta( - widget::WheelEvent* aEvent) + WheelEvent* aEvent) { Index index = GetIndexFor(aEvent); Init(index); @@ -5432,7 +5431,7 @@ nsEventStateManager::WheelPrefs::CancelApplyingUserPrefsFromOverflowDelta( } nsEventStateManager::WheelPrefs::Action -nsEventStateManager::WheelPrefs::ComputeActionFor(widget::WheelEvent* aEvent) +nsEventStateManager::WheelPrefs::ComputeActionFor(WheelEvent* aEvent) { Index index = GetIndexFor(aEvent); Init(index); @@ -5458,7 +5457,7 @@ nsEventStateManager::WheelPrefs::ComputeActionFor(widget::WheelEvent* aEvent) bool nsEventStateManager::WheelPrefs::NeedToComputeLineOrPageDelta( - widget::WheelEvent* aEvent) + WheelEvent* aEvent) { Index index = GetIndexFor(aEvent); Init(index); @@ -5469,7 +5468,7 @@ nsEventStateManager::WheelPrefs::NeedToComputeLineOrPageDelta( bool nsEventStateManager::WheelPrefs::IsOverOnePageScrollAllowedX( - widget::WheelEvent* aEvent) + WheelEvent* aEvent) { Index index = GetIndexFor(aEvent); Init(index); @@ -5479,7 +5478,7 @@ nsEventStateManager::WheelPrefs::IsOverOnePageScrollAllowedX( bool nsEventStateManager::WheelPrefs::IsOverOnePageScrollAllowedY( - widget::WheelEvent* aEvent) + WheelEvent* aEvent) { Index index = GetIndexFor(aEvent); Init(index); diff --git a/content/events/src/nsEventStateManager.h b/content/events/src/nsEventStateManager.h index d879809fbe37..d8a13a6eef85 100644 --- a/content/events/src/nsEventStateManager.h +++ b/content/events/src/nsEventStateManager.h @@ -89,7 +89,7 @@ public: * NS_MOUSE_PIXEL_SCROLL event for compatiblity with old Gecko. */ void DispatchLegacyMouseScrollEvents(nsIFrame* aTargetFrame, - mozilla::widget::WheelEvent* aEvent, + mozilla::WheelEvent* aEvent, nsEventStatus* aStatus); void NotifyDestroyPresContext(nsPresContext* aPresContext); @@ -357,7 +357,7 @@ protected: * ApplyUserPrefsToDelta() overrides the wheel event's delta values with * user prefs. */ - void ApplyUserPrefsToDelta(mozilla::widget::WheelEvent* aEvent); + void ApplyUserPrefsToDelta(mozilla::WheelEvent* aEvent); /** * If ApplyUserPrefsToDelta() changed the delta values with customized @@ -365,7 +365,7 @@ protected: * CancelApplyingUserPrefsFromOverflowDelta() cancels the inflation. */ void CancelApplyingUserPrefsFromOverflowDelta( - mozilla::widget::WheelEvent* aEvent); + mozilla::WheelEvent* aEvent); /** * Computes the default action for the aEvent with the prefs. @@ -378,20 +378,20 @@ protected: ACTION_ZOOM, ACTION_LAST = ACTION_ZOOM }; - Action ComputeActionFor(mozilla::widget::WheelEvent* aEvent); + Action ComputeActionFor(mozilla::WheelEvent* aEvent); /** * NeedToComputeLineOrPageDelta() returns if the aEvent needs to be * computed the lineOrPageDelta values. */ - bool NeedToComputeLineOrPageDelta(mozilla::widget::WheelEvent* aEvent); + bool NeedToComputeLineOrPageDelta(mozilla::WheelEvent* aEvent); /** * IsOverOnePageScrollAllowed*() checks whether wheel scroll amount should * be rounded down to the page width/height (false) or not (true). */ - bool IsOverOnePageScrollAllowedX(mozilla::widget::WheelEvent* aEvent); - bool IsOverOnePageScrollAllowedY(mozilla::widget::WheelEvent* aEvent); + bool IsOverOnePageScrollAllowedX(mozilla::WheelEvent* aEvent); + bool IsOverOnePageScrollAllowedY(mozilla::WheelEvent* aEvent); private: WheelPrefs(); @@ -418,7 +418,7 @@ protected: * default index which is used at either no modifier key is pressed or * two or modifier keys are pressed. */ - Index GetIndexFor(mozilla::widget::WheelEvent* aEvent); + Index GetIndexFor(mozilla::WheelEvent* aEvent); /** * GetPrefNameBase() returns the base pref name for aEvent. @@ -471,7 +471,7 @@ protected: /** * SendLineScrollEvent() dispatches a DOMMouseScroll event for the - * widget::WheelEvent. This method shouldn't be called for non-trusted + * WheelEvent. This method shouldn't be called for non-trusted * wheel event because it's not necessary for compatiblity. * * @param aTargetFrame The event target of wheel event. @@ -482,14 +482,14 @@ protected: * @param aDeltaDirection The X/Y direction of dispatching event. */ void SendLineScrollEvent(nsIFrame* aTargetFrame, - mozilla::widget::WheelEvent* aEvent, + mozilla::WheelEvent* aEvent, nsEventStatus* aStatus, int32_t aDelta, DeltaDirection aDeltaDirection); /** * SendPixelScrollEvent() dispatches a MozMousePixelScroll event for the - * widget::WheelEvent. This method shouldn't be called for non-trusted + * WheelEvent. This method shouldn't be called for non-trusted * wheel event because it's not necessary for compatiblity. * * @param aTargetFrame The event target of wheel event. @@ -500,7 +500,7 @@ protected: * @param aDeltaDirection The X/Y direction of dispatching event. */ void SendPixelScrollEvent(nsIFrame* aTargetFrame, - mozilla::widget::WheelEvent* aEvent, + mozilla::WheelEvent* aEvent, nsEventStatus* aStatus, int32_t aPixelDelta, DeltaDirection aDeltaDirection); @@ -544,7 +544,7 @@ protected: (PREFER_ACTUAL_SCROLLABLE_TARGET_ALONG_Y_AXIS | START_FROM_PARENT) }; nsIScrollableFrame* ComputeScrollTarget(nsIFrame* aTargetFrame, - mozilla::widget::WheelEvent* aEvent, + mozilla::WheelEvent* aEvent, ComputeScrollTargetOptions aOptions); /** @@ -560,14 +560,14 @@ protected: * line height or visible area's width and height. */ nsSize GetScrollAmount(nsPresContext* aPresContext, - mozilla::widget::WheelEvent* aEvent, + mozilla::WheelEvent* aEvent, nsIScrollableFrame* aScrollableFrame); /** * DoScrollText() scrolls the scrollable frame for aEvent. */ void DoScrollText(nsIScrollableFrame* aScrollableFrame, - mozilla::widget::WheelEvent* aEvent); + mozilla::WheelEvent* aEvent); void DoScrollHistory(int32_t direction); void DoScrollZoom(nsIFrame *aTargetFrame, int32_t adjustment); @@ -607,7 +607,7 @@ protected: */ void InitLineOrPageDelta(nsIFrame* aTargetFrame, nsEventStateManager* aESM, - mozilla::widget::WheelEvent* aEvent); + mozilla::WheelEvent* aEvent); /** * Reset() resets all members. @@ -619,7 +619,7 @@ protected: * scroll amount in device pixels with mPendingScrollAmount*. */ nsIntPoint ComputeScrollAmountForDefaultAction( - mozilla::widget::WheelEvent* aEvent, + mozilla::WheelEvent* aEvent, const nsIntSize& aScrollAmountInDevPixels); private: @@ -763,7 +763,7 @@ private: // an of an image map this is the image. (bug 289667) nsCOMPtr mGestureDownFrameOwner; // State of keys when the original gesture-down happened - mozilla::widget::Modifiers mGestureModifiers; + mozilla::Modifiers mGestureModifiers; uint16_t mGestureDownButtons; nsCOMPtr mLastLeftMouseDownContent; diff --git a/content/html/content/src/HTMLLabelElement.cpp b/content/html/content/src/HTMLLabelElement.cpp index eb6c72f1887b..ff70a8c71c3d 100644 --- a/content/html/content/src/HTMLLabelElement.cpp +++ b/content/html/content/src/HTMLLabelElement.cpp @@ -194,7 +194,7 @@ HTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor) nsEventStatus status = aVisitor.mEventStatus; // Ok to use aVisitor.mEvent as parameter because DispatchClickEvent // will actually create a new event. - widget::EventFlags eventFlags; + EventFlags eventFlags; eventFlags.mMultipleActionsPrevented = true; DispatchClickEvent(aVisitor.mPresContext, static_cast(aVisitor.mEvent), diff --git a/content/xbl/src/nsXBLPrototypeHandler.cpp b/content/xbl/src/nsXBLPrototypeHandler.cpp index 1973b31f5984..fb2cb84b18b9 100644 --- a/content/xbl/src/nsXBLPrototypeHandler.cpp +++ b/content/xbl/src/nsXBLPrototypeHandler.cpp @@ -550,7 +550,7 @@ nsXBLPrototypeHandler::DispatchXULKeyCommand(nsIDOMEvent* aEvent) return NS_ERROR_FAILURE; } - // XXX We should use widget::Modifiers for supporting all modifiers. + // XXX We should use mozilla::Modifiers for supporting all modifiers. bool isAlt = false; bool isControl = false; diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 31283a5ff02d..62fc01e38367 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -548,42 +548,42 @@ nsDOMWindowUtils::GetPresShellId(uint32_t *aPresShellId) } /* static */ -mozilla::widget::Modifiers +mozilla::Modifiers nsDOMWindowUtils::GetWidgetModifiers(int32_t aModifiers) { - widget::Modifiers result = 0; + Modifiers result = 0; if (aModifiers & nsIDOMWindowUtils::MODIFIER_SHIFT) { - result |= widget::MODIFIER_SHIFT; + result |= mozilla::MODIFIER_SHIFT; } if (aModifiers & nsIDOMWindowUtils::MODIFIER_CONTROL) { - result |= widget::MODIFIER_CONTROL; + result |= mozilla::MODIFIER_CONTROL; } if (aModifiers & nsIDOMWindowUtils::MODIFIER_ALT) { - result |= widget::MODIFIER_ALT; + result |= mozilla::MODIFIER_ALT; } if (aModifiers & nsIDOMWindowUtils::MODIFIER_META) { - result |= widget::MODIFIER_META; + result |= mozilla::MODIFIER_META; } if (aModifiers & nsIDOMWindowUtils::MODIFIER_ALTGRAPH) { - result |= widget::MODIFIER_ALTGRAPH; + result |= mozilla::MODIFIER_ALTGRAPH; } if (aModifiers & nsIDOMWindowUtils::MODIFIER_CAPSLOCK) { - result |= widget::MODIFIER_CAPSLOCK; + result |= mozilla::MODIFIER_CAPSLOCK; } if (aModifiers & nsIDOMWindowUtils::MODIFIER_FN) { - result |= widget::MODIFIER_FN; + result |= mozilla::MODIFIER_FN; } if (aModifiers & nsIDOMWindowUtils::MODIFIER_NUMLOCK) { - result |= widget::MODIFIER_NUMLOCK; + result |= mozilla::MODIFIER_NUMLOCK; } if (aModifiers & nsIDOMWindowUtils::MODIFIER_SCROLLLOCK) { - result |= widget::MODIFIER_SCROLLLOCK; + result |= mozilla::MODIFIER_SCROLLLOCK; } if (aModifiers & nsIDOMWindowUtils::MODIFIER_SYMBOLLOCK) { - result |= widget::MODIFIER_SYMBOLLOCK; + result |= mozilla::MODIFIER_SYMBOLLOCK; } if (aModifiers & nsIDOMWindowUtils::MODIFIER_OS) { - result |= widget::MODIFIER_OS; + result |= mozilla::MODIFIER_OS; } return result; } @@ -762,7 +762,7 @@ nsDOMWindowUtils::SendWheelEvent(float aX, return NS_ERROR_NULL_POINTER; } - widget::WheelEvent wheelEvent(true, NS_WHEEL_WHEEL, widget); + WheelEvent wheelEvent(true, NS_WHEEL_WHEEL, widget); wheelEvent.modifiers = GetWidgetModifiers(aModifiers); wheelEvent.deltaX = aDeltaX; wheelEvent.deltaY = aDeltaY; diff --git a/dom/base/nsDOMWindowUtils.h b/dom/base/nsDOMWindowUtils.h index 1379698cf6a2..f1402aa5c19f 100644 --- a/dom/base/nsDOMWindowUtils.h +++ b/dom/base/nsDOMWindowUtils.h @@ -49,7 +49,7 @@ protected: bool aToWindow, bool *aPreventDefault); - static mozilla::widget::Modifiers GetWidgetModifiers(int32_t aModifiers); + static mozilla::Modifiers GetWidgetModifiers(int32_t aModifiers); }; #endif diff --git a/dom/interfaces/events/nsIDOMEvent.idl b/dom/interfaces/events/nsIDOMEvent.idl index 5ecfcf6ba5ec..63f2f2ab031b 100644 --- a/dom/interfaces/events/nsIDOMEvent.idl +++ b/dom/interfaces/events/nsIDOMEvent.idl @@ -26,9 +26,8 @@ namespace IPC { class Message; } namespace mozilla { -namespace widget { class WheelEvent; -} // namespace widget + namespace dom { class EventTarget; } // namespace dom @@ -261,7 +260,7 @@ nsresult NS_NewDOMWheelEvent(nsIDOMEvent** aInstancePtrResult, mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext, - mozilla::widget::WheelEvent* aEvent); + mozilla::WheelEvent* aEvent); nsresult NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult, mozilla::dom::EventTarget* aOwner, diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index 8dd07ee1919b..9fde7924c99e 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -44,7 +44,7 @@ using nsIntSize; using nsKeyEvent; using nsMouseEvent; using nsMouseScrollEvent; -using mozilla::widget::WheelEvent; +using mozilla::WheelEvent; using nsQueryContentEvent; using nsRect; using nsSelectionEvent; diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 8b4cf02893c1..d25071696280 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -224,7 +224,7 @@ public: const bool& aIgnoreRootScrollFrame); virtual bool RecvRealMouseEvent(const nsMouseEvent& event); virtual bool RecvRealKeyEvent(const nsKeyEvent& event); - virtual bool RecvMouseWheelEvent(const mozilla::widget::WheelEvent& event); + virtual bool RecvMouseWheelEvent(const mozilla::WheelEvent& event); virtual bool RecvRealTouchEvent(const nsTouchEvent& event); virtual bool RecvRealTouchMoveEvent(const nsTouchEvent& event); virtual bool RecvKeyEvent(const nsString& aType, diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index dc2371862b9a..4a326b312483 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -197,7 +197,7 @@ public: int32_t aCharCode, int32_t aModifiers, bool aPreventDefault); bool SendRealMouseEvent(nsMouseEvent& event); - bool SendMouseWheelEvent(mozilla::widget::WheelEvent& event); + bool SendMouseWheelEvent(mozilla::WheelEvent& event); bool SendRealKeyEvent(nsKeyEvent& event); bool SendRealTouchEvent(nsTouchEvent& event); diff --git a/extensions/widgetutils/src/nsWidgetUtils.cpp b/extensions/widgetutils/src/nsWidgetUtils.cpp index f443b43ae145..738fab2599c3 100644 --- a/extensions/widgetutils/src/nsWidgetUtils.cpp +++ b/extensions/widgetutils/src/nsWidgetUtils.cpp @@ -234,7 +234,7 @@ nsWidgetUtils::MouseMove(nsIDOMEvent* aDOMEvent) return NS_OK; nsEventStatus status; - widget::WheelEvent wheelEvent(true, NS_WHEEL_WHEEL, mWidget); + WheelEvent wheelEvent(true, NS_WHEEL_WHEEL, mWidget); wheelEvent.deltaMode = nsIDOMWheelEvent::DOM_DELTA_LINE; wheelEvent.deltaX = wheelEvent.lineOrPageDeltaX = dx; wheelEvent.deltaY = wheelEvent.lineOrPageDeltaY = dy; diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 87af62c84a9a..cf5f7747b460 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -453,7 +453,7 @@ public: nsRefPtr esm = aVisitor.mPresContext->EventStateManager(); esm->DispatchLegacyMouseScrollEvents(frame, - static_cast(aVisitor.mEvent), + static_cast(aVisitor.mEvent), &aVisitor.mEventStatus); } } diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index 2017311f7ad4..8c844460d054 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -1516,7 +1516,7 @@ printf(" * TakeFocus - moving into new cell\n"); // XXXX We need to REALLY get the current key shift state // (we'd need to add event listener -- let's not bother for now) - event.modifiers &= ~widget::MODIFIER_SHIFT; //aContinueSelection; + event.modifiers &= ~MODIFIER_SHIFT; //aContinueSelection; if (parent) { mCellParent = cellparent; diff --git a/layout/xul/base/public/nsXULPopupManager.h b/layout/xul/base/public/nsXULPopupManager.h index eeb53ddab747..ffdd541fe238 100644 --- a/layout/xul/base/public/nsXULPopupManager.h +++ b/layout/xul/base/public/nsXULPopupManager.h @@ -736,7 +736,7 @@ protected: nsIntPoint mCachedMousePoint; // cached modifiers - mozilla::widget::Modifiers mCachedModifiers; + mozilla::Modifiers mCachedModifiers; // set to the currently active menu bar, if any nsMenuBarFrame* mActiveMenuBar; diff --git a/widget/cocoa/TextInputHandler.mm b/widget/cocoa/TextInputHandler.mm index 06276e9f4ea5..6f28566dab3a 100644 --- a/widget/cocoa/TextInputHandler.mm +++ b/widget/cocoa/TextInputHandler.mm @@ -2076,9 +2076,9 @@ TextInputHandler::InsertText(NSAttributedString* aAttrString, // Remove basic modifiers from keypress event because if they are included, // nsPlaintextEditor ignores the event. - keypressEvent.modifiers &= ~(widget::MODIFIER_CONTROL | - widget::MODIFIER_ALT | - widget::MODIFIER_META); + keypressEvent.modifiers &= ~(MODIFIER_CONTROL | + MODIFIER_ALT | + MODIFIER_META); // TODO: // If mCurrentKeyEvent.mKeyEvent is null and when we implement textInput diff --git a/widget/nsEvent.h b/widget/nsEvent.h index 51bfcde5844c..80cea20c3eea 100644 --- a/widget/nsEvent.h +++ b/widget/nsEvent.h @@ -76,7 +76,6 @@ class nsAnimationEvent; class nsPluginEvent; namespace mozilla { -namespace widget { struct EventFlags; @@ -100,21 +99,6 @@ enum Modifier { typedef uint16_t Modifiers; -// NotificationToIME is shared by nsIMEStateManager and TextComposition. -enum NotificationToIME { - // XXX We should replace NOTIFY_IME_OF_CURSOR_POS_CHANGED with - // NOTIFY_IME_OF_SELECTION_CHANGE later. - NOTIFY_IME_OF_CURSOR_POS_CHANGED, - // An editable content is getting focus - NOTIFY_IME_OF_FOCUS, - // An editable content is losing focus - NOTIFY_IME_OF_BLUR, - // Selection in the focused editable content is changed - NOTIFY_IME_OF_SELECTION_CHANGE, - REQUEST_TO_COMMIT_COMPOSITION, - REQUEST_TO_CANCEL_COMPOSITION -}; - #define NS_DEFINE_KEYNAME(aCPPName, aDOMKeyName) \ KEY_NAME_INDEX_##aCPPName, @@ -127,7 +111,6 @@ enum KeyNameIndex { #undef NS_DEFINE_KEYNAME -} // namespace widget } // namespace mozilla #define NS_DOM_KEYNAME_ALT "Alt" diff --git a/widget/nsGUIEvent.h b/widget/nsGUIEvent.h index 3147dd955829..ec8b2f3ce055 100644 --- a/widget/nsGUIEvent.h +++ b/widget/nsGUIEvent.h @@ -58,7 +58,7 @@ enum nsEventStructType { NS_MOUSE_EVENT, // nsMouseEvent NS_MOUSE_SCROLL_EVENT, // nsMouseScrollEvent NS_DRAG_EVENT, // nsDragEvent - NS_WHEEL_EVENT, // widget::WheelEvent + NS_WHEEL_EVENT, // WheelEvent // Touchpad related events NS_GESTURENOTIFY_EVENT, // nsGestureNotifyEvent @@ -491,7 +491,6 @@ enum nsWindowZ { }; namespace mozilla { -namespace widget { // BaseEventFlags must be a POD struct for safe to use memcpy (including // in ParamTraits). So don't make virtual methods, constructor, @@ -591,7 +590,7 @@ private: inline void SetRawFlags(RawFlags aRawFlags) { static_assert(sizeof(BaseEventFlags) <= sizeof(RawFlags), - "mozilla::widget::EventFlags must not be bigger than the RawFlags"); + "mozilla::EventFlags must not be bigger than the RawFlags"); memcpy(this, &aRawFlags, sizeof(BaseEventFlags)); } inline RawFlags GetRawFlags() const @@ -610,7 +609,6 @@ struct EventFlags : public BaseEventFlags } }; -} // namespace widget } // namespace mozilla /** @@ -680,7 +678,7 @@ public: // to the time the message was created uint64_t time; // See BaseEventFlags definition for the detail. - mozilla::widget::BaseEventFlags mFlags; + mozilla::BaseEventFlags mFlags; // Additional type info for user defined events nsCOMPtr userType; @@ -852,62 +850,62 @@ public: // true indicates the shift key is down bool IsShift() const { - return ((modifiers & mozilla::widget::MODIFIER_SHIFT) != 0); + return ((modifiers & mozilla::MODIFIER_SHIFT) != 0); } // true indicates the control key is down bool IsControl() const { - return ((modifiers & mozilla::widget::MODIFIER_CONTROL) != 0); + return ((modifiers & mozilla::MODIFIER_CONTROL) != 0); } // true indicates the alt key is down bool IsAlt() const { - return ((modifiers & mozilla::widget::MODIFIER_ALT) != 0); + return ((modifiers & mozilla::MODIFIER_ALT) != 0); } // true indicates the meta key is down (or, on Mac, the Command key) bool IsMeta() const { - return ((modifiers & mozilla::widget::MODIFIER_META) != 0); + return ((modifiers & mozilla::MODIFIER_META) != 0); } // true indicates the win key is down on Windows. Or the Super or Hyper key // is down on Linux. bool IsOS() const { - return ((modifiers & mozilla::widget::MODIFIER_OS) != 0); + return ((modifiers & mozilla::MODIFIER_OS) != 0); } // true indicates the alt graph key is down // NOTE: on Mac, the option key press causes both IsAlt() and IsAltGrpah() // return true. bool IsAltGraph() const { - return ((modifiers & mozilla::widget::MODIFIER_ALTGRAPH) != 0); + return ((modifiers & mozilla::MODIFIER_ALTGRAPH) != 0); } // true indeicates the CapLock LED is turn on. bool IsCapsLocked() const { - return ((modifiers & mozilla::widget::MODIFIER_CAPSLOCK) != 0); + return ((modifiers & mozilla::MODIFIER_CAPSLOCK) != 0); } // true indeicates the NumLock LED is turn on. bool IsNumLocked() const { - return ((modifiers & mozilla::widget::MODIFIER_NUMLOCK) != 0); + return ((modifiers & mozilla::MODIFIER_NUMLOCK) != 0); } // true indeicates the ScrollLock LED is turn on. bool IsScrollLocked() const { - return ((modifiers & mozilla::widget::MODIFIER_SCROLLLOCK) != 0); + return ((modifiers & mozilla::MODIFIER_SCROLLLOCK) != 0); } // true indeicates the Fn key is down, but this is not supported by native // key event on any platform. bool IsFn() const { - return ((modifiers & mozilla::widget::MODIFIER_FN) != 0); + return ((modifiers & mozilla::MODIFIER_FN) != 0); } // true indeicates the ScrollLock LED is turn on. bool IsSymbolLocked() const { - return ((modifiers & mozilla::widget::MODIFIER_SYMBOLLOCK) != 0); + return ((modifiers & mozilla::MODIFIER_SYMBOLLOCK) != 0); } void InitBasicModifiers(bool aCtrlKey, @@ -917,20 +915,20 @@ public: { modifiers = 0; if (aCtrlKey) { - modifiers |= mozilla::widget::MODIFIER_CONTROL; + modifiers |= mozilla::MODIFIER_CONTROL; } if (aAltKey) { - modifiers |= mozilla::widget::MODIFIER_ALT; + modifiers |= mozilla::MODIFIER_ALT; } if (aShiftKey) { - modifiers |= mozilla::widget::MODIFIER_SHIFT; + modifiers |= mozilla::MODIFIER_SHIFT; } if (aMetaKey) { - modifiers |= mozilla::widget::MODIFIER_META; + modifiers |= mozilla::MODIFIER_META; } } - mozilla::widget::Modifiers modifiers; + mozilla::Modifiers modifiers; void AssignInputEventData(const nsInputEvent& aEvent, bool aCopyTargets) { @@ -1151,7 +1149,7 @@ public: : nsInputEvent(isTrusted, msg, w, NS_KEY_EVENT), keyCode(0), charCode(0), location(nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD), isChar(0), - mKeyNameIndex(mozilla::widget::KEY_NAME_INDEX_Unidentified), + mKeyNameIndex(mozilla::KEY_NAME_INDEX_Unidentified), mNativeKeyEvent(nullptr), mUniqueId(0) { @@ -1169,7 +1167,7 @@ public: // indicates whether the event signifies a printable character bool isChar; // DOM KeyboardEvent.key - mozilla::widget::KeyNameIndex mKeyNameIndex; + mozilla::KeyNameIndex mKeyNameIndex; // OS-specific native event can optionally be preserved void* mNativeKeyEvent; // Unique id associated with a keydown / keypress event. Used in identifing @@ -1183,11 +1181,11 @@ public: GetDOMKeyName(mKeyNameIndex, aKeyName); } - static void GetDOMKeyName(mozilla::widget::KeyNameIndex aKeyNameIndex, + static void GetDOMKeyName(mozilla::KeyNameIndex aKeyNameIndex, nsAString& aKeyName) { #define NS_DEFINE_KEYNAME(aCPPName, aDOMKeyName) \ - case mozilla::widget::KEY_NAME_INDEX_##aCPPName: \ + case mozilla::KEY_NAME_INDEX_##aCPPName: \ aKeyName.Assign(NS_LITERAL_STRING(aDOMKeyName)); return; switch (aKeyNameIndex) { #include "nsDOMKeyNameList.h" @@ -1415,7 +1413,7 @@ public: /** * nsMouseScrollEvent is used for legacy DOM mouse scroll events, i.e., * DOMMouseScroll and MozMousePixelScroll event. These events are NOT hanbled - * by ESM even if widget dispatches them. Use new widget::WheelEvent instead. + * by ESM even if widget dispatches them. Use new WheelEvent instead. */ class nsMouseScrollEvent : public nsMouseEvent_base @@ -1450,7 +1448,6 @@ public: */ namespace mozilla { -namespace widget { class WheelEvent : public nsMouseEvent_base { @@ -1568,7 +1565,6 @@ public: } }; -} // namespace widget } // namespace mozilla /* @@ -2230,8 +2226,8 @@ inline bool NS_IsAllowedToDispatchDOMEvent(nsEvent* aEvent) case NS_WHEEL_EVENT: { // wheel event whose all delta values are zero by user pref applied, it // shouldn't cause a DOM event. - mozilla::widget::WheelEvent* wheelEvent = - static_cast(aEvent); + mozilla::WheelEvent* wheelEvent = + static_cast(aEvent); return wheelEvent->deltaX != 0.0 || wheelEvent->deltaY != 0.0 || wheelEvent->deltaZ != 0.0; } diff --git a/widget/nsGUIEventIPC.h b/widget/nsGUIEventIPC.h index 21eb7742bbed..0e7dadeb7fc6 100644 --- a/widget/nsGUIEventIPC.h +++ b/widget/nsGUIEventIPC.h @@ -15,9 +15,9 @@ namespace IPC { template<> -struct ParamTraits +struct ParamTraits { - typedef mozilla::widget::BaseEventFlags paramType; + typedef mozilla::BaseEventFlags paramType; static void Write(Message* aMsg, const paramType& aParam) { @@ -121,9 +121,9 @@ struct ParamTraits }; template<> -struct ParamTraits +struct ParamTraits { - typedef mozilla::widget::WheelEvent paramType; + typedef mozilla::WheelEvent paramType; static void Write(Message* aMsg, const paramType& aParam) { @@ -160,7 +160,7 @@ struct ParamTraits ReadParam(aMsg, aIter, &aResult->overflowDeltaX) && ReadParam(aMsg, aIter, &aResult->overflowDeltaY); aResult->scrollType = - static_cast(scrollType); + static_cast(scrollType); return rv; } }; @@ -277,7 +277,7 @@ struct ParamTraits ReadParam(aMsg, aIter, &aResult->location) && ReadParam(aMsg, aIter, &aResult->mUniqueId)) { - aResult->mKeyNameIndex = static_cast(keyNameIndex); + aResult->mKeyNameIndex = static_cast(keyNameIndex); aResult->mNativeKeyEvent = NULL; return true; } diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index 8ddced50b5a2..c20d7495c869 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -434,6 +434,21 @@ struct SizeConstraints { nsIntSize mMaxSize; }; +// NotificationToIME is shared by nsIMEStateManager and TextComposition. +enum NotificationToIME { + // XXX We should replace NOTIFY_IME_OF_CURSOR_POS_CHANGED with + // NOTIFY_IME_OF_SELECTION_CHANGE later. + NOTIFY_IME_OF_CURSOR_POS_CHANGED, + // An editable content is getting focus + NOTIFY_IME_OF_FOCUS, + // An editable content is losing focus + NOTIFY_IME_OF_BLUR, + // Selection in the focused editable content is changed + NOTIFY_IME_OF_SELECTION_CHANGE, + REQUEST_TO_COMMIT_COMPOSITION, + REQUEST_TO_CANCEL_COMPOSITION +}; + } // namespace widget } // namespace mozilla diff --git a/widget/os2/nsWindow.cpp b/widget/os2/nsWindow.cpp index fdb79632e2a2..5be7746ec0e1 100644 --- a/widget/os2/nsWindow.cpp +++ b/widget/os2/nsWindow.cpp @@ -2162,9 +2162,9 @@ bool nsWindow::OnMouseChord(MPARAM mp1, MPARAM mp2) event.keyCode = NS_VK_INSERT; if (isCopy) { - event.modifiers = widget::MODIFIER_CONTROL; + event.modifiers = MODIFIER_CONTROL; } else { - event.modifiers = widget::MODIFIER_SHIFT; + event.modifiers = MODIFIER_SHIFT; } event.eventStructType = NS_KEY_EVENT; event.charCode = 0; @@ -2173,13 +2173,13 @@ bool nsWindow::OnMouseChord(MPARAM mp1, MPARAM mp2) if (SHORT1FROMMP(mp1) & (KC_VIRTUALKEY | KC_KEYUP | KC_LONEKEY)) { USHORT usVKey = SHORT2FROMMP(mp2); if (usVKey == VK_SHIFT) { - event.modifiers |= widget::MODIFIER_SHIFT; + event.modifiers |= MODIFIER_SHIFT; } if (usVKey == VK_CTRL) { - event.modifiers |= widget::MODIFIER_CONTROL; + event.modifiers |= MODIFIER_CONTROL; } if (usVKey == VK_ALTGRAF || usVKey == VK_ALT) { - event.modifiers |= widget::MODIFIER_ALT; + event.modifiers |= MODIFIER_ALT; } } diff --git a/widget/qt/nsQtKeyUtils.h b/widget/qt/nsQtKeyUtils.h index 3fcd71107f82..13d203768eb8 100644 --- a/widget/qt/nsQtKeyUtils.h +++ b/widget/qt/nsQtKeyUtils.h @@ -13,6 +13,6 @@ int QtKeyCodeToDOMKeyCode (int aKeysym); int DOMKeyCodeToQtKeyCode (int aKeysym); -mozilla::widget::KeyNameIndex QtKeyCodeToDOMKeyNameIndex(int aKeysym); +mozilla::KeyNameIndex QtKeyCodeToDOMKeyNameIndex(int aKeysym); #endif /* __nsQtKeyUtils_h__ */ diff --git a/widget/qt/nsWindow.cpp b/widget/qt/nsWindow.cpp index 1791e343abcb..837211110163 100644 --- a/widget/qt/nsWindow.cpp +++ b/widget/qt/nsWindow.cpp @@ -168,7 +168,7 @@ InitKeyEvent(nsKeyEvent &aEvent, QKeyEvent *aQEvent) aEvent.time = 0; if (sAltGrModifier) { - aEvent.modifiers |= (widget::MODIFIER_CONTROL | widget::MODIFIER_ALT); + aEvent.modifiers |= (MODIFIER_CONTROL | MODIFIER_ALT); } // The transformations above and in qt for the keyval are not invertible @@ -1684,9 +1684,9 @@ nsWindow::OnKeyPressEvent(QKeyEvent *aEvent) // At that time, we need to reset the modifiers // because nsEditor will not accept a key event // for text input if one or more modifiers are set. - event.modifiers &= ~(widget::MODIFIER_CONTROL | - widget::MODIFIER_ALT | - widget::MODIFIER_META); + event.modifiers &= ~(MODIFIER_CONTROL | + MODIFIER_ALT | + MODIFIER_META); } KeySym keysym = NoSymbol; diff --git a/widget/tests/test_assign_event_data.html b/widget/tests/test_assign_event_data.html index e02ec29e37d6..d3af8406d55f 100644 --- a/widget/tests/test_assign_event_data.html +++ b/widget/tests/test_assign_event_data.html @@ -339,7 +339,7 @@ const kTests = [ }, todoMismatch: [ ], }, - { description: "widget::WheelEvent (wheel, vertical)", + { description: "WheelEvent (wheel, vertical)", targetID: "input-text", eventType: "wheel", dispatchEvent: function () { document.getElementById(this.targetID).value = ""; @@ -351,7 +351,7 @@ const kTests = [ }, todoMismatch: [ ], }, - { description: "widget::WheelEvent (wheel, horizontal)", + { description: "WheelEvent (wheel, horizontal)", targetID: "input-text", eventType: "wheel", dispatchEvent: function () { document.getElementById(this.targetID).value = ""; @@ -363,7 +363,7 @@ const kTests = [ }, todoMismatch: [ ], }, - { description: "widget::WheelEvent (wheel, both)", + { description: "WheelEvent (wheel, both)", targetID: "input-text", eventType: "wheel", dispatchEvent: function () { document.getElementById(this.targetID).value = ""; diff --git a/widget/windows/WinMouseScrollHandler.h b/widget/windows/WinMouseScrollHandler.h index 28a233cfaed7..4a1c857e2c94 100644 --- a/widget/windows/WinMouseScrollHandler.h +++ b/widget/windows/WinMouseScrollHandler.h @@ -9,19 +9,18 @@ #include "nscore.h" #include "nsDebug.h" +#include "nsEvent.h" #include "mozilla/Assertions.h" #include "mozilla/TimeStamp.h" #include class nsWindowBase; -class nsGUIEvent; struct nsIntPoint; namespace mozilla { namespace widget { class ModifierKeyState; -class WheelEvent; struct MSGResult; diff --git a/widget/windows/nsWinGesture.h b/widget/windows/nsWinGesture.h index b7b0053aa1ca..420fa527058b 100644 --- a/widget/windows/nsWinGesture.h +++ b/widget/windows/nsWinGesture.h @@ -211,7 +211,7 @@ public: // Pan processing bool IsPanEvent(LPARAM lParam); bool ProcessPanMessage(HWND hWnd, WPARAM wParam, LPARAM lParam); - bool PanDeltaToPixelScroll(mozilla::widget::WheelEvent& aWheelEvent); + bool PanDeltaToPixelScroll(mozilla::WheelEvent& aWheelEvent); void UpdatePanFeedbackX(HWND hWnd, int32_t scrollOverflow, bool& endFeedback); void UpdatePanFeedbackY(HWND hWnd, int32_t scrollOverflow, bool& endFeedback); void PanFeedbackFinalize(HWND hWnd, bool endFeedback);