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

Side by Side Diff: third_party/WebKit/Source/core/dom/ScriptLoader.cpp

Issue 2142513003: Use initializer_lists for static WTF::HashSets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/custom/CustomElement.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 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 static bool isLegacySupportedJavaScriptLanguage(const String& language) 125 static bool isLegacySupportedJavaScriptLanguage(const String& language)
126 { 126 {
127 // Mozilla 1.8 accepts javascript1.0 - javascript1.7, but WinIE 7 accepts on ly javascript1.1 - javascript1.3. 127 // Mozilla 1.8 accepts javascript1.0 - javascript1.7, but WinIE 7 accepts on ly javascript1.1 - javascript1.3.
128 // Mozilla 1.8 and WinIE 7 both accept javascript and livescript. 128 // Mozilla 1.8 and WinIE 7 both accept javascript and livescript.
129 // WinIE 7 accepts ecmascript and jscript, but Mozilla 1.8 doesn't. 129 // WinIE 7 accepts ecmascript and jscript, but Mozilla 1.8 doesn't.
130 // Neither Mozilla 1.8 nor WinIE 7 accept leading or trailing whitespace. 130 // Neither Mozilla 1.8 nor WinIE 7 accept leading or trailing whitespace.
131 // We want to accept all the values that either of these browsers accept, bu t not other values. 131 // We want to accept all the values that either of these browsers accept, bu t not other values.
132 132
133 // FIXME: This function is not HTML5 compliant. These belong in the MIME reg istry as "text/javascript<version>" entries. 133 // FIXME: This function is not HTML5 compliant. These belong in the MIME reg istry as "text/javascript<version>" entries.
134 typedef HashSet<String, CaseFoldingHash> LanguageSet; 134 typedef HashSet<String, CaseFoldingHash> LanguageSet;
135 DEFINE_STATIC_LOCAL(LanguageSet, languages, ()); 135 DEFINE_STATIC_LOCAL(LanguageSet, languages, ({
136 if (languages.isEmpty()) { 136 "javascript",
137 languages.add("javascript"); 137 "javascript1.0",
138 languages.add("javascript1.0"); 138 "javascript1.1",
139 languages.add("javascript1.1"); 139 "javascript1.2",
140 languages.add("javascript1.2"); 140 "javascript1.3",
141 languages.add("javascript1.3"); 141 "javascript1.4",
142 languages.add("javascript1.4"); 142 "javascript1.5",
143 languages.add("javascript1.5"); 143 "javascript1.6",
144 languages.add("javascript1.6"); 144 "javascript1.7",
145 languages.add("javascript1.7"); 145 "livescript",
146 languages.add("livescript"); 146 "ecmascript",
147 languages.add("ecmascript"); 147 "jscript",
148 languages.add("jscript"); 148 }));
149 }
150 149
151 return languages.contains(language); 150 return languages.contains(language);
152 } 151 }
153 152
154 void ScriptLoader::dispatchErrorEvent() 153 void ScriptLoader::dispatchErrorEvent()
155 { 154 {
156 m_element->dispatchEvent(Event::create(EventTypeNames::error)); 155 m_element->dispatchEvent(Event::create(EventTypeNames::error));
157 } 156 }
158 157
159 void ScriptLoader::dispatchLoadEvent() 158 void ScriptLoader::dispatchLoadEvent()
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 if (isHTMLScriptLoader(element)) 519 if (isHTMLScriptLoader(element))
521 return toHTMLScriptElement(element)->loader(); 520 return toHTMLScriptElement(element)->loader();
522 521
523 if (isSVGScriptLoader(element)) 522 if (isSVGScriptLoader(element))
524 return toSVGScriptElement(element)->loader(); 523 return toSVGScriptElement(element)->loader();
525 524
526 return 0; 525 return 0;
527 } 526 }
528 527
529 } // namespace blink 528 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/custom/CustomElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698