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

Side by Side Diff: content/browser/web_contents/touch_editable_impl_aura_browsertest.cc

Issue 769393002: Minor visual improvements to text selection UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing the failing test Created 6 years 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 | ui/views/touchui/touch_selection_controller_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 (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/web_contents/touch_editable_impl_aura.h" 5 #include "content/browser/web_contents/touch_editable_impl_aura.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 value->GetAsString(&selection); 197 value->GetAsString(&selection);
198 198
199 // Check if selection handles are showing. 199 // Check if selection handles are showing.
200 EXPECT_TRUE(GetTouchSelectionController(touch_editable)); 200 EXPECT_TRUE(GetTouchSelectionController(touch_editable));
201 EXPECT_STREQ("Some text we can select", selection.c_str()); 201 EXPECT_STREQ("Some text we can select", selection.c_str());
202 202
203 // Lets move the handles a bit to modify the selection 203 // Lets move the handles a bit to modify the selection
204 touch_editable->Reset(); 204 touch_editable->Reset();
205 ui::SelectionBound anchor, focus; 205 ui::SelectionBound anchor, focus;
206 touch_editable->GetSelectionEndPoints(&anchor, &focus); 206 touch_editable->GetSelectionEndPoints(&anchor, &focus);
207 // The distance by which a handle image is offset from the bottom of the
208 // selection/text baseline.
209 const int kSelectionHandleVerticalVisualOffset = 2;
207 int handle_grab_x = bounds.x() + anchor.edge_bottom_rounded().x(); 210 int handle_grab_x = bounds.x() + anchor.edge_bottom_rounded().x();
208 int handle_grab_y = bounds.y() + anchor.edge_bottom_rounded().y() + 1; 211 int handle_grab_y = bounds.y() + anchor.edge_bottom_rounded().y() +
212 kSelectionHandleVerticalVisualOffset + 1;
209 generator.GestureScrollSequence( 213 generator.GestureScrollSequence(
210 gfx::Point(handle_grab_x, handle_grab_y), 214 gfx::Point(handle_grab_x, handle_grab_y),
211 gfx::Point(handle_grab_x + 20, handle_grab_y), 215 gfx::Point(handle_grab_x + 20, handle_grab_y),
212 base::TimeDelta::FromMilliseconds(20), 216 base::TimeDelta::FromMilliseconds(20),
213 5); 217 5);
214 touch_editable->WaitForSelectionChangeCallback(); 218 touch_editable->WaitForSelectionChangeCallback();
215 219
216 EXPECT_TRUE(GetTouchSelectionController(touch_editable)); 220 EXPECT_TRUE(GetTouchSelectionController(touch_editable));
217 value = content::ExecuteScriptAndGetValue(main_frame, "get_selection()"); 221 value = content::ExecuteScriptAndGetValue(main_frame, "get_selection()");
218 value->GetAsString(&selection); 222 value->GetAsString(&selection);
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 value = content::ExecuteScriptAndGetValue(main_frame, 459 value = content::ExecuteScriptAndGetValue(main_frame,
456 "get_cursor_position()"); 460 "get_cursor_position()");
457 int new_cursor_pos = -1; 461 int new_cursor_pos = -1;
458 value->GetAsInteger(&new_cursor_pos); 462 value->GetAsInteger(&new_cursor_pos);
459 EXPECT_NE(-1, new_cursor_pos); 463 EXPECT_NE(-1, new_cursor_pos);
460 // Cursor should have moved. 464 // Cursor should have moved.
461 EXPECT_NE(new_cursor_pos, cursor_pos); 465 EXPECT_NE(new_cursor_pos, cursor_pos);
462 } 466 }
463 467
464 } // namespace content 468 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/views/touchui/touch_selection_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698