From 2abcbf6807dc1f92a82298de3512f92842f8f541 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Sun, 16 Dec 2012 10:26:04 +0900 Subject: [PATCH] Bug 813445 part.8 Remove NS_EVENT_FLAG_SYNTHETIC_TEST_EVENT r=smaug --- content/events/src/TextComposition.cpp | 3 +-- content/events/src/nsIMEStateManager.cpp | 10 +++++----- dom/base/nsDOMWindowUtils.cpp | 6 +++--- layout/base/nsPresShell.cpp | 4 ++-- widget/nsGUIEvent.h | 8 +++----- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/content/events/src/TextComposition.cpp b/content/events/src/TextComposition.cpp index cabfab625f42..bf75f36059ef 100644 --- a/content/events/src/TextComposition.cpp +++ b/content/events/src/TextComposition.cpp @@ -25,8 +25,7 @@ TextComposition::TextComposition(nsPresContext* aPresContext, nsGUIEvent* aEvent) : mPresContext(aPresContext), mNode(aNode), mNativeContext(aEvent->widget->GetInputContext().mNativeIMEContext), - mIsSynthesizedForTests( - (aEvent->flags & NS_EVENT_FLAG_SYNTHETIC_TEST_EVENT) != 0) + mIsSynthesizedForTests(aEvent->mFlags.mIsSynthesizedForTests) { } diff --git a/content/events/src/nsIMEStateManager.cpp b/content/events/src/nsIMEStateManager.cpp index 69a957ab6c3b..75aa6b148fd0 100644 --- a/content/events/src/nsIMEStateManager.cpp +++ b/content/events/src/nsIMEStateManager.cpp @@ -624,7 +624,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification, if (!backup.GetLastData().IsEmpty()) { nsTextEvent textEvent(true, NS_TEXT_TEXT, widget); textEvent.theText = backup.GetLastData(); - textEvent.flags |= NS_EVENT_FLAG_SYNTHETIC_TEST_EVENT; + textEvent.mFlags.mIsSynthesizedForTests = true; widget->DispatchEvent(&textEvent, status); if (widget->Destroyed()) { return NS_OK; @@ -634,7 +634,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification, status = nsEventStatus_eIgnore; nsCompositionEvent endEvent(true, NS_COMPOSITION_END, widget); endEvent.data = backup.GetLastData(); - endEvent.flags |= NS_EVENT_FLAG_SYNTHETIC_TEST_EVENT; + endEvent.mFlags.mIsSynthesizedForTests = true; widget->DispatchEvent(&endEvent, status); return NS_OK; @@ -647,7 +647,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification, if (!backup.GetLastData().IsEmpty()) { nsCompositionEvent updateEvent(true, NS_COMPOSITION_UPDATE, widget); updateEvent.data = backup.GetLastData(); - updateEvent.flags |= NS_EVENT_FLAG_SYNTHETIC_TEST_EVENT; + updateEvent.mFlags.mIsSynthesizedForTests = true; widget->DispatchEvent(&updateEvent, status); if (widget->Destroyed()) { return NS_OK; @@ -656,7 +656,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification, status = nsEventStatus_eIgnore; nsTextEvent textEvent(true, NS_TEXT_TEXT, widget); textEvent.theText = backup.GetLastData(); - textEvent.flags |= NS_EVENT_FLAG_SYNTHETIC_TEST_EVENT; + textEvent.mFlags.mIsSynthesizedForTests = true; widget->DispatchEvent(&textEvent, status); if (widget->Destroyed()) { return NS_OK; @@ -666,7 +666,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification, status = nsEventStatus_eIgnore; nsCompositionEvent endEvent(true, NS_COMPOSITION_END, widget); endEvent.data = backup.GetLastData(); - endEvent.flags |= NS_EVENT_FLAG_SYNTHETIC_TEST_EVENT; + endEvent.mFlags.mIsSynthesizedForTests = true; widget->DispatchEvent(&endEvent, status); return NS_OK; diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index f9975376c6b4..db0afa09259f 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -647,7 +647,7 @@ nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType, event.inputSource = aInputSourceArg; event.clickCount = aClickCount; event.time = PR_IntervalNow(); - event.flags |= NS_EVENT_FLAG_SYNTHETIC_TEST_EVENT; + event.mFlags.mIsSynthesizedForTests = true; nsPresContext* presContext = GetPresContext(); if (!presContext) @@ -1654,7 +1654,7 @@ nsDOMWindowUtils::SendCompositionEvent(const nsAString& aType, compositionEvent.data = aData; } - compositionEvent.flags |= NS_EVENT_FLAG_SYNTHETIC_TEST_EVENT; + compositionEvent.mFlags.mIsSynthesizedForTests = true; nsEventStatus status; nsresult rv = widget->DispatchEvent(&compositionEvent, status); @@ -1733,7 +1733,7 @@ nsDOMWindowUtils::SendTextEvent(const nsAString& aCompositionString, textEvent.rangeCount = textRanges.Length(); textEvent.rangeArray = textRanges.Elements(); - textEvent.flags |= NS_EVENT_FLAG_SYNTHETIC_TEST_EVENT; + textEvent.mFlags.mIsSynthesizedForTests = true; nsEventStatus status; nsresult rv = widget->DispatchEvent(&textEvent, status); diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index c271c454ba2c..340d6c2d9c55 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -5700,8 +5700,8 @@ PresShell::HandleEvent(nsIFrame *aFrame, NS_ASSERTION(aFrame, "null frame"); if (mIsDestroying || - (sDisableNonTestMouseEvents && NS_IS_MOUSE_EVENT(aEvent) && - !(aEvent->flags & NS_EVENT_FLAG_SYNTHETIC_TEST_EVENT))) { + (sDisableNonTestMouseEvents && !aEvent->mFlags.mIsSynthesizedForTests && + NS_IS_MOUSE_EVENT(aEvent))) { return NS_OK; } diff --git a/widget/nsGUIEvent.h b/widget/nsGUIEvent.h index b9d2e4f9d3c7..672a98d6261b 100644 --- a/widget/nsGUIEvent.h +++ b/widget/nsGUIEvent.h @@ -114,11 +114,6 @@ enum nsEventStructType { #define NS_PRIV_EVENT_FLAG_SCRIPT 0x0080 #define NS_EVENT_FLAG_NO_CONTENT_DISPATCH 0x0100 #define NS_EVENT_FLAG_SYSTEM_EVENT 0x0200 -// When an event is synthesized for testing, this flag will be set. -// Note that this is currently used only with mouse events, because this -// flag is not needed on other events now. It could be added to other -// events. -#define NS_EVENT_FLAG_SYNTHETIC_TEST_EVENT 0x1000 // Use this flag if the event should be dispatched only to chrome. #define NS_EVENT_FLAG_ONLY_CHROME_DISPATCH 0x2000 @@ -541,6 +536,9 @@ public: // If mDispatchedAtLeastOnce is true, the event has been dispatched // as a DOM event and the dispatch has been completed. bool mDispatchedAtLeastOnce : 1; + // If mIsSynthesizedForTests is true, the event has been synthesized for + // automated tests or something hacky approach of an add-on. + bool mIsSynthesizedForTests : 1; // If the event is being handled in target phase, returns true. bool InTargetPhase() const