зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1153603 - SMIL/SVG event type-> Event Handler mapping shouldn't affect to Event.type. r=heycam
This commit is contained in:
Родитель
e7621cdf36
Коммит
bc7f0bf231
|
@ -639,6 +639,22 @@ nsContentUtils::InitializeModifierStrings()
|
|||
sModifierSeparator = new nsString(modifierSeparator);
|
||||
}
|
||||
|
||||
// Because of SVG/SMIL we have several atoms mapped to the same
|
||||
// id, but we can rely on ID_TO_EVENT to map id to only one atom.
|
||||
static bool
|
||||
ShouldAddEventToStringEventTable(const EventNameMapping& aMapping)
|
||||
{
|
||||
switch(aMapping.mId) {
|
||||
#define ID_TO_EVENT(name_, id_, type_, struct_) \
|
||||
case id_: return nsGkAtoms::on##name_ == aMapping.mAtom;
|
||||
#include "mozilla/EventNameList.h"
|
||||
#undef ID_TO_EVENT
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
nsContentUtils::InitializeEventTable() {
|
||||
NS_ASSERTION(!sAtomEventTable, "EventTable already initialized!");
|
||||
|
@ -651,6 +667,7 @@ nsContentUtils::InitializeEventTable() {
|
|||
#define NON_IDL_EVENT EVENT
|
||||
#include "mozilla/EventNameList.h"
|
||||
#undef WINDOW_ONLY_EVENT
|
||||
#undef NON_IDL_EVENT
|
||||
#undef EVENT
|
||||
{ nullptr }
|
||||
};
|
||||
|
@ -664,8 +681,11 @@ nsContentUtils::InitializeEventTable() {
|
|||
// Subtract one from the length because of the trailing null
|
||||
for (uint32_t i = 0; i < ArrayLength(eventArray) - 1; ++i) {
|
||||
sAtomEventTable->Put(eventArray[i].mAtom, eventArray[i]);
|
||||
sStringEventTable->Put(Substring(nsDependentAtomString(eventArray[i].mAtom), 2),
|
||||
eventArray[i]);
|
||||
if (ShouldAddEventToStringEventTable(eventArray[i])) {
|
||||
sStringEventTable->Put(
|
||||
Substring(nsDependentAtomString(eventArray[i].mAtom), 2),
|
||||
eventArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -287,6 +287,13 @@ gAnim.addEventListener("beginEvent", handleOnBegin, false);
|
|||
gAnim.addEventListener("repeatEvent", handleOnRepeat, false);
|
||||
gAnim.addEventListener("endEvent", handleOnEnd, false);
|
||||
gCircle.addEventListener("beginEvent", parentHandler, false);
|
||||
|
||||
var expectedEvents =
|
||||
["begin", "beginEvent", "repeat", "repeatEvent", "end", "endEvent", "SVGZoom", "zoom"];
|
||||
|
||||
for (var i = 0; i < expectedEvents.length; ++i) {
|
||||
is((new Event(expectedEvents[i])).type, expectedEvents[i], "Unexpected event type!");
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
</pre>
|
||||
|
|
Загрузка…
Ссылка в новой задаче