OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. |
5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 { | 209 { |
210 if (!attrName.namespaceURI().isNull()) | 210 if (!attrName.namespaceURI().isNull()) |
211 return nullAtom; | 211 return nullAtom; |
212 | 212 |
213 if (!attrName.localName().startsWith("on", false)) | 213 if (!attrName.localName().startsWith("on", false)) |
214 return nullAtom; | 214 return nullAtom; |
215 | 215 |
216 typedef HashMap<AtomicString, AtomicString> StringToStringMap; | 216 typedef HashMap<AtomicString, AtomicString> StringToStringMap; |
217 DEFINE_STATIC_LOCAL(StringToStringMap, attributeNameToEventNameMap, ()); | 217 DEFINE_STATIC_LOCAL(StringToStringMap, attributeNameToEventNameMap, ()); |
218 if (!attributeNameToEventNameMap.size()) { | 218 if (!attributeNameToEventNameMap.size()) { |
219 attributeNameToEventNameMap.set(onabortAttr.localName(), EventTypeNames: :abort); | 219 struct AttrToEventName { |
220 attributeNameToEventNameMap.set(onanimationendAttr.localName(), EventTyp eNames::animationend); | 220 const QualifiedName& attr; |
221 attributeNameToEventNameMap.set(onanimationiterationAttr.localName(), Ev entTypeNames::animationiteration); | 221 const AtomicString& event; |
222 attributeNameToEventNameMap.set(onanimationstartAttr.localName(), EventT ypeNames::animationstart); | 222 }; |
223 attributeNameToEventNameMap.set(onautocompleteAttr.localName(), EventTyp eNames::autocomplete); | 223 AttrToEventName attrToEventNames[] = { |
224 attributeNameToEventNameMap.set(onautocompleteerrorAttr.localName(), Eve ntTypeNames::autocompleteerror); | 224 { onabortAttr, EventTypeNames::abort}, |
pdr.
2014/09/26 04:07:15
Nit: add a space before the curly braces.
Daniel Bratell
2014/09/26 08:10:51
Done.
| |
225 attributeNameToEventNameMap.set(onbeforecopyAttr.localName(), EventTypeN ames::beforecopy); | 225 { onanimationendAttr, EventTypeNames::animationend}, |
226 attributeNameToEventNameMap.set(onbeforecutAttr.localName(), EventTypeNa mes::beforecut); | 226 { onanimationiterationAttr, EventTypeNames::animationiteration}, |
227 attributeNameToEventNameMap.set(onbeforepasteAttr.localName(), EventType Names::beforepaste); | 227 { onanimationstartAttr, EventTypeNames::animationstart}, |
228 attributeNameToEventNameMap.set(onblurAttr.localName(), EventTypeNames:: blur); | 228 { onautocompleteAttr, EventTypeNames::autocomplete}, |
229 attributeNameToEventNameMap.set(oncancelAttr.localName(), EventTypeNames ::cancel); | 229 { onautocompleteerrorAttr, EventTypeNames::autocompleteerror}, |
230 attributeNameToEventNameMap.set(oncanplayAttr.localName(), EventTypeName s::canplay); | 230 { onbeforecopyAttr, EventTypeNames::beforecopy}, |
231 attributeNameToEventNameMap.set(oncanplaythroughAttr.localName(), EventT ypeNames::canplaythrough); | 231 { onbeforecutAttr, EventTypeNames::beforecut}, |
232 attributeNameToEventNameMap.set(onchangeAttr.localName(), EventTypeNames ::change); | 232 { onbeforepasteAttr, EventTypeNames::beforepaste}, |
233 attributeNameToEventNameMap.set(onclickAttr.localName(), EventTypeNames: :click); | 233 { onblurAttr, EventTypeNames::blur}, |
234 attributeNameToEventNameMap.set(oncloseAttr.localName(), EventTypeNames: :close); | 234 { oncancelAttr, EventTypeNames::cancel}, |
235 attributeNameToEventNameMap.set(oncontextmenuAttr.localName(), EventType Names::contextmenu); | 235 { oncanplayAttr, EventTypeNames::canplay}, |
236 attributeNameToEventNameMap.set(oncopyAttr.localName(), EventTypeNames:: copy); | 236 { oncanplaythroughAttr, EventTypeNames::canplaythrough}, |
237 attributeNameToEventNameMap.set(oncuechangeAttr.localName(), EventTypeNa mes::cuechange); | 237 { onchangeAttr, EventTypeNames::change}, |
238 attributeNameToEventNameMap.set(oncutAttr.localName(), EventTypeNames::c ut); | 238 { onclickAttr, EventTypeNames::click}, |
239 attributeNameToEventNameMap.set(ondblclickAttr.localName(), EventTypeNam es::dblclick); | 239 { oncloseAttr, EventTypeNames::close}, |
240 attributeNameToEventNameMap.set(ondragAttr.localName(), EventTypeNames:: drag); | 240 { oncontextmenuAttr, EventTypeNames::contextmenu}, |
241 attributeNameToEventNameMap.set(ondragendAttr.localName(), EventTypeName s::dragend); | 241 { oncopyAttr, EventTypeNames::copy}, |
242 attributeNameToEventNameMap.set(ondragenterAttr.localName(), EventTypeNa mes::dragenter); | 242 { oncuechangeAttr, EventTypeNames::cuechange}, |
243 attributeNameToEventNameMap.set(ondragleaveAttr.localName(), EventTypeNa mes::dragleave); | 243 { oncutAttr, EventTypeNames::cut}, |
244 attributeNameToEventNameMap.set(ondragoverAttr.localName(), EventTypeNam es::dragover); | 244 { ondblclickAttr, EventTypeNames::dblclick}, |
245 attributeNameToEventNameMap.set(ondragstartAttr.localName(), EventTypeNa mes::dragstart); | 245 { ondragAttr, EventTypeNames::drag}, |
246 attributeNameToEventNameMap.set(ondropAttr.localName(), EventTypeNames:: drop); | 246 { ondragendAttr, EventTypeNames::dragend}, |
247 attributeNameToEventNameMap.set(ondurationchangeAttr.localName(), EventT ypeNames::durationchange); | 247 { ondragenterAttr, EventTypeNames::dragenter}, |
248 attributeNameToEventNameMap.set(onemptiedAttr.localName(), EventTypeName s::emptied); | 248 { ondragleaveAttr, EventTypeNames::dragleave}, |
249 attributeNameToEventNameMap.set(onendedAttr.localName(), EventTypeNames: :ended); | 249 { ondragoverAttr, EventTypeNames::dragover}, |
250 attributeNameToEventNameMap.set(onerrorAttr.localName(), EventTypeNames: :error); | 250 { ondragstartAttr, EventTypeNames::dragstart}, |
251 attributeNameToEventNameMap.set(onfocusAttr.localName(), EventTypeNames: :focus); | 251 { ondropAttr, EventTypeNames::drop}, |
252 attributeNameToEventNameMap.set(onfocusinAttr.localName(), EventTypeName s::focusin); | 252 { ondurationchangeAttr, EventTypeNames::durationchange}, |
253 attributeNameToEventNameMap.set(onfocusoutAttr.localName(), EventTypeNam es::focusout); | 253 { onemptiedAttr, EventTypeNames::emptied}, |
254 attributeNameToEventNameMap.set(oninputAttr.localName(), EventTypeNames: :input); | 254 { onendedAttr, EventTypeNames::ended}, |
255 attributeNameToEventNameMap.set(oninvalidAttr.localName(), EventTypeName s::invalid); | 255 { onerrorAttr, EventTypeNames::error}, |
256 attributeNameToEventNameMap.set(onkeydownAttr.localName(), EventTypeName s::keydown); | 256 { onfocusAttr, EventTypeNames::focus}, |
257 attributeNameToEventNameMap.set(onkeypressAttr.localName(), EventTypeNam es::keypress); | 257 { onfocusinAttr, EventTypeNames::focusin}, |
258 attributeNameToEventNameMap.set(onkeyupAttr.localName(), EventTypeNames: :keyup); | 258 { onfocusoutAttr, EventTypeNames::focusout}, |
259 attributeNameToEventNameMap.set(onloadAttr.localName(), EventTypeNames:: load); | 259 { oninputAttr, EventTypeNames::input}, |
260 attributeNameToEventNameMap.set(onloadeddataAttr.localName(), EventTypeN ames::loadeddata); | 260 { oninvalidAttr, EventTypeNames::invalid}, |
261 attributeNameToEventNameMap.set(onloadedmetadataAttr.localName(), EventT ypeNames::loadedmetadata); | 261 { onkeydownAttr, EventTypeNames::keydown}, |
262 attributeNameToEventNameMap.set(onloadstartAttr.localName(), EventTypeNa mes::loadstart); | 262 { onkeypressAttr, EventTypeNames::keypress}, |
263 attributeNameToEventNameMap.set(onmousedownAttr.localName(), EventTypeNa mes::mousedown); | 263 { onkeyupAttr, EventTypeNames::keyup}, |
264 attributeNameToEventNameMap.set(onmouseenterAttr.localName(), EventTypeN ames::mouseenter); | 264 { onloadAttr, EventTypeNames::load}, |
265 attributeNameToEventNameMap.set(onmouseleaveAttr.localName(), EventTypeN ames::mouseleave); | 265 { onloadeddataAttr, EventTypeNames::loadeddata}, |
266 attributeNameToEventNameMap.set(onmousemoveAttr.localName(), EventTypeNa mes::mousemove); | 266 { onloadedmetadataAttr, EventTypeNames::loadedmetadata}, |
267 attributeNameToEventNameMap.set(onmouseoutAttr.localName(), EventTypeNam es::mouseout); | 267 { onloadstartAttr, EventTypeNames::loadstart}, |
268 attributeNameToEventNameMap.set(onmouseoverAttr.localName(), EventTypeNa mes::mouseover); | 268 { onmousedownAttr, EventTypeNames::mousedown}, |
269 attributeNameToEventNameMap.set(onmouseupAttr.localName(), EventTypeName s::mouseup); | 269 { onmouseenterAttr, EventTypeNames::mouseenter}, |
270 attributeNameToEventNameMap.set(onmousewheelAttr.localName(), EventTypeN ames::mousewheel); | 270 { onmouseleaveAttr, EventTypeNames::mouseleave}, |
271 attributeNameToEventNameMap.set(onpasteAttr.localName(), EventTypeNames: :paste); | 271 { onmousemoveAttr, EventTypeNames::mousemove}, |
272 attributeNameToEventNameMap.set(onpauseAttr.localName(), EventTypeNames: :pause); | 272 { onmouseoutAttr, EventTypeNames::mouseout}, |
273 attributeNameToEventNameMap.set(onplayAttr.localName(), EventTypeNames:: play); | 273 { onmouseoverAttr, EventTypeNames::mouseover}, |
274 attributeNameToEventNameMap.set(onplayingAttr.localName(), EventTypeName s::playing); | 274 { onmouseupAttr, EventTypeNames::mouseup}, |
275 attributeNameToEventNameMap.set(onprogressAttr.localName(), EventTypeNam es::progress); | 275 { onmousewheelAttr, EventTypeNames::mousewheel}, |
276 attributeNameToEventNameMap.set(onratechangeAttr.localName(), EventTypeN ames::ratechange); | 276 { onpasteAttr, EventTypeNames::paste}, |
277 attributeNameToEventNameMap.set(onresetAttr.localName(), EventTypeNames: :reset); | 277 { onpauseAttr, EventTypeNames::pause}, |
278 attributeNameToEventNameMap.set(onresizeAttr.localName(), EventTypeNames ::resize); | 278 { onplayAttr, EventTypeNames::play}, |
279 attributeNameToEventNameMap.set(onscrollAttr.localName(), EventTypeNames ::scroll); | 279 { onplayingAttr, EventTypeNames::playing}, |
280 attributeNameToEventNameMap.set(onseekedAttr.localName(), EventTypeNames ::seeked); | 280 { onprogressAttr, EventTypeNames::progress}, |
281 attributeNameToEventNameMap.set(onseekingAttr.localName(), EventTypeName s::seeking); | 281 { onratechangeAttr, EventTypeNames::ratechange}, |
282 attributeNameToEventNameMap.set(onselectAttr.localName(), EventTypeNames ::select); | 282 { onresetAttr, EventTypeNames::reset}, |
283 attributeNameToEventNameMap.set(onselectstartAttr.localName(), EventType Names::selectstart); | 283 { onresizeAttr, EventTypeNames::resize}, |
284 attributeNameToEventNameMap.set(onshowAttr.localName(), EventTypeNames:: show); | 284 { onscrollAttr, EventTypeNames::scroll}, |
285 attributeNameToEventNameMap.set(onstalledAttr.localName(), EventTypeName s::stalled); | 285 { onseekedAttr, EventTypeNames::seeked}, |
286 attributeNameToEventNameMap.set(onsubmitAttr.localName(), EventTypeNames ::submit); | 286 { onseekingAttr, EventTypeNames::seeking}, |
287 attributeNameToEventNameMap.set(onsuspendAttr.localName(), EventTypeName s::suspend); | 287 { onselectAttr, EventTypeNames::select}, |
288 attributeNameToEventNameMap.set(ontimeupdateAttr.localName(), EventTypeN ames::timeupdate); | 288 { onselectstartAttr, EventTypeNames::selectstart}, |
289 attributeNameToEventNameMap.set(ontoggleAttr.localName(), EventTypeNames ::toggle); | 289 { onshowAttr, EventTypeNames::show}, |
290 attributeNameToEventNameMap.set(ontouchcancelAttr.localName(), EventType Names::touchcancel); | 290 { onstalledAttr, EventTypeNames::stalled}, |
291 attributeNameToEventNameMap.set(ontouchendAttr.localName(), EventTypeNam es::touchend); | 291 { onsubmitAttr, EventTypeNames::submit}, |
292 attributeNameToEventNameMap.set(ontouchmoveAttr.localName(), EventTypeNa mes::touchmove); | 292 { onsuspendAttr, EventTypeNames::suspend}, |
293 attributeNameToEventNameMap.set(ontouchstartAttr.localName(), EventTypeN ames::touchstart); | 293 { ontimeupdateAttr, EventTypeNames::timeupdate}, |
294 attributeNameToEventNameMap.set(ontransitionendAttr.localName(), EventTy peNames::webkitTransitionEnd); | 294 { ontoggleAttr, EventTypeNames::toggle}, |
295 attributeNameToEventNameMap.set(onvolumechangeAttr.localName(), EventTyp eNames::volumechange); | 295 { ontouchcancelAttr, EventTypeNames::touchcancel}, |
296 attributeNameToEventNameMap.set(onwaitingAttr.localName(), EventTypeName s::waiting); | 296 { ontouchendAttr, EventTypeNames::touchend}, |
297 attributeNameToEventNameMap.set(onwebkitanimationendAttr.localName(), Ev entTypeNames::webkitAnimationEnd); | 297 { ontouchmoveAttr, EventTypeNames::touchmove}, |
298 attributeNameToEventNameMap.set(onwebkitanimationiterationAttr.localName (), EventTypeNames::webkitAnimationIteration); | 298 { ontouchstartAttr, EventTypeNames::touchstart}, |
299 attributeNameToEventNameMap.set(onwebkitanimationstartAttr.localName(), EventTypeNames::webkitAnimationStart); | 299 { ontransitionendAttr, EventTypeNames::webkitTransitionEnd}, |
300 attributeNameToEventNameMap.set(onwebkitfullscreenchangeAttr.localName() , EventTypeNames::webkitfullscreenchange); | 300 { onvolumechangeAttr, EventTypeNames::volumechange}, |
301 attributeNameToEventNameMap.set(onwebkitfullscreenerrorAttr.localName(), EventTypeNames::webkitfullscreenerror); | 301 { onwaitingAttr, EventTypeNames::waiting}, |
302 attributeNameToEventNameMap.set(onwebkittransitionendAttr.localName(), E ventTypeNames::webkitTransitionEnd); | 302 { onwebkitanimationendAttr, EventTypeNames::webkitAnimationEnd}, |
303 attributeNameToEventNameMap.set(onwheelAttr.localName(), EventTypeNames: :wheel); | 303 { onwebkitanimationiterationAttr, EventTypeNames::webkitAnimationIte ration}, |
304 { onwebkitanimationstartAttr, EventTypeNames::webkitAnimationStart}, | |
305 { onwebkitfullscreenchangeAttr, EventTypeNames::webkitfullscreenchan ge}, | |
306 { onwebkitfullscreenerrorAttr, EventTypeNames::webkitfullscreenerror }, | |
307 { onwebkittransitionendAttr, EventTypeNames::webkitTransitionEnd}, | |
308 { onwheelAttr, EventTypeNames::wheel}, | |
309 }; | |
310 | |
311 for (size_t i = 0; i < WTF_ARRAY_LENGTH(attrToEventNames); i++) | |
312 attributeNameToEventNameMap.set(attrToEventNames[i].attr.localName() , attrToEventNames[i].event); | |
304 } | 313 } |
305 | 314 |
306 return attributeNameToEventNameMap.get(attrName.localName()); | 315 return attributeNameToEventNameMap.get(attrName.localName()); |
307 } | 316 } |
308 | 317 |
309 void HTMLElement::parseAttribute(const QualifiedName& name, const AtomicString& value) | 318 void HTMLElement::parseAttribute(const QualifiedName& name, const AtomicString& value) |
310 { | 319 { |
311 if (name == tabindexAttr) | 320 if (name == tabindexAttr) |
312 return Element::parseAttribute(name, value); | 321 return Element::parseAttribute(name, value); |
313 | 322 |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
994 #ifndef NDEBUG | 1003 #ifndef NDEBUG |
995 | 1004 |
996 // For use in the debugger | 1005 // For use in the debugger |
997 void dumpInnerHTML(blink::HTMLElement*); | 1006 void dumpInnerHTML(blink::HTMLElement*); |
998 | 1007 |
999 void dumpInnerHTML(blink::HTMLElement* element) | 1008 void dumpInnerHTML(blink::HTMLElement* element) |
1000 { | 1009 { |
1001 printf("%s\n", element->innerHTML().ascii().data()); | 1010 printf("%s\n", element->innerHTML().ascii().data()); |
1002 } | 1011 } |
1003 #endif | 1012 #endif |
OLD | NEW |