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

Side by Side Diff: third_party/WebKit/Source/web/WebEntities.cpp

Issue 2709033003: Migrate WTF::HashMap::get() to ::at() (Closed)
Patch Set: rebase Created 3 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 m_entitiesMap.set(0x0027, "apos"); 44 m_entitiesMap.set(0x0027, "apos");
45 m_entitiesMap.set(0x0022, "quot"); 45 m_entitiesMap.set(0x0022, "quot");
46 // We add #39 for test-compatibility reason. 46 // We add #39 for test-compatibility reason.
47 if (!xmlEntities) 47 if (!xmlEntities)
48 m_entitiesMap.set(0x0027, String("#39")); 48 m_entitiesMap.set(0x0027, String("#39"));
49 } 49 }
50 50
51 String WebEntities::entityNameByCode(int code) const { 51 String WebEntities::entityNameByCode(int code) const {
52 // FIXME: We should use find so we only do one hash lookup. 52 // FIXME: We should use find so we only do one hash lookup.
53 if (m_entitiesMap.contains(code)) 53 if (m_entitiesMap.contains(code))
54 return m_entitiesMap.get(code); 54 return m_entitiesMap.at(code);
55 return ""; 55 return "";
56 } 56 }
57 57
58 String WebEntities::convertEntitiesInString(const String& value) const { 58 String WebEntities::convertEntitiesInString(const String& value) const {
59 StringBuilder result; 59 StringBuilder result;
60 bool didConvertEntity = false; 60 bool didConvertEntity = false;
61 unsigned length = value.length(); 61 unsigned length = value.length();
62 for (unsigned i = 0; i < length; ++i) { 62 for (unsigned i = 0; i < length; ++i) {
63 UChar c = value[i]; 63 UChar c = value[i];
64 // FIXME: We should use find so we only do one hash lookup. 64 // FIXME: We should use find so we only do one hash lookup.
65 if (m_entitiesMap.contains(c)) { 65 if (m_entitiesMap.contains(c)) {
66 didConvertEntity = true; 66 didConvertEntity = true;
67 result.append('&'); 67 result.append('&');
68 result.append(m_entitiesMap.get(c)); 68 result.append(m_entitiesMap.at(c));
69 result.append(';'); 69 result.append(';');
70 } else { 70 } else {
71 result.append(c); 71 result.append(c);
72 } 72 }
73 } 73 }
74 74
75 if (!didConvertEntity) 75 if (!didConvertEntity)
76 return value; 76 return value;
77 77
78 return result.toString(); 78 return result.toString();
79 } 79 }
80 80
81 } // namespace blink 81 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebDevToolsFrontendImpl.cpp ('k') | third_party/WebKit/Source/web/tests/FrameSerializerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698