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

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

Issue 228943008: Avoid hash table lookup for every attribute (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 mapLanguageAttributeToLocale(value, style); 198 mapLanguageAttributeToLocale(value, style);
199 } else 199 } else
200 Element::collectStyleForPresentationAttribute(name, value, style); 200 Element::collectStyleForPresentationAttribute(name, value, style);
201 } 201 }
202 202
203 const AtomicString& HTMLElement::eventNameForAttributeName(const QualifiedName& attrName) 203 const AtomicString& HTMLElement::eventNameForAttributeName(const QualifiedName& attrName)
204 { 204 {
205 if (!attrName.namespaceURI().isNull()) 205 if (!attrName.namespaceURI().isNull())
206 return nullAtom; 206 return nullAtom;
207 207
208 if (!attrName.localName().startsWith("on", false))
eseidel 2014/04/14 05:48:20 What does the false mean? (Clearly we should make
209 return nullAtom;
210
208 typedef HashMap<AtomicString, AtomicString> StringToStringMap; 211 typedef HashMap<AtomicString, AtomicString> StringToStringMap;
209 DEFINE_STATIC_LOCAL(StringToStringMap, attributeNameToEventNameMap, ()); 212 DEFINE_STATIC_LOCAL(StringToStringMap, attributeNameToEventNameMap, ());
210 if (!attributeNameToEventNameMap.size()) { 213 if (!attributeNameToEventNameMap.size()) {
211 attributeNameToEventNameMap.set(onabortAttr.localName(), EventTypeNames: :abort); 214 attributeNameToEventNameMap.set(onabortAttr.localName(), EventTypeNames: :abort);
212 attributeNameToEventNameMap.set(onanimationendAttr.localName(), EventTyp eNames::animationend); 215 attributeNameToEventNameMap.set(onanimationendAttr.localName(), EventTyp eNames::animationend);
213 attributeNameToEventNameMap.set(onanimationiterationAttr.localName(), Ev entTypeNames::animationiteration); 216 attributeNameToEventNameMap.set(onanimationiterationAttr.localName(), Ev entTypeNames::animationiteration);
214 attributeNameToEventNameMap.set(onanimationstartAttr.localName(), EventT ypeNames::animationstart); 217 attributeNameToEventNameMap.set(onanimationstartAttr.localName(), EventT ypeNames::animationstart);
215 attributeNameToEventNameMap.set(onautocompleteAttr.localName(), EventTyp eNames::autocomplete); 218 attributeNameToEventNameMap.set(onautocompleteAttr.localName(), EventTyp eNames::autocomplete);
216 attributeNameToEventNameMap.set(onautocompleteerrorAttr.localName(), Eve ntTypeNames::autocompleteerror); 219 attributeNameToEventNameMap.set(onautocompleteerrorAttr.localName(), Eve ntTypeNames::autocompleteerror);
217 attributeNameToEventNameMap.set(onbeforecopyAttr.localName(), EventTypeN ames::beforecopy); 220 attributeNameToEventNameMap.set(onbeforecopyAttr.localName(), EventTypeN ames::beforecopy);
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 #ifndef NDEBUG 947 #ifndef NDEBUG
945 948
946 // For use in the debugger 949 // For use in the debugger
947 void dumpInnerHTML(WebCore::HTMLElement*); 950 void dumpInnerHTML(WebCore::HTMLElement*);
948 951
949 void dumpInnerHTML(WebCore::HTMLElement* element) 952 void dumpInnerHTML(WebCore::HTMLElement* element)
950 { 953 {
951 printf("%s\n", element->innerHTML().ascii().data()); 954 printf("%s\n", element->innerHTML().ascii().data());
952 } 955 }
953 #endif 956 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698