summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/KURLGoogle.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2009-08-11 17:01:47 +0100
committerBen Murdoch <benm@google.com>2009-08-11 18:21:02 +0100
commit0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 (patch)
tree2943df35f62d885c89d01063cc528dd73b480fea /WebCore/platform/KURLGoogle.cpp
parent7e7a70bfa49a1122b2597a1e6367d89eb4035eca (diff)
downloadexternal_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.zip
external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.gz
external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.bz2
Merge in WebKit r47029.
Diffstat (limited to 'WebCore/platform/KURLGoogle.cpp')
-rw-r--r--WebCore/platform/KURLGoogle.cpp42
1 files changed, 34 insertions, 8 deletions
diff --git a/WebCore/platform/KURLGoogle.cpp b/WebCore/platform/KURLGoogle.cpp
index d8b87e5..1cb08c1 100644
--- a/WebCore/platform/KURLGoogle.cpp
+++ b/WebCore/platform/KURLGoogle.cpp
@@ -504,7 +504,7 @@ String KURL::user() const
return m_url.componentString(m_url.m_parsed.username);
}
-String KURL::ref() const
+String KURL::fragmentIdentifier() const
{
// Empty but present refs ("foo.com/bar#") should result in the empty
// string, which m_url.componentString will produce. Nonexistant refs should be
@@ -516,7 +516,7 @@ String KURL::ref() const
return m_url.componentString(m_url.m_parsed.ref);
}
-bool KURL::hasRef() const
+bool KURL::hasFragmentIdentifier() const
{
// Note: KURL.cpp unescapes here.
// FIXME determine if KURL.cpp agrees about an empty ref
@@ -627,22 +627,22 @@ void KURL::setPass(const String& pass)
m_url.replaceComponents(replacements);
}
-void KURL::setRef(const String& ref)
+void KURL::setFragmentIdentifier(const String& s)
{
// This function is commonly called to clear the ref, which we
// normally don't have, so we optimize this case.
- if (ref.isNull() && !m_url.m_parsed.ref.is_valid())
+ if (s.isNull() && !m_url.m_parsed.ref.is_valid())
return;
KURLGooglePrivate::Replacements replacements;
- if (ref.isNull())
+ if (s.isNull())
replacements.ClearRef();
else
- replacements.SetRef(CharactersOrEmpty(ref), url_parse::Component(0, ref.length()));
+ replacements.SetRef(CharactersOrEmpty(s), url_parse::Component(0, s.length()));
m_url.replaceComponents(replacements);
}
-void KURL::removeRef()
+void KURL::removeFragmentIdentifier()
{
KURLGooglePrivate::Replacements replacements;
replacements.ClearRef();
@@ -885,7 +885,7 @@ void KURL::invalidate()
}
// Equal up to reference fragments, if any.
-bool equalIgnoringRef(const KURL& a, const KURL& b)
+bool equalIgnoringFragmentIdentifier(const KURL& a, const KURL& b)
{
// Compute the length of each URL without its ref. Note that the reference
// begin (if it exists) points to the character *after* the '#', so we need
@@ -957,6 +957,32 @@ inline bool KURL::protocolIs(const String& string, const char* protocol)
return WebCore::protocolIs(string, protocol);
}
+bool protocolHostAndPortAreEqual(const KURL& a, const KURL& b)
+{
+ if (a.parsed().scheme.end() != b.parsed().scheme.end())
+ return false;
+
+ int hostStartA = a.hostStart();
+ int hostStartB = b.hostStart();
+ if (a.hostEnd() - hostStartA != b.hostEnd() - hostStartB)
+ return false;
+
+ // Check the scheme
+ for (int i = 0; i < a.parsed().scheme.end(); ++i)
+ if (a.string()[i] != b.string()[i])
+ return false;
+
+ // And the host
+ for (int i = hostStartA; i < static_cast<int>(a.hostEnd()); ++i)
+ if (a.string()[i] != b.string()[i])
+ return false;
+
+ if (a.port() != b.port())
+ return false;
+
+ return true;
+}
+
} // namespace WebCore
#endif // USE(GOOGLEURL)