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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 205493003: linux_aura: Fix PRIMARY selection in the content area. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix style nit Created 6 years, 9 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: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 6467e701bf5dea13360764139ee008f17a50d8ca..33fc7e764fdcb302ab1b89d125f379352c057e96 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -1041,12 +1041,20 @@ void RenderWidgetHostViewAura::SelectionChanged(const base::string16& text,
#if defined(USE_X11) && !defined(OS_CHROMEOS)
if (text.empty() || range.is_empty())
return;
+ size_t pos = range.GetMin() - offset;
+ size_t n = range.length();
+
+ DCHECK(pos + n <= text.length()) << "The text can not fully cover range.";
+ if (pos >= text.length()) {
+ NOTREACHED() << "The text can not cover range.";
+ return;
+ }
// Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard.
ui::ScopedClipboardWriter clipboard_writer(
ui::Clipboard::GetForCurrentThread(),
ui::CLIPBOARD_TYPE_SELECTION);
- clipboard_writer.WriteText(text);
+ clipboard_writer.WriteText(text.substr(pos, n));
#endif // defined(USE_X11) && !defined(OS_CHROMEOS)
}
« 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