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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 2034863002: Move SelectionBound from ui/base/touch to ui/gfx to be used by cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated views_unittests Created 4 years, 6 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | ui/base/BUILD.gn » ('j') | 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 <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 clipboard_writer.WriteText(text.substr(pos, n)); 1060 clipboard_writer.WriteText(text.substr(pos, n));
1061 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) 1061 #endif // defined(USE_X11) && !defined(OS_CHROMEOS)
1062 } 1062 }
1063 1063
1064 gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const { 1064 gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const {
1065 return delegated_frame_host_->GetRequestedRendererSize(); 1065 return delegated_frame_host_->GetRequestedRendererSize();
1066 } 1066 }
1067 1067
1068 void RenderWidgetHostViewAura::SelectionBoundsChanged( 1068 void RenderWidgetHostViewAura::SelectionBoundsChanged(
1069 const ViewHostMsg_SelectionBounds_Params& params) { 1069 const ViewHostMsg_SelectionBounds_Params& params) {
1070 ui::SelectionBound anchor_bound, focus_bound; 1070 gfx::SelectionBound anchor_bound, focus_bound;
1071 anchor_bound.SetEdge(gfx::PointF(params.anchor_rect.origin()), 1071 anchor_bound.SetEdge(gfx::PointF(params.anchor_rect.origin()),
1072 gfx::PointF(params.anchor_rect.bottom_left())); 1072 gfx::PointF(params.anchor_rect.bottom_left()));
1073 focus_bound.SetEdge(gfx::PointF(params.focus_rect.origin()), 1073 focus_bound.SetEdge(gfx::PointF(params.focus_rect.origin()),
1074 gfx::PointF(params.focus_rect.bottom_left())); 1074 gfx::PointF(params.focus_rect.bottom_left()));
1075 1075
1076 if (params.anchor_rect == params.focus_rect) { 1076 if (params.anchor_rect == params.focus_rect) {
1077 anchor_bound.set_type(ui::SelectionBound::CENTER); 1077 anchor_bound.set_type(gfx::SelectionBound::CENTER);
1078 focus_bound.set_type(ui::SelectionBound::CENTER); 1078 focus_bound.set_type(gfx::SelectionBound::CENTER);
1079 } else { 1079 } else {
1080 // Whether text is LTR at the anchor handle. 1080 // Whether text is LTR at the anchor handle.
1081 bool anchor_LTR = params.anchor_dir == blink::WebTextDirectionLeftToRight; 1081 bool anchor_LTR = params.anchor_dir == blink::WebTextDirectionLeftToRight;
1082 // Whether text is LTR at the focus handle. 1082 // Whether text is LTR at the focus handle.
1083 bool focus_LTR = params.focus_dir == blink::WebTextDirectionLeftToRight; 1083 bool focus_LTR = params.focus_dir == blink::WebTextDirectionLeftToRight;
1084 1084
1085 if ((params.is_anchor_first && anchor_LTR) || 1085 if ((params.is_anchor_first && anchor_LTR) ||
1086 (!params.is_anchor_first && !anchor_LTR)) { 1086 (!params.is_anchor_first && !anchor_LTR)) {
1087 anchor_bound.set_type(ui::SelectionBound::LEFT); 1087 anchor_bound.set_type(gfx::SelectionBound::LEFT);
1088 } else { 1088 } else {
1089 anchor_bound.set_type(ui::SelectionBound::RIGHT); 1089 anchor_bound.set_type(gfx::SelectionBound::RIGHT);
1090 } 1090 }
1091 if ((params.is_anchor_first && focus_LTR) || 1091 if ((params.is_anchor_first && focus_LTR) ||
1092 (!params.is_anchor_first && !focus_LTR)) { 1092 (!params.is_anchor_first && !focus_LTR)) {
1093 focus_bound.set_type(ui::SelectionBound::RIGHT); 1093 focus_bound.set_type(gfx::SelectionBound::RIGHT);
1094 } else { 1094 } else {
1095 focus_bound.set_type(ui::SelectionBound::LEFT); 1095 focus_bound.set_type(gfx::SelectionBound::LEFT);
1096 } 1096 }
1097 } 1097 }
1098 1098
1099 if (anchor_bound == selection_anchor_ && focus_bound == selection_focus_) 1099 if (anchor_bound == selection_anchor_ && focus_bound == selection_focus_)
1100 return; 1100 return;
1101 1101
1102 selection_anchor_ = anchor_bound; 1102 selection_anchor_ = anchor_bound;
1103 selection_focus_ = focus_bound; 1103 selection_focus_ = focus_bound;
1104 if (GetInputMethod()) 1104 if (GetInputMethod())
1105 GetInputMethod()->OnCaretBoundsChanged(this); 1105 GetInputMethod()->OnCaretBoundsChanged(this);
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 origin.y(), 1569 origin.y(),
1570 end.x() - origin.x(), 1570 end.x() - origin.x(),
1571 end.y() - origin.y()); 1571 end.y() - origin.y());
1572 } 1572 }
1573 1573
1574 return rect; 1574 return rect;
1575 } 1575 }
1576 1576
1577 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const { 1577 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const {
1578 return ConvertRectToScreen( 1578 return ConvertRectToScreen(
1579 ui::RectBetweenSelectionBounds(selection_anchor_, selection_focus_)); 1579 gfx::RectBetweenSelectionBounds(selection_anchor_, selection_focus_));
1580 } 1580 }
1581 1581
1582 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds( 1582 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds(
1583 uint32_t index, 1583 uint32_t index,
1584 gfx::Rect* rect) const { 1584 gfx::Rect* rect) const {
1585 DCHECK(rect); 1585 DCHECK(rect);
1586 if (index >= composition_character_bounds_.size()) 1586 if (index >= composition_character_bounds_.size())
1587 return false; 1587 return false;
1588 *rect = ConvertRectToScreen(composition_character_bounds_[index]); 1588 *rect = ConvertRectToScreen(composition_character_bounds_[index]);
1589 return true; 1589 return true;
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after
2754 NativeWebKeyboardEvent copy_event(event); 2754 NativeWebKeyboardEvent copy_event(event);
2755 copy_event.match_edit_command = true; 2755 copy_event.match_edit_command = true;
2756 target_host->ForwardKeyboardEvent(event); 2756 target_host->ForwardKeyboardEvent(event);
2757 return; 2757 return;
2758 } 2758 }
2759 #endif 2759 #endif
2760 2760
2761 target_host->ForwardKeyboardEvent(event); 2761 target_host->ForwardKeyboardEvent(event);
2762 } 2762 }
2763 2763
2764 void RenderWidgetHostViewAura::SelectionUpdated(bool is_editable, 2764 void RenderWidgetHostViewAura::SelectionUpdated(
2765 bool is_empty_text_form_control, 2765 bool is_editable,
2766 const ui::SelectionBound& start, 2766 bool is_empty_text_form_control,
2767 const ui::SelectionBound& end) { 2767 const gfx::SelectionBound& start,
2768 const gfx::SelectionBound& end) {
2768 selection_controller_->OnSelectionEditable(is_editable); 2769 selection_controller_->OnSelectionEditable(is_editable);
2769 selection_controller_->OnSelectionEmpty(is_empty_text_form_control); 2770 selection_controller_->OnSelectionEmpty(is_empty_text_form_control);
2770 selection_controller_->OnSelectionBoundsChanged(start, end); 2771 selection_controller_->OnSelectionBoundsChanged(start, end);
2771 } 2772 }
2772 2773
2773 void RenderWidgetHostViewAura::CreateSelectionController() { 2774 void RenderWidgetHostViewAura::CreateSelectionController() {
2774 ui::TouchSelectionController::Config tsc_config; 2775 ui::TouchSelectionController::Config tsc_config;
2775 tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds( 2776 tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds(
2776 ui::GestureConfiguration::GetInstance()->long_press_time_in_ms()); 2777 ui::GestureConfiguration::GetInstance()->long_press_time_in_ms());
2777 tsc_config.tap_slop = ui::GestureConfiguration::GetInstance() 2778 tsc_config.tap_slop = ui::GestureConfiguration::GetInstance()
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
2990 2991
2991 //////////////////////////////////////////////////////////////////////////////// 2992 ////////////////////////////////////////////////////////////////////////////////
2992 // RenderWidgetHostViewBase, public: 2993 // RenderWidgetHostViewBase, public:
2993 2994
2994 // static 2995 // static
2995 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2996 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2996 GetScreenInfoForWindow(results, NULL); 2997 GetScreenInfoForWindow(results, NULL);
2997 } 2998 }
2998 2999
2999 } // namespace content 3000 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | ui/base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698