2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
23 #include "CSSHelper.h"
25 #include "PlatformString.h"
26 #include <wtf/Vector.h>
30 String deprecatedParseURL(const String& url)
32 StringImpl* i = url.impl();
36 int length = i->length();
41 while (0 < l && (*i)[o] <= ' ') {
45 while (l > 0 && (*i)[o + l - 1] <= ' ')
49 && ((*i)[o] == 'u' || (*i)[o] == 'U')
50 && ((*i)[o + 1] == 'r' || (*i)[o + 1] == 'R')
51 && ((*i)[o + 2] == 'l' || (*i)[o + 2] == 'L')
53 && (*i)[o + l - 1] == ')') {
58 while (0 < l && (*i)[o] <= ' ') {
62 while (l > 0 && (*i)[o + l - 1] <= ' ')
65 if (l >= 2 && (*i)[o] == (*i)[o + l - 1] && ((*i)[o] == '\'' || (*i)[o] == '\"')) {
70 while (0 < l && (*i)[o] <= ' ') {
74 while (l > 0 && (*i)[o + l - 1] <= ' ')
77 const UChar* characters = i->characters();
79 // Optimize for the likely case there there is nothing to strip.
82 // If the URL has any control characters in it, we have to strip them.
83 // '\r' (ascii value 13) is the largest control character.
84 for (k = 0; k < length; k++) {
85 if (characters[k] <= '\r')
92 Vector<UChar, 2048> buffer(l);
95 for (int k = o; k < o + l; k++) {
96 UChar c = characters[k];
101 return String(buffer.data(), nl);
104 } // namespace WebCore