Chromium Code Reviews| Index: Source/WebCore/platform/KURLGoogle.cpp |
| diff --git a/Source/WebCore/platform/KURLGoogle.cpp b/Source/WebCore/platform/KURLGoogle.cpp |
| index 6bf9fccb1e9fe192e8dc5b302958cdf11f47924c..ef96ce4eb9b04dfef95989d97600f05999682890 100644 |
| --- a/Source/WebCore/platform/KURLGoogle.cpp |
| +++ b/Source/WebCore/platform/KURLGoogle.cpp |
| @@ -174,6 +174,35 @@ KURLGooglePrivate::KURLGooglePrivate(WTF::HashTableDeletedValueType) |
| { |
| } |
| +KURLGooglePrivate::KURLGooglePrivate(const KURLGooglePrivate& o) |
| + : m_isValid(o.m_isValid) |
| + , m_protocolIsInHTTPFamily(o.m_protocolIsInHTTPFamily) |
| + , m_parsed(o.m_parsed) |
| + , m_utf8(o.m_utf8) |
| + , m_utf8IsASCII(o.m_utf8IsASCII) |
| + , m_stringIsValid(o.m_stringIsValid) |
| + , m_string(o.m_string) |
| +{ |
| + if (o.m_inner_url.get()) |
| + m_inner_url = adoptPtr(new KURL(o.m_inner_url->copy())); |
|
abarth-chromium
2011/12/20 07:03:15
m_innerURL. Can we avoid calling the KURL parser
ericu
2011/12/20 23:55:34
I'm not sure what you mean. m_inner_url is a KURL
|
| +} |
| + |
| +KURLGooglePrivate& KURLGooglePrivate::operator=(const KURLGooglePrivate& o) |
| +{ |
| + m_isValid = o.m_isValid; |
| + m_protocolIsInHTTPFamily = o.m_protocolIsInHTTPFamily; |
| + m_parsed = o.m_parsed; |
| + m_utf8 = o.m_utf8; |
| + m_utf8IsASCII = o.m_utf8IsASCII; |
| + m_stringIsValid = o.m_stringIsValid; |
| + m_string = o.m_string; |
| + if (o.m_inner_url.get()) |
| + m_inner_url = adoptPtr(new KURL(o.m_inner_url->copy())); |
| + else |
| + m_inner_url.clear(); |
| + return *this; |
| +} |
| + |
| // Setters for the data. Using the ASCII version when you know the |
| // data is ASCII will be slightly more efficient. The UTF-8 version |
| // will always be correct if the caller is unsure. |
| @@ -197,6 +226,7 @@ void KURLGooglePrivate::setUtf8(const CString& str) |
| m_utf8 = str; |
| m_stringIsValid = false; |
| initProtocolIsInHTTPFamily(); |
| + initInnerURL(); |
| } |
| void KURLGooglePrivate::setAscii(const CString& str) |
| @@ -205,6 +235,7 @@ void KURLGooglePrivate::setAscii(const CString& str) |
| m_utf8IsASCII = true; |
| m_stringIsValid = false; |
| initProtocolIsInHTTPFamily(); |
| + initInnerURL(); |
| } |
| void KURLGooglePrivate::init(const KURL& base, |
| @@ -258,6 +289,22 @@ void KURLGooglePrivate::init(const KURL& base, const CHAR* rel, int relLength, |
| } |
| } |
| +void KURLGooglePrivate::initInnerURL() { |
| + if (!m_isValid) { |
| + m_inner_url.clear(); |
| + return; |
| + } |
| + url_parse::Parsed* inner_parsed = m_parsed.inner_parsed(); |
|
abarth-chromium
2011/12/20 07:03:15
innerParsed
ericu
2011/12/20 23:55:34
Done.
|
| + if (inner_parsed) |
| + m_inner_url = adoptPtr(new KURL( |
| + ParsedURLString, |
| + String( |
| + m_utf8.data() + inner_parsed->scheme.begin, |
| + inner_parsed->Length() - inner_parsed->scheme.begin))); |
|
abarth-chromium
2011/12/20 07:03:15
There's no 80 column limit in WebKit. You can go
ericu
2011/12/20 23:55:34
s/excitingly/excruciatingly/, but OK ;'>.
|
| + else |
| + m_inner_url.clear(); |
| +} |
| + |
| void KURLGooglePrivate::initProtocolIsInHTTPFamily() |
| { |
| if (!m_isValid) { |
| @@ -285,6 +332,11 @@ void KURLGooglePrivate::copyTo(KURLGooglePrivate* dest) const |
| dest->m_utf8IsASCII = m_utf8IsASCII; |
| dest->m_stringIsValid = false; |
| dest->m_string = String(); // Clear the invalid string to avoid cross thread ref counting. |
| + if (m_inner_url) { |
| + dest->m_inner_url = adoptPtr(new KURL(m_inner_url->copy())); |
| + } |
| + else |
| + dest->m_inner_url.clear(); |
| } |
| String KURLGooglePrivate::componentString(const url_parse::Component& comp) const |
| @@ -827,7 +879,10 @@ String encodeWithURLEscapeSequences(const String& notEncodedString) |
| buffer.Resize(inputLength * 3); |
| url_util::EncodeURIComponent(input, inputLength, &buffer); |
| - return String(buffer.data(), buffer.length()); |
| + String escaped(buffer.data(), buffer.length()); |
| + // Unescape '/'; it's safe and much prettier. |
| + escaped.replace("%2F", "/"); |
| + return escaped; |
| } |
| bool KURL::isHierarchical() const |