| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * | 10 * |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 if (deprecated && content[pos + 2] == '@') | 153 if (deprecated && content[pos + 2] == '@') |
| 154 *deprecated = true; | 154 *deprecated = true; |
| 155 | 155 |
| 156 ASSERT(equalSignPos); | 156 ASSERT(equalSignPos); |
| 157 ASSERT(commentType != CSSMagicComment || closingCommentPos); | 157 ASSERT(commentType != CSSMagicComment || closingCommentPos); |
| 158 size_t urlPos = equalSignPos + 1; | 158 size_t urlPos = equalSignPos + 1; |
| 159 String match = commentType == CSSMagicComment | 159 String match = commentType == CSSMagicComment |
| 160 ? content.substring(urlPos, closingCommentPos - urlPos) | 160 ? content.substring(urlPos, closingCommentPos - urlPos) |
| 161 : content.substring(urlPos); | 161 : content.substring(urlPos); |
| 162 |
| 163 size_t newLine = match.find("\n"); |
| 164 if (newLine != kNotFound) |
| 165 match = match.substring(0, newLine); |
| 162 match = match.stripWhiteSpace(); | 166 match = match.stripWhiteSpace(); |
| 163 | 167 |
| 164 String disallowedChars("\"' \t\n\r"); | 168 String disallowedChars("\"' \t"); |
| 165 for (unsigned i = 0; i < match.length(); ++i) { | 169 for (unsigned i = 0; i < match.length(); ++i) { |
| 166 if (disallowedChars.find(match[i]) != kNotFound) | 170 if (disallowedChars.find(match[i]) != kNotFound) |
| 167 return match.substring(0, i); | 171 return ""; |
| 168 } | 172 } |
| 169 | 173 |
| 170 return match; | 174 return match; |
| 171 } | 175 } |
| 172 | 176 |
| 173 String findSourceURL(const String& content, MagicCommentType commentType, bool*
deprecated) | 177 String findSourceURL(const String& content, MagicCommentType commentType, bool*
deprecated) |
| 174 { | 178 { |
| 175 return findMagicComment(content, "sourceURL", commentType, deprecated); | 179 return findMagicComment(content, "sourceURL", commentType, deprecated); |
| 176 } | 180 } |
| 177 | 181 |
| 178 String findSourceMapURL(const String& content, MagicCommentType commentType, boo
l* deprecated) | 182 String findSourceMapURL(const String& content, MagicCommentType commentType, boo
l* deprecated) |
| 179 { | 183 { |
| 180 return findMagicComment(content, "sourceMappingURL", commentType, deprecated
); | 184 return findMagicComment(content, "sourceMappingURL", commentType, deprecated
); |
| 181 } | 185 } |
| 182 | 186 |
| 183 } // namespace ContentSearchUtils | 187 } // namespace ContentSearchUtils |
| 184 } // namespace WebCore | 188 } // namespace WebCore |
| 185 | 189 |
| OLD | NEW |