mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 517844 - nsDOMEvent::GetType could cache the return value, r=jst
This commit is contained in:
parent
572d40007e
commit
63b621774f
@ -235,15 +235,21 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
// nsIDOMEventInterface
|
||||
NS_METHOD nsDOMEvent::GetType(nsAString& aType)
|
||||
{
|
||||
if (!mCachedType.IsEmpty()) {
|
||||
aType = mCachedType;
|
||||
return NS_OK;
|
||||
}
|
||||
const char* name = GetEventName(mEvent->message);
|
||||
|
||||
if (name) {
|
||||
CopyASCIItoUTF16(name, aType);
|
||||
mCachedType = aType;
|
||||
return NS_OK;
|
||||
} else if (mEvent->message == NS_USER_DEFINED_EVENT && mEvent->userType) {
|
||||
nsAutoString name;
|
||||
mEvent->userType->ToString(name);
|
||||
aType = Substring(name, 2, name.Length() - 2); // Remove "on"
|
||||
mCachedType = aType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -724,7 +730,7 @@ nsDOMEvent::InitEvent(const nsAString& aEventTypeArg, PRBool aCanBubbleArg, PRBo
|
||||
// re-dispatching it.
|
||||
mEvent->target = nsnull;
|
||||
mEvent->originalTarget = nsnull;
|
||||
|
||||
mCachedType = aEventTypeArg;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -212,6 +212,7 @@ protected:
|
||||
nsCOMPtr<nsPresContext> mPresContext;
|
||||
nsCOMPtr<nsIDOMEventTarget> mTmpRealOriginalTarget;
|
||||
nsCOMPtr<nsIDOMEventTarget> mExplicitOriginalTarget;
|
||||
nsString mCachedType;
|
||||
PRPackedBool mEventIsInternal;
|
||||
PRPackedBool mPrivateDataDuplicated;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user