Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: ui/base/clipboard/clipboard_win.cc

Issue 8429022: Adjust fragment indices appropriately when pasting HTML on Windows. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/clipboard/clipboard_win.cc
diff --git a/ui/base/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc
index 635b4795a48a7f695105a763ecf9607c35ed1783..e34f2969050c2103738a1bf993076dd79a9c7be1 100644
--- a/ui/base/clipboard/clipboard_win.cc
+++ b/ui/base/clipboard/clipboard_win.cc
@@ -18,6 +18,7 @@
#include "base/string_util.h"
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
+#include "base/utf_offset_string_conversions.h"
tony 2011/10/31 22:09:22 Nit: alphabetize
dcheng 2011/10/31 23:41:44 Done.
#include "base/win/scoped_gdi_object.h"
#include "base/win/scoped_hdc.h"
#include "base/win/wrapped_window_proc.h"
@@ -466,9 +467,13 @@ void Clipboard::ReadHTML(Clipboard::Buffer buffer, string16* markup,
DCHECK((start_index - html_start) <= kuint32max);
DCHECK((end_index - html_start) <= kuint32max);
- markup->assign(UTF8ToWide(cf_html.data() + html_start));
- *fragment_start = static_cast<uint32>(start_index - html_start);
- *fragment_end = static_cast<uint32>(end_index - html_start);
+ std::vector<size_t> offsets;
+ offsets.push_back(start_index - html_start);
+ offsets.push_back(end_index - html_start);
+ markup->assign(UTF8ToUTF16AndAdjustOffsets(cf_html.data() + html_start,
+ &offsets));
+ *fragment_start = static_cast<uint32>(offsets[0]);
+ *fragment_end = static_cast<uint32>(offsets[1]);
}
SkBitmap Clipboard::ReadImage(Buffer buffer) const {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698