diff options
author | Kristian Monsen <kristianm@google.com> | 2010-06-28 16:42:48 +0100 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2010-07-02 10:29:56 +0100 |
commit | 06ea8e899e48f1f2f396b70e63fae369f2f23232 (patch) | |
tree | 20c1428cd05c76f32394ab354ea35ed99acd86d8 /WebCore/platform/gtk/DataObjectGtk.cpp | |
parent | 72aad67af14193199e29cdd5c4ddc095a8b9a8a8 (diff) | |
download | external_webkit-06ea8e899e48f1f2f396b70e63fae369f2f23232.zip external_webkit-06ea8e899e48f1f2f396b70e63fae369f2f23232.tar.gz external_webkit-06ea8e899e48f1f2f396b70e63fae369f2f23232.tar.bz2 |
Merge WebKit at r61871: Initial merge by git.
Change-Id: I6cff43abca9cc4782e088a469ad4f03f166a65d5
Diffstat (limited to 'WebCore/platform/gtk/DataObjectGtk.cpp')
-rw-r--r-- | WebCore/platform/gtk/DataObjectGtk.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/WebCore/platform/gtk/DataObjectGtk.cpp b/WebCore/platform/gtk/DataObjectGtk.cpp index 57d920c..db13345 100644 --- a/WebCore/platform/gtk/DataObjectGtk.cpp +++ b/WebCore/platform/gtk/DataObjectGtk.cpp @@ -21,6 +21,7 @@ #include "markup.h" #include <gtk/gtk.h> +#include <wtf/gobject/GOwnPtr.h> namespace WebCore { @@ -41,7 +42,7 @@ String DataObjectGtk::text() String DataObjectGtk::markup() { if (m_range) - return createMarkup(m_range.get(), 0, AnnotateForInterchange); + return createMarkup(m_range.get(), 0, AnnotateForInterchange, false, AbsoluteURLs); return m_markup; } @@ -58,6 +59,28 @@ void DataObjectGtk::setMarkup(const String& newMarkup) m_markup = newMarkup; } +void DataObjectGtk::setURL(const KURL& url, const String& label) +{ + setText(url.string()); + + String actualLabel(label); + if (actualLabel.isEmpty()) + actualLabel = url; + + Vector<UChar> markup; + append(markup, "<a href=\""); + append(markup, url.string()); + append(markup, "\">"); + GOwnPtr<gchar> escaped(g_markup_escape_text(actualLabel.utf8().data(), -1)); + append(markup, String::fromUTF8(escaped.get())); + append(markup, "</a>"); + setMarkup(String::adopt(markup)); + + Vector<KURL> uriList; + uriList.append(url); + setURIList(uriList); +} + void DataObjectGtk::clearText() { m_range = 0; |