Bug 895274 part.69 Rename NS_FOCUS_CONTENT to eFocus r=smaug

This commit is contained in:
Masayuki Nakano 2015-09-02 15:08:00 +09:00
Родитель 38f15ff8af
Коммит cc5db3b160
15 изменённых файлов: 35 добавлений и 42 удалений

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

@ -2869,7 +2869,7 @@ Element::PreHandleEventForLinks(EventChainPreVisitor& aVisitor)
// IMPORTANT: this switch and the switch below it must be kept in sync!
switch (aVisitor.mEvent->mMessage) {
case eMouseOver:
case NS_FOCUS_CONTENT:
case eFocus:
case eMouseOut:
case NS_BLUR_CONTENT:
break;
@ -2892,7 +2892,7 @@ Element::PreHandleEventForLinks(EventChainPreVisitor& aVisitor)
case eMouseOver:
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
// FALL THROUGH
case NS_FOCUS_CONTENT: {
case eFocus: {
InternalFocusEvent* focusEvent = aVisitor.mEvent->AsFocusEvent();
if (!focusEvent || !focusEvent->isRefocus) {
nsAutoString target;

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

@ -1857,10 +1857,10 @@ nsFocusManager::Focus(nsPIDOMWindow* aWindow,
GetFocusMoveActionCause(aFlags));
}
if (doc)
SendFocusOrBlurEvent(NS_FOCUS_CONTENT, presShell, doc,
SendFocusOrBlurEvent(eFocus, presShell, doc,
doc, aFlags & FOCUSMETHOD_MASK, aWindowRaised);
if (mFocusedWindow == aWindow && mFocusedContent == nullptr)
SendFocusOrBlurEvent(NS_FOCUS_CONTENT, presShell, doc,
SendFocusOrBlurEvent(eFocus, presShell, doc,
aWindow, aFlags & FOCUSMETHOD_MASK, aWindowRaised);
}
@ -1908,7 +1908,7 @@ nsFocusManager::Focus(nsPIDOMWindow* aWindow,
if (!aWindowRaised)
aWindow->UpdateCommands(NS_LITERAL_STRING("focus"), nullptr, 0);
SendFocusOrBlurEvent(NS_FOCUS_CONTENT, presShell,
SendFocusOrBlurEvent(eFocus, presShell,
aContent->GetComposedDoc(),
aContent, aFlags & FOCUSMETHOD_MASK,
aWindowRaised, isRefocus);
@ -2001,7 +2001,7 @@ nsFocusManager::SendFocusOrBlurEvent(EventMessage aEventMessage,
bool aWindowRaised,
bool aIsRefocus)
{
NS_ASSERTION(aEventMessage == NS_FOCUS_CONTENT ||
NS_ASSERTION(aEventMessage == eFocus ||
aEventMessage == NS_BLUR_CONTENT,
"Wrong event type for SendFocusOrBlurEvent");
@ -2042,7 +2042,7 @@ nsFocusManager::SendFocusOrBlurEvent(EventMessage aEventMessage,
#ifdef ACCESSIBILITY
nsAccessibilityService* accService = GetAccService();
if (accService) {
if (aEventMessage == NS_FOCUS_CONTENT) {
if (aEventMessage == eFocus) {
accService->NotifyOfDOMFocus(aTarget);
} else {
accService->NotifyOfDOMBlur(aTarget);

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

@ -280,7 +280,7 @@ protected:
/**
* Fires a focus or blur event at aTarget.
*
* aEventMessage should be either NS_FOCUS_CONTENT or NS_BLUR_CONTENT.
* aEventMessage should be either eFocus or NS_BLUR_CONTENT.
* For blur events, aFocusMethod should normally be non-zero.
*
* aWindowRaised should only be true if called from WindowRaised.

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

@ -452,7 +452,7 @@ ERROR_EVENT(error,
EventNameType_All,
eBasicEventClass)
FORWARDED_EVENT(focus,
NS_FOCUS_CONTENT,
eFocus,
EventNameType_HTMLXUL,
eFocusEventClass)
FORWARDED_EVENT(load,

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

@ -4610,8 +4610,7 @@ already_AddRefed<nsIContent>
EventStateManager::GetEventTargetContent(WidgetEvent* aEvent)
{
if (aEvent &&
(aEvent->mMessage == NS_FOCUS_CONTENT ||
aEvent->mMessage == NS_BLUR_CONTENT)) {
(aEvent->mMessage == eFocus || aEvent->mMessage == NS_BLUR_CONTENT)) {
nsCOMPtr<nsIContent> content = GetFocusedContent();
return content.forget();
}

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

@ -17,7 +17,7 @@ FocusEvent::FocusEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalFocusEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent : new InternalFocusEvent(false, NS_FOCUS_CONTENT))
aEvent ? aEvent : new InternalFocusEvent(false, eFocus))
{
if (aEvent) {
mEventIsInternal = false;

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

@ -3177,7 +3177,7 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
}
if (mType == NS_FORM_INPUT_RANGE &&
(aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT ||
(aVisitor.mEvent->mMessage == eFocus ||
aVisitor.mEvent->mMessage == NS_BLUR_CONTENT)) {
// Just as nsGenericHTMLFormElementWithState::PreHandleEvent calls
// nsIFormControlFrame::SetFocus, we handle focus here.
@ -3231,9 +3231,9 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
StopNumberControlSpinnerSpin();
}
}
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT ||
if (aVisitor.mEvent->mMessage == eFocus ||
aVisitor.mEvent->mMessage == NS_BLUR_CONTENT) {
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT) {
if (aVisitor.mEvent->mMessage == eFocus) {
// Tell our frame it's getting focus so that it can make sure focus
// is moved to our anonymous text control.
nsNumberControlFrame* numberControlFrame =
@ -3587,9 +3587,9 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
return MaybeInitPickers(aVisitor);
}
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT ||
if (aVisitor.mEvent->mMessage == eFocus ||
aVisitor.mEvent->mMessage == NS_BLUR_CONTENT) {
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT &&
if (aVisitor.mEvent->mMessage == eFocus &&
MayFireChangeOnBlur() &&
!mIsDraggingRange) { // StartRangeThumbDrag already set mFocusedValue
GetValue(mFocusedValue);
@ -3603,7 +3603,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
}
}
UpdateValidityUIBits(aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT);
UpdateValidityUIBits(aVisitor.mEvent->mMessage == eFocus);
UpdateState(true);
}
@ -3745,9 +3745,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
}
} else if (nsEventStatus_eIgnore == aVisitor.mEventStatus) {
switch (aVisitor.mEvent->mMessage) {
case NS_FOCUS_CONTENT:
{
case eFocus: {
// see if we should select the contents of the textbox. This happens
// for text and password fields when the field was focused by the
// keyboard or a navigation, the platform allows it, and it wasn't

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

@ -216,7 +216,7 @@ HTMLObjectElement::HandleFocusBlurPlugin(Element* aElement,
return;
}
switch (aEvent->mMessage) {
case NS_FOCUS_CONTENT: {
case eFocus: {
OnFocusBlurPlugin(aElement, true);
break;
}

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

@ -1511,7 +1511,7 @@ HTMLSelectElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
nsresult
HTMLSelectElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
{
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT) {
if (aVisitor.mEvent->mMessage == eFocus) {
// If the invalid UI is shown, we should show it while focused and
// update the invalid/valid UI.
mCanShowInvalidUI = !IsValid() && ShouldShowValidityUI();

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

@ -538,9 +538,9 @@ HTMLTextAreaElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
mHandlingSelect = false;
}
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT ||
if (aVisitor.mEvent->mMessage == eFocus ||
aVisitor.mEvent->mMessage == NS_BLUR_CONTENT) {
if (aVisitor.mEvent->mMessage == NS_FOCUS_CONTENT) {
if (aVisitor.mEvent->mMessage == eFocus) {
// If the invalid UI is shown, we should show it while focusing (and
// update). Otherwise, we should not.
GetValueInternal(mFocusedValue, true);

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

@ -2251,8 +2251,7 @@ nsGenericHTMLFormElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
{
if (aVisitor.mEvent->mFlags.mIsTrusted) {
switch (aVisitor.mEvent->mMessage) {
case NS_FOCUS_CONTENT:
{
case eFocus: {
// Check to see if focus has bubbled up from a form control's
// child textfield or button. If that's the case, don't focus
// this parent file control -- leave focus on the child.

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

@ -1830,7 +1830,7 @@ CocoaEventTypeForEvent(const WidgetGUIEvent& anEvent, nsIFrame* aObjectFrame)
return NPCocoaEventKeyDown;
case eKeyUp:
return NPCocoaEventKeyUp;
case NS_FOCUS_CONTENT:
case eFocus:
case NS_BLUR_CONTENT:
return NPCocoaEventFocusChanged;
case NS_MOUSE_SCROLL:
@ -1935,9 +1935,9 @@ TranslateToNPCocoaEvent(WidgetGUIEvent* anEvent, nsIFrame* aObjectFrame)
}
break;
}
case NS_FOCUS_CONTENT:
case eFocus:
case NS_BLUR_CONTENT:
cocoaEvent.data.focus.hasFocus = (anEvent->mMessage == NS_FOCUS_CONTENT);
cocoaEvent.data.focus.hasFocus = (anEvent->mMessage == eFocus);
break;
default:
break;
@ -1985,8 +1985,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
// it focus. This might happen if it has focus, its window is blurred, then the
// window is made active again. The plugin never lost in-window focus, so it
// shouldn't get a focus event again.
if (anEvent.mMessage == NS_FOCUS_CONTENT &&
mLastContentFocused == true) {
if (anEvent.mMessage == eFocus && mLastContentFocused == true) {
mShouldBlurOnActivate = false;
return nsEventStatus_eIgnore;
}
@ -1994,9 +1993,8 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
// Now, if we're going to send a focus event, update mLastContentFocused and
// tell any plugins in our window that we have taken focus, so they should
// perform any delayed blurs.
if (anEvent.mMessage == NS_FOCUS_CONTENT ||
anEvent.mMessage == NS_BLUR_CONTENT) {
mLastContentFocused = (anEvent.mMessage == NS_FOCUS_CONTENT);
if (anEvent.mMessage == eFocus || anEvent.mMessage == NS_BLUR_CONTENT) {
mLastContentFocused = (anEvent.mMessage == eFocus);
mShouldBlurOnActivate = false;
PerformDelayedBlurs();
}
@ -2123,7 +2121,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
}
else if (!pPluginEvent) {
switch (anEvent.mMessage) {
case NS_FOCUS_CONTENT:
case eFocus:
pluginEvent.event = WM_SETFOCUS;
pluginEvent.wParam = 0;
pluginEvent.lParam = 0;
@ -2322,12 +2320,11 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
default:
switch (anEvent.mMessage) {
case NS_FOCUS_CONTENT:
case eFocus:
case NS_BLUR_CONTENT:
{
XFocusChangeEvent &event = pluginEvent.xfocus;
event.type =
anEvent.mMessage == NS_FOCUS_CONTENT ? FocusIn : FocusOut;
event.type = anEvent.mMessage == eFocus ? FocusIn : FocusOut;
// information lost:
event.mode = -1;
event.detail = NotifyDetailNone;

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

@ -454,7 +454,7 @@ nsEditorEventListener::HandleEvent(nsIDOMEvent* aEvent)
return MouseClick(mouseEvent);
}
// focus
case NS_FOCUS_CONTENT:
case eFocus:
return Focus(aEvent);
// blur
case NS_BLUR_CONTENT:

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

@ -98,7 +98,7 @@ NS_EVENT_MESSAGE(eFormInvalid, eFormEventFirst + 4)
//Need separate focus/blur notifications for non-native widgets
NS_EVENT_MESSAGE(eFocusEventFirst, 1300)
NS_EVENT_MESSAGE(NS_FOCUS_CONTENT, eFocusEventFirst)
NS_EVENT_MESSAGE(eFocus, eFocusEventFirst)
NS_EVENT_MESSAGE(NS_BLUR_CONTENT, eFocusEventFirst + 1)
NS_EVENT_MESSAGE(NS_DRAGDROP_EVENT_START, 1400)

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

@ -2638,7 +2638,7 @@ case _value: eventName.AssignLiteral(_name) ; break
_ASSIGN_eventName(NS_DRAGDROP_EXIT,"NS_DND_EXIT");
_ASSIGN_eventName(NS_DRAGDROP_OVER,"NS_DND_OVER");
_ASSIGN_eventName(NS_EDITOR_INPUT,"NS_EDITOR_INPUT");
_ASSIGN_eventName(NS_FOCUS_CONTENT,"NS_FOCUS_CONTENT");
_ASSIGN_eventName(eFocus,"eFocus");
_ASSIGN_eventName(eFormSelect,"eFormSelect");
_ASSIGN_eventName(eFormChange,"eFormChange");
_ASSIGN_eventName(eFormReset,"eFormReset");