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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 } 1034 }
1035 1035
1036 void RenderWidgetHostViewAura::SelectionChanged(const base::string16& text, 1036 void RenderWidgetHostViewAura::SelectionChanged(const base::string16& text,
1037 size_t offset, 1037 size_t offset,
1038 const gfx::Range& range) { 1038 const gfx::Range& range) {
1039 RenderWidgetHostViewBase::SelectionChanged(text, offset, range); 1039 RenderWidgetHostViewBase::SelectionChanged(text, offset, range);
1040 1040
1041 #if defined(USE_X11) && !defined(OS_CHROMEOS) 1041 #if defined(USE_X11) && !defined(OS_CHROMEOS)
1042 if (text.empty() || range.is_empty()) 1042 if (text.empty() || range.is_empty())
1043 return; 1043 return;
1044 size_t pos = range.GetMin() - offset;
1045 size_t n = range.length();
1046
1047 DCHECK(pos + n <= text.length()) << "The text can not fully cover range.";
1048 if (pos >= text.length()) {
1049 NOTREACHED() << "The text can not cover range.";
1050 return;
1051 }
1044 1052
1045 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. 1053 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard.
1046 ui::ScopedClipboardWriter clipboard_writer( 1054 ui::ScopedClipboardWriter clipboard_writer(
1047 ui::Clipboard::GetForCurrentThread(), 1055 ui::Clipboard::GetForCurrentThread(),
1048 ui::CLIPBOARD_TYPE_SELECTION); 1056 ui::CLIPBOARD_TYPE_SELECTION);
1049 clipboard_writer.WriteText(text); 1057 clipboard_writer.WriteText(text.substr(pos, n));
1050 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) 1058 #endif // defined(USE_X11) && !defined(OS_CHROMEOS)
1051 } 1059 }
1052 1060
1053 void RenderWidgetHostViewAura::SelectionBoundsChanged( 1061 void RenderWidgetHostViewAura::SelectionBoundsChanged(
1054 const ViewHostMsg_SelectionBounds_Params& params) { 1062 const ViewHostMsg_SelectionBounds_Params& params) {
1055 if (selection_anchor_rect_ == params.anchor_rect && 1063 if (selection_anchor_rect_ == params.anchor_rect &&
1056 selection_focus_rect_ == params.focus_rect) 1064 selection_focus_rect_ == params.focus_rect)
1057 return; 1065 return;
1058 1066
1059 selection_anchor_rect_ = params.anchor_rect; 1067 selection_anchor_rect_ = params.anchor_rect;
(...skipping 2535 matching lines...) Expand 10 before | Expand all | Expand 10 after
3595 RenderWidgetHost* widget) { 3603 RenderWidgetHost* widget) {
3596 return new RenderWidgetHostViewAura(widget); 3604 return new RenderWidgetHostViewAura(widget);
3597 } 3605 }
3598 3606
3599 // static 3607 // static
3600 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3608 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3601 GetScreenInfoForWindow(results, NULL); 3609 GetScreenInfoForWindow(results, NULL);
3602 } 3610 }
3603 3611
3604 } // namespace content 3612 } // namespace content
OLDNEW
« 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