diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-23 00:26:10 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-23 00:26:10 +0000 |
commit | 3cb7ac76b29304309751e08579573f1905fb593d (patch) | |
tree | 9a9125e66418a50cb51b5f98cf87718f273e6f7d /webkit | |
parent | 9bb64604e7405e2d5cc7222beae542b4b0cb8c21 (diff) | |
download | chromium_src-3cb7ac76b29304309751e08579573f1905fb593d.zip chromium_src-3cb7ac76b29304309751e08579573f1905fb593d.tar.gz chromium_src-3cb7ac76b29304309751e08579573f1905fb593d.tar.bz2 |
Allow access to clipboard text in cut/paste event handlers. I
didn't change the ClipboardDataTypeURL case because I can't seem
to get data out of that in Safari either.
BUG=1330965
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1267 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/port/platform/ClipboardWin.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/webkit/port/platform/ClipboardWin.cpp b/webkit/port/platform/ClipboardWin.cpp index 42eafc6..2fa6ae3 100644 --- a/webkit/port/platform/ClipboardWin.cpp +++ b/webkit/port/platform/ClipboardWin.cpp @@ -58,8 +58,10 @@ #pragma warning(pop) #include "base/clipboard_util.h" +#include "base/string_util.h" #include "googleurl/src/gurl.h" #include "webkit/glue/glue_util.h" +#include "webkit/glue/webkit_glue.h" namespace WebCore { @@ -488,7 +490,20 @@ String ClipboardWin::getData(const String& type, bool& success) const ClipboardDataType dataType = clipboardTypeFromMIMEType(type); if (dataType == ClipboardDataTypeText) { std::wstring text; - success = ClipboardUtil::GetPlainText(m_dataObject.get(), &text); + if (!isForDragging()) { + // If this isn't for a drag, it's for a cut/paste event handler. + // In this case, we need to use our glue methods to access the + // clipboard contents. + webkit_glue::ClipboardReadText(&text); + if (text.empty()) { + std::string asciiText; + webkit_glue::ClipboardReadAsciiText(&asciiText); + text = ASCIIToWide(asciiText); + } + success = !text.empty(); + } else { + success = ClipboardUtil::GetPlainText(m_dataObject.get(), &text); + } return webkit_glue::StdWStringToString(text); } else if (dataType == ClipboardDataTypeURL) { std::wstring url; |