~ubuntu-branches/ubuntu/karmic/webkit/karmic-proposed

« back to all changes in this revision

Viewing changes to WebCore/platform/LinkHash.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2009-05-15 18:30:58 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090515183058-50q5exjo9b1kxy9s
Tags: 1.1.7-1
* New upstream release
* debian/libwebkit-1.0-2.symbols:
- updated with the new symbols in 1.1.7
* debian/libwebkit-dev.install, debian/libwebkit-dev.links,
  debian/rules:
- Build, and ship gtk-doc documentation (Closes: #526683)
* debian/copyright:
- updated.

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
  return AlreadyHashed::avoidDeletedValue(StringImpl::computeHash(url, length));
153
153
}
154
154
 
155
 
LinkHash visitedLinkHash(const KURL& base, const AtomicString& attributeURL)
 
155
void visitedURL(const KURL& base, const AtomicString& attributeURL, Vector<UChar, 512>& buffer)
156
156
{
157
157
    const UChar* characters = attributeURL.characters();
158
158
    unsigned length = attributeURL.length();
159
159
    if (!length)
160
 
        return 0;
 
160
        return;
161
161
 
162
162
    // This is a poor man's completeURL. Faster with less memory allocation.
163
163
    // FIXME: It's missing a lot of what completeURL does and a lot of what KURL does.
172
172
 
173
173
    bool hasColonSlashSlash = containsColonSlashSlash(characters, length);
174
174
 
175
 
    if (hasColonSlashSlash && !needsTrailingSlash(characters, length))
176
 
        return visitedLinkHash(attributeURL.characters(), attributeURL.length());
 
175
    if (hasColonSlashSlash && !needsTrailingSlash(characters, length)) {
 
176
        buffer.append(attributeURL.characters(), attributeURL.length());
 
177
        return;
 
178
    }
177
179
 
178
 
    Vector<UChar, 512> buffer;
179
180
 
180
181
    if (hasColonSlashSlash) {
181
182
        // FIXME: This is incorrect for URLs that have a query or anchor; the "/" needs to go at the
182
183
        // end of the path, *before* the query or anchor.
183
184
        buffer.append(characters, length);
184
185
        buffer.append('/');
185
 
        return visitedLinkHash(buffer.data(), buffer.size());
 
186
        return;
186
187
    }
187
188
 
188
189
    switch (characters[0]) {
204
205
        buffer.append('/');
205
206
    }
206
207
 
207
 
    return visitedLinkHash(buffer.data(), buffer.size());
 
208
    return;
 
209
}
 
210
 
 
211
LinkHash visitedLinkHash(const KURL& base, const AtomicString& attributeURL)
 
212
{
 
213
    Vector<UChar, 512> url;
 
214
    visitedURL(base, attributeURL, url);
 
215
    if (url.isEmpty())
 
216
        return 0;
 
217
 
 
218
    return visitedLinkHash(url.data(), url.size());
208
219
}
209
220
 
210
221
}  // namespace WebCore