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

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 | « ui/base/clipboard/clipboard_unittest.cc ('k') | 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..2115408ec1b3f785d57e91a0c5d44f57b009fda7 100644
--- a/ui/base/clipboard/clipboard_win.cc
+++ b/ui/base/clipboard/clipboard_win.cc
@@ -17,6 +17,7 @@
#include "base/stl_util.h"
#include "base/string_util.h"
#include "base/string_number_conversions.h"
+#include "base/utf_offset_string_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/win/scoped_gdi_object.h"
#include "base/win/scoped_hdc.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 | « ui/base/clipboard/clipboard_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698