Bug 920377 part.7 Get rid of nsFocusEvent r=roc

This commit is contained in:
Masayuki Nakano 2013-09-27 15:20:55 +09:00
parent 6a38167904
commit 622f0b4ed3
10 changed files with 21 additions and 20 deletions

View File

@ -2138,7 +2138,7 @@ Element::PreHandleEventForLinks(nsEventChainPreVisitor& aVisitor)
// FALL THROUGH
case NS_FOCUS_CONTENT:
if (aVisitor.mEvent->eventStructType != NS_FOCUS_EVENT ||
!static_cast<nsFocusEvent*>(aVisitor.mEvent)->isRefocus) {
!static_cast<InternalFocusEvent*>(aVisitor.mEvent)->isRefocus) {
nsAutoString target;
GetLinkTarget(target);
nsContentUtils::TriggerLink(this, aVisitor.mPresContext, absURI, target,

View File

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

View File

@ -13,10 +13,11 @@ using namespace mozilla::dom;
NS_IMPL_ISUPPORTS_INHERITED1(nsDOMFocusEvent, nsDOMUIEvent, nsIDOMFocusEvent)
nsDOMFocusEvent::nsDOMFocusEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext, nsFocusEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext, aEvent ?
static_cast<nsGUIEvent*>(aEvent) :
static_cast<nsGUIEvent*>(new nsFocusEvent(false, NS_FOCUS_CONTENT)))
nsPresContext* aPresContext,
InternalFocusEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new InternalFocusEvent(false, NS_FOCUS_CONTENT))
{
if (aEvent) {
mEventIsInternal = false;
@ -29,7 +30,7 @@ nsDOMFocusEvent::nsDOMFocusEvent(mozilla::dom::EventTarget* aOwner,
nsDOMFocusEvent::~nsDOMFocusEvent()
{
if (mEventIsInternal && mEvent) {
delete static_cast<nsFocusEvent*>(mEvent);
delete static_cast<InternalFocusEvent*>(mEvent);
mEvent = nullptr;
}
}
@ -46,7 +47,7 @@ nsDOMFocusEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
mozilla::dom::EventTarget*
nsDOMFocusEvent::GetRelatedTarget()
{
return static_cast<nsFocusEvent*>(mEvent)->relatedTarget;
return static_cast<InternalFocusEvent*>(mEvent)->relatedTarget;
}
nsresult
@ -59,7 +60,7 @@ nsDOMFocusEvent::InitFocusEvent(const nsAString& aType,
{
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
NS_ENSURE_SUCCESS(rv, rv);
static_cast<nsFocusEvent*>(mEvent)->relatedTarget = aRelatedTarget;
static_cast<InternalFocusEvent*>(mEvent)->relatedTarget = aRelatedTarget;
return NS_OK;
}
@ -81,7 +82,7 @@ nsDOMFocusEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
nsresult NS_NewDOMFocusEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsFocusEvent* aEvent)
InternalFocusEvent* aEvent)
{
nsDOMFocusEvent* it = new nsDOMFocusEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(it, aInstancePtrResult);

View File

@ -27,7 +27,8 @@ public:
}
nsDOMFocusEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext, nsFocusEvent* aEvent);
nsPresContext* aPresContext,
mozilla::InternalFocusEvent* aEvent);
mozilla::dom::EventTarget* GetRelatedTarget();

View File

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

View File

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

View File

@ -1852,7 +1852,7 @@ public:
NS_IMETHOD Run()
{
nsFocusEvent event(true, mType);
InternalFocusEvent event(true, mType);
event.mFlags.mBubbles = false;
event.fromRaise = mWindowRaised;
event.isRefocus = mIsRefocus;

View File

@ -247,7 +247,7 @@ nsresult
NS_NewDOMFocusEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsFocusEvent* aEvent);
mozilla::InternalFocusEvent* aEvent);
nsresult
NS_NewDOMMouseScrollEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,

View File

@ -253,6 +253,5 @@ typedef mozilla::InternalScrollPortEvent nsScrollPortEvent;
typedef mozilla::InternalScrollAreaEvent nsScrollAreaEvent;
typedef mozilla::InternalFormEvent nsFormEvent;
typedef mozilla::InternalClipboardEvent nsClipboardEvent;
typedef mozilla::InternalFocusEvent nsFocusEvent;
#endif // mozilla_ContentEvents_h__

View File

@ -133,6 +133,5 @@ typedef mozilla::InternalScrollPortEvent nsScrollPortEvent;
typedef mozilla::InternalScrollAreaEvent nsScrollAreaEvent;
typedef mozilla::InternalFormEvent nsFormEvent;
typedef mozilla::InternalClipboardEvent nsClipboardEvent;
typedef mozilla::InternalFocusEvent nsFocusEvent;
#endif // mozilla_EventForwards_h__