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

Unified Diff: third_party/WebKit/Source/core/svg/SVGTests.cpp

Issue 2284273002: Don't use substring() for a simple prefix match (Closed)
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/svg/SVGTests.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGTests.cpp b/third_party/WebKit/Source/core/svg/SVGTests.cpp
index e0de9b933f7a42cbb6ab1b6723961163668126c6..4defe6cccdb14d01e9574b9a35823992bdedb4de 100644
--- a/third_party/WebKit/Source/core/svg/SVGTests.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGTests.cpp
@@ -51,15 +51,12 @@ bool SVGTests::isValid() const
if (m_systemLanguage->isSpecified()) {
bool matchFound = false;
-
- const Vector<String>& systemLanguage = m_systemLanguage->value()->values();
- for (const auto& value : systemLanguage) {
- if (value == defaultLanguage().getString().substring(0, 2)) {
+ for (const auto& value : m_systemLanguage->value()->values()) {
+ if (value.length() == 2 && defaultLanguage().startsWith(value)) {
matchFound = true;
break;
}
}
-
if (!matchFound)
return false;
}
« 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