diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-01 21:03:08 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-01 21:03:08 +0000 |
commit | 8bbe7efe110336916c819fdc7f5566afa3a97495 (patch) | |
tree | 6d473efd35ca0f48584dd3254e8b4e5ebd708fbb /webkit/glue/webframe_impl.cc | |
parent | d294668d4c62e94c342cff58b1096af8106113ef (diff) | |
download | chromium_src-8bbe7efe110336916c819fdc7f5566afa3a97495.zip chromium_src-8bbe7efe110336916c819fdc7f5566afa3a97495.tar.gz chromium_src-8bbe7efe110336916c819fdc7f5566afa3a97495.tar.bz2 |
Enable the X selection clipboard for copying html and text out of a linux test shell.
I implemented it in the webview delegate, so when we switch to the
multiprocess architecture, we will need to find out if the clipboard callback
can be async (the current method would require a sync call from browser to
renderer to get the selected text).
Review URL: http://codereview.chromium.org/12700
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6160 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webframe_impl.cc')
-rw-r--r-- | webkit/glue/webframe_impl.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index 70cbc61..78ac3d4 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -1340,6 +1340,16 @@ void WebFrameImpl::ClearSelection() { frame()->selection()->clear(); } +std::string WebFrameImpl::GetSelection(bool as_html) { + RefPtr<Range> range = frame()->selection()->toRange(); + if (as_html) { + String markup = WebCore::createMarkup(range.get(), 0); + return webkit_glue::StringToStdString(markup); + } else { + return webkit_glue::StringToStdString(range->text()); + } +} + void WebFrameImpl::CreateFrameView() { ASSERT(frame_); // If frame_ doesn't exist, we probably didn't init properly. |