Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(550)

Side by Side Diff: Source/core/html/HTMLElement.cpp

Issue 102103002: Have HashMap<KeyType, AtomicString>::get() return a const reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use AtomicString::ConstructFromLiteral Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/html/HTMLElement.h ('k') | Source/core/html/forms/FormController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } else if (name.matches(XMLNames::langAttr)) 198 } else if (name.matches(XMLNames::langAttr))
199 mapLanguageAttributeToLocale(value, style); 199 mapLanguageAttributeToLocale(value, style);
200 else if (name == langAttr) { 200 else if (name == langAttr) {
201 // xml:lang has a higher priority than lang. 201 // xml:lang has a higher priority than lang.
202 if (!fastHasAttribute(XMLNames::langAttr)) 202 if (!fastHasAttribute(XMLNames::langAttr))
203 mapLanguageAttributeToLocale(value, style); 203 mapLanguageAttributeToLocale(value, style);
204 } else 204 } else
205 Element::collectStyleForPresentationAttribute(name, value, style); 205 Element::collectStyleForPresentationAttribute(name, value, style);
206 } 206 }
207 207
208 AtomicString HTMLElement::eventNameForAttributeName(const QualifiedName& attrNam e) const 208 const AtomicString& HTMLElement::eventNameForAttributeName(const QualifiedName& attrName) const
209 { 209 {
210 if (!attrName.namespaceURI().isNull()) 210 if (!attrName.namespaceURI().isNull())
211 return AtomicString(); 211 return nullAtom;
212 212
213 typedef HashMap<AtomicString, AtomicString> StringToStringMap; 213 typedef HashMap<AtomicString, AtomicString> StringToStringMap;
214 DEFINE_STATIC_LOCAL(StringToStringMap, attributeNameToEventNameMap, ()); 214 DEFINE_STATIC_LOCAL(StringToStringMap, attributeNameToEventNameMap, ());
215 if (!attributeNameToEventNameMap.size()) { 215 if (!attributeNameToEventNameMap.size()) {
216 attributeNameToEventNameMap.set(onanimationstartAttr.localName(), EventT ypeNames::animationstart); 216 attributeNameToEventNameMap.set(onanimationstartAttr.localName(), EventT ypeNames::animationstart);
217 attributeNameToEventNameMap.set(onanimationiterationAttr.localName(), Ev entTypeNames::animationiteration); 217 attributeNameToEventNameMap.set(onanimationiterationAttr.localName(), Ev entTypeNames::animationiteration);
218 attributeNameToEventNameMap.set(onanimationendAttr.localName(), EventTyp eNames::animationend); 218 attributeNameToEventNameMap.set(onanimationendAttr.localName(), EventTyp eNames::animationend);
219 attributeNameToEventNameMap.set(oncancelAttr.localName(), EventTypeNames ::cancel); 219 attributeNameToEventNameMap.set(oncancelAttr.localName(), EventTypeNames ::cancel);
220 attributeNameToEventNameMap.set(onclickAttr.localName(), EventTypeNames: :click); 220 attributeNameToEventNameMap.set(onclickAttr.localName(), EventTypeNames: :click);
221 attributeNameToEventNameMap.set(oncloseAttr.localName(), EventTypeNames: :close); 221 attributeNameToEventNameMap.set(oncloseAttr.localName(), EventTypeNames: :close);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 if (treeScope().adjustedFocusedElement() == this) { 313 if (treeScope().adjustedFocusedElement() == this) {
314 // We might want to call blur(), but it's dangerous to dispatch 314 // We might want to call blur(), but it's dangerous to dispatch
315 // events here. 315 // events here.
316 document().setNeedsFocusedElementCheck(); 316 document().setNeedsFocusedElementCheck();
317 } 317 }
318 } else if (parseHTMLInteger(value, tabindex)) { 318 } else if (parseHTMLInteger(value, tabindex)) {
319 // Clamp tabindex to the range of 'short' to match Firefox's behavio r. 319 // Clamp tabindex to the range of 'short' to match Firefox's behavio r.
320 setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short >::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max())))); 320 setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short >::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max()))));
321 } 321 }
322 } else { 322 } else {
323 AtomicString eventName = eventNameForAttributeName(name); 323 const AtomicString& eventName = eventNameForAttributeName(name);
324 if (!eventName.isNull()) 324 if (!eventName.isNull())
325 setAttributeEventListener(eventName, createAttributeEventListener(th is, name, value)); 325 setAttributeEventListener(eventName, createAttributeEventListener(th is, name, value));
326 } 326 }
327 } 327 }
328 328
329 PassRefPtr<DocumentFragment> HTMLElement::textToFragment(const String& text, Exc eptionState& exceptionState) 329 PassRefPtr<DocumentFragment> HTMLElement::textToFragment(const String& text, Exc eptionState& exceptionState)
330 { 330 {
331 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document()); 331 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document());
332 unsigned int i, length = text.length(); 332 unsigned int i, length = text.length();
333 UChar c = 0; 333 UChar c = 0;
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 #ifndef NDEBUG 1076 #ifndef NDEBUG
1077 1077
1078 // For use in the debugger 1078 // For use in the debugger
1079 void dumpInnerHTML(WebCore::HTMLElement*); 1079 void dumpInnerHTML(WebCore::HTMLElement*);
1080 1080
1081 void dumpInnerHTML(WebCore::HTMLElement* element) 1081 void dumpInnerHTML(WebCore::HTMLElement* element)
1082 { 1082 {
1083 printf("%s\n", element->innerHTML().ascii().data()); 1083 printf("%s\n", element->innerHTML().ascii().data());
1084 } 1084 }
1085 #endif 1085 #endif
OLDNEW
« no previous file with comments | « Source/core/html/HTMLElement.h ('k') | Source/core/html/forms/FormController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698