Bug 813445 part.8 Remove NS_EVENT_FLAG_SYNTHETIC_TEST_EVENT r=smaug

This commit is contained in:
Masayuki Nakano 2012-12-16 10:26:04 +09:00
Родитель 9b94c5f42c
Коммит 2abcbf6807
5 изменённых файлов: 14 добавлений и 17 удалений

Просмотреть файл

@ -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)
{
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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