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

Side by Side Diff: content/browser/renderer_host/input/touch_selection_controller_client_child_frame.cc

Issue 2910223003: [refactor] - Rename and Move WebWidget::CaretOrSelectionRange to WebInputMethodController::GetSelec… (Closed)
Patch Set: Fixed some comments Created 3 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 | « no previous file | content/renderer/input/frame_input_handler_impl.cc » ('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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/input/touch_selection_controller_client_ child_frame.h" 5 #include "content/browser/renderer_host/input/touch_selection_controller_client_ child_frame.h"
6 6
7 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" 7 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
8 #include "content/browser/renderer_host/input/touch_selection_controller_client_ manager.h" 8 #include "content/browser/renderer_host/input/touch_selection_controller_client_ manager.h"
9 #include "content/browser/renderer_host/render_widget_host_delegate.h" 9 #include "content/browser/renderer_host/render_widget_host_delegate.h"
10 #include "content/browser/renderer_host/render_widget_host_impl.h" 10 #include "content/browser/renderer_host/render_widget_host_impl.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 std::unique_ptr<ui::TouchHandleDrawable> 117 std::unique_ptr<ui::TouchHandleDrawable>
118 TouchSelectionControllerClientChildFrame::CreateDrawable() { 118 TouchSelectionControllerClientChildFrame::CreateDrawable() {
119 NOTREACHED(); 119 NOTREACHED();
120 return std::unique_ptr<ui::TouchHandleDrawable>(); 120 return std::unique_ptr<ui::TouchHandleDrawable>();
121 } 121 }
122 122
123 bool TouchSelectionControllerClientChildFrame::IsCommandIdEnabled( 123 bool TouchSelectionControllerClientChildFrame::IsCommandIdEnabled(
124 int command_id) const { 124 int command_id) const {
125 bool editable = rwhv_->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; 125 bool editable = rwhv_->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE;
126 bool readable = rwhv_->GetTextInputType() != ui::TEXT_INPUT_TYPE_PASSWORD; 126 bool readable = rwhv_->GetTextInputType() != ui::TEXT_INPUT_TYPE_PASSWORD;
127 // TODO(wjmaclean): The test for has_selection should be changed to 127
128 // 128 gfx::Range selection_range;
129 // rwhv_->GetSelectionRange(&selection_range); 129 bool has_selection =
130 // bool has_selection = !selection_range.is_empty(); 130 rwhv_->GetSelectionRange(&selection_range) && !selection_range.is_empty();
dcheng 2017/06/20 09:05:47 Can you help me understand what the difference bet
EhsanK 2017/07/10 15:38:29 They come from two different IPCs. * |selection
wjmaclean 2017/07/10 18:36:07 If you compare the pre- vs. post-patch code here,
131 //
132 // like in TouchSelectionControllerClientAura. Unfortunately this fails here
133 // due to https://crbug.com/723790, which means that the first text
134 // selected in an oopif subframe when it acquires focus will fail to send
135 // a FrameHostMsg_SelectionChanged, meaning the TextInputManager won't
136 // know about the new selection.
137 bool has_selection = selection_start_.type() != gfx::SelectionBound::EMPTY &&
138 selection_end_.type() != gfx::SelectionBound::EMPTY &&
139 selection_start_ != selection_end_;
140 switch (command_id) { 131 switch (command_id) {
141 case IDS_APP_CUT: 132 case IDS_APP_CUT:
142 return editable && readable && has_selection; 133 return editable && readable && has_selection;
143 case IDS_APP_COPY: 134 case IDS_APP_COPY:
144 return readable && has_selection; 135 return readable && has_selection;
145 case IDS_APP_PASTE: { 136 case IDS_APP_PASTE: {
146 base::string16 result; 137 base::string16 result;
147 ui::Clipboard::GetForCurrentThread()->ReadText( 138 ui::Clipboard::GetForCurrentThread()->ReadText(
148 ui::CLIPBOARD_TYPE_COPY_PASTE, &result); 139 ui::CLIPBOARD_TYPE_COPY_PASTE, &result);
149 return editable && !result.empty(); 140 return editable && !result.empty();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 gfx::ToRoundedPoint(anchor_point))); 183 gfx::ToRoundedPoint(anchor_point)));
193 184
194 // Hide selection handles after getting rect-between-bounds from touch 185 // Hide selection handles after getting rect-between-bounds from touch
195 // selection controller; otherwise, rect would be empty and the above 186 // selection controller; otherwise, rect would be empty and the above
196 // calculations would be invalid. 187 // calculations would be invalid.
197 manager_->GetTouchSelectionController() 188 manager_->GetTouchSelectionController()
198 ->HideAndDisallowShowingAutomatically(); 189 ->HideAndDisallowShowingAutomatically();
199 } 190 }
200 191
201 } // namespace content 192 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/input/frame_input_handler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698