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

Unified Diff: third_party/WebKit/Source/platform/weborigin/KURL.cpp

Issue 2450083002: hackity hack. (Closed)
Patch Set: Created 4 years, 2 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/platform/weborigin/KURL.cpp
diff --git a/third_party/WebKit/Source/platform/weborigin/KURL.cpp b/third_party/WebKit/Source/platform/weborigin/KURL.cpp
index 666ec1043795a491dc0698c7ab5ff94c498730f4..f8f8a1f66bcd5260d7888893676a9df67729fd1d 100644
--- a/third_party/WebKit/Source/platform/weborigin/KURL.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/KURL.cpp
@@ -717,20 +717,6 @@ bool protocolIs(const String& url, const char* protocol) {
void KURL::init(const KURL& base,
const String& relative,
const WTF::TextEncoding* queryEncoding) {
- if (!relative.isNull() && relative.is8Bit()) {
- StringUTF8Adaptor relativeUTF8(relative);
- init(base, relativeUTF8.data(), relativeUTF8.length(), queryEncoding);
- } else
- init(base, relative.characters16(), relative.length(), queryEncoding);
- initProtocolIsInHTTPFamily();
- initInnerURL();
-}
-
-template <typename CHAR>
-void KURL::init(const KURL& base,
- const CHAR* relative,
- int relativeLength,
- const WTF::TextEncoding* queryEncoding) {
// As a performance optimization, we do not use the charset converter
// if encoding is UTF-8 or other Unicode encodings. Note that this is
// per HTML5 2.5.3 (resolving URL). The URL canonicalizer will be more
@@ -746,15 +732,28 @@ void KURL::init(const KURL& base,
: &charsetConverterObject;
StringUTF8Adaptor baseUTF8(base.getString());
-
url::RawCanonOutputT<char> output;
- m_isValid = url::ResolveRelative(baseUTF8.data(), baseUTF8.length(),
- base.m_parsed, relative, relativeLength,
- charsetConverter, &output, &m_parsed);
- // See FIXME in KURLPrivate in the header. If canonicalization has not
- // changed the string, we can avoid an extra allocation by using assignment.
- m_string = AtomicString::fromUTF8(output.data(), output.length());
+ if (!relative.isNull() && relative.is8Bit()) {
+ StringUTF8Adaptor relativeUTF8(relative);
+ m_isValid = url::ResolveRelative(baseUTF8.data(), baseUTF8.length(),
+ base.m_parsed, relative, relativeLength,
+ charsetConverter, &output, &m_parsed);
+ } else {
+ m_isValid = url::ResolveRelative(baseUTF8.data(), baseUTF8.length(),
+ base.m_parsed, relative.characters16(),
+ static_cast<int>(relative.length()),
+ charsetConverter, &output, &m_parsed);
+ }
+
+ if (StringView(output.data(), static_cast<unsigned>(output.length())) ==
+ relative)
+ m_string = AtomicString(relative);
+ else
+ m_string = AtomicString::fromUTF8(output.data(), output.length());
+
+ initProtocolIsInHTTPFamily();
+ initInnerURL();
}
void KURL::initInnerURL() {
« 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