Bug 920425 part.9 Use mozilla::WidgetEvent::AsFocusEvent() r=smaug

This commit is contained in:
Masayuki Nakano 2013-10-18 15:10:22 +09:00
parent abc75d0db8
commit e34be405d1
5 changed files with 11 additions and 13 deletions

View File

@ -2168,9 +2168,9 @@ Element::PreHandleEventForLinks(nsEventChainPreVisitor& aVisitor)
case NS_MOUSE_ENTER_SYNTH:
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
// FALL THROUGH
case NS_FOCUS_CONTENT:
if (aVisitor.mEvent->eventStructType != NS_FOCUS_EVENT ||
!static_cast<InternalFocusEvent*>(aVisitor.mEvent)->isRefocus) {
case NS_FOCUS_CONTENT: {
InternalFocusEvent* focusEvent = aVisitor.mEvent->AsFocusEvent();
if (!focusEvent || !focusEvent->isRefocus) {
nsAutoString target;
GetLinkTarget(target);
nsContentUtils::TriggerLink(this, aVisitor.mPresContext, absURI, target,
@ -2179,7 +2179,7 @@ Element::PreHandleEventForLinks(nsEventChainPreVisitor& aVisitor)
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
}
break;
}
case NS_MOUSE_EXIT_SYNTH:
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
// FALL THROUGH

View File

@ -159,7 +159,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMEvent)
nullptr;
break;
case NS_FOCUS_EVENT:
static_cast<InternalFocusEvent*>(tmp->mEvent)->relatedTarget = nullptr;
tmp->mEvent->AsFocusEvent()->relatedTarget = nullptr;
break;
default:
break;
@ -204,8 +204,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEvent)
break;
case NS_FOCUS_EVENT:
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget");
cb.NoteXPCOMChild(
static_cast<InternalFocusEvent*>(tmp->mEvent)->relatedTarget);
cb.NoteXPCOMChild(tmp->mEvent->AsFocusEvent()->relatedTarget);
break;
default:
break;
@ -657,8 +656,7 @@ nsDOMEvent::DuplicatePrivateData()
case NS_FOCUS_EVENT:
{
InternalFocusEvent* newFocusEvent = new InternalFocusEvent(false, msg);
InternalFocusEvent* oldFocusEvent =
static_cast<InternalFocusEvent*>(mEvent);
InternalFocusEvent* oldFocusEvent = mEvent->AsFocusEvent();
newFocusEvent->AssignFocusEventData(*oldFocusEvent, true);
newEvent = newFocusEvent;
break;

View File

@ -39,7 +39,7 @@ nsDOMFocusEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
mozilla::dom::EventTarget*
nsDOMFocusEvent::GetRelatedTarget()
{
return static_cast<InternalFocusEvent*>(mEvent)->relatedTarget;
return mEvent->AsFocusEvent()->relatedTarget;
}
nsresult
@ -52,7 +52,7 @@ nsDOMFocusEvent::InitFocusEvent(const nsAString& aType,
{
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
NS_ENSURE_SUCCESS(rv, rv);
static_cast<InternalFocusEvent*>(mEvent)->relatedTarget = aRelatedTarget;
mEvent->AsFocusEvent()->relatedTarget = aRelatedTarget;
return NS_OK;
}

View File

@ -713,7 +713,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
static_cast<WidgetInputEvent*>(aEvent));
case NS_FOCUS_EVENT:
return NS_NewDOMFocusEvent(aDOMEvent, aOwner, aPresContext,
static_cast<InternalFocusEvent*>(aEvent));
aEvent->AsFocusEvent());
case NS_MOUSE_SCROLL_EVENT:
return NS_NewDOMMouseScrollEvent(aDOMEvent, aOwner, aPresContext,
static_cast<WidgetInputEvent*>(aEvent));

View File

@ -3487,7 +3487,7 @@ HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
// just because we raised a window.
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm && IsSingleLineTextControl(false) &&
!(static_cast<InternalFocusEvent*>(aVisitor.mEvent))->fromRaise &&
!aVisitor.mEvent->AsFocusEvent()->fromRaise &&
SelectTextFieldOnFocus()) {
nsIDocument* document = GetCurrentDoc();
if (document) {