diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-19 01:20:01 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-19 01:20:01 +0000 |
commit | 22cf8687fe6c4fc4dbb2b9b2ac41d7d45f656d83 (patch) | |
tree | df838980effe3721bdc41b6acea356bf6352df8e /webkit/port/platform/chromium | |
parent | 234ebdecf98582ca141b9066b1e5f4f74d3bdbff (diff) | |
download | chromium_src-22cf8687fe6c4fc4dbb2b9b2ac41d7d45f656d83.zip chromium_src-22cf8687fe6c4fc4dbb2b9b2ac41d7d45f656d83.tar.gz chromium_src-22cf8687fe6c4fc4dbb2b9b2ac41d7d45f656d83.tar.bz2 |
Remove cf_html from webdropdata.h. This is windows
specific code so we should handle it before we get
to webkit.
CF_HTML needs the source URL to resolve relative URLs
so I added that to the format and plumb it through
from webcore.
I also did some small refactoring so we only have one
implementation of converting to/from CF_HTML and regular
markup. We can tweak these converters (and add unit tests)
in follow up changes.
Review URL: http://codereview.chromium.org/11247
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5662 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port/platform/chromium')
4 files changed, 19 insertions, 15 deletions
diff --git a/webkit/port/platform/chromium/ChromiumDataObject.cpp b/webkit/port/platform/chromium/ChromiumDataObject.cpp index ddf9cd9..54da838 100644 --- a/webkit/port/platform/chromium/ChromiumDataObject.cpp +++ b/webkit/port/platform/chromium/ChromiumDataObject.cpp @@ -39,6 +39,7 @@ void ChromiumDataObject::clear() filenames.clear(); plain_text = ""; text_html = ""; + html_base_url = KURL(); file_content_filename = ""; if (file_content) file_content->clear(); diff --git a/webkit/port/platform/chromium/ChromiumDataObject.h b/webkit/port/platform/chromium/ChromiumDataObject.h index f6178f3..bdbb62c 100644 --- a/webkit/port/platform/chromium/ChromiumDataObject.h +++ b/webkit/port/platform/chromium/ChromiumDataObject.h @@ -57,6 +57,7 @@ namespace WebCore { String plain_text; String text_html; + KURL html_base_url; String file_content_filename; RefPtr<SharedBuffer> file_content; diff --git a/webkit/port/platform/chromium/ClipboardChromium.cpp b/webkit/port/platform/chromium/ClipboardChromium.cpp index 663a341..5087cdf 100644 --- a/webkit/port/platform/chromium/ClipboardChromium.cpp +++ b/webkit/port/platform/chromium/ClipboardChromium.cpp @@ -331,6 +331,7 @@ void ClipboardChromium::writeURL(const KURL& url, const String& title, Frame*) // The URL can also be used as an HTML fragment. m_dataObject->text_html = urlToMarkup(url, title); + m_dataObject->html_base_url = url; } void ClipboardChromium::writeRange(Range* selectedRange, Frame* frame) @@ -341,6 +342,7 @@ void ClipboardChromium::writeRange(Range* selectedRange, Frame* frame) m_dataObject->text_html = createMarkup(selectedRange, 0, AnnotateForInterchange); + m_dataObject->html_base_url = frame->document()->url(); String str = frame->selectedText(); #if PLATFORM(WIN_OS) diff --git a/webkit/port/platform/chromium/DragDataChromium.cpp b/webkit/port/platform/chromium/DragDataChromium.cpp index 3507739..d615559 100644 --- a/webkit/port/platform/chromium/DragDataChromium.cpp +++ b/webkit/port/platform/chromium/DragDataChromium.cpp @@ -126,21 +126,21 @@ PassRefPtr<DocumentFragment> DragData::asFragment(Document* doc) const * * PICT */ - // TODO(tc): Disabled because containsFilenames is hardcoded to return - // false. We need to implement fragmentFromFilenames when this is - // re-enabled in Apple's win port. - //if (containsFilenames()) - // if (PassRefPtr<DocumentFragment> fragment = fragmentFromFilenames(doc, m_platformDragData)) - // return fragment; - - if (!m_platformDragData->text_html.isEmpty()) { - String url; - RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(doc, - m_platformDragData->text_html, url); - return fragment; - } - - return 0; + if (containsFiles()) { + // TODO(tc): Implement this. Should be pretty simple to make some HTML + // and call createFragmentFromMarkup. + //if (RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(doc, + // ?, KURL())) + // return fragment; + } + + if (!m_platformDragData->text_html.isEmpty()) { + RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(doc, + m_platformDragData->text_html, m_platformDragData->html_base_url); + return fragment.release(); + } + + return 0; } Color DragData::asColor() const |