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

Side by Side Diff: ui/views/touchui/touch_selection_controller_impl.cc

Issue 551883002: Deactivate touch selection on transform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Used the new propagated transformed event Created 6 years, 3 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 | « ui/views/touchui/touch_selection_controller_impl.h ('k') | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ui/views/touchui/touch_selection_controller_impl.h" 5 #include "ui/views/touchui/touch_selection_controller_impl.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "ui/aura/client/cursor_client.h" 8 #include "ui/aura/client/cursor_client.h"
9 #include "ui/aura/env.h" 9 #include "ui/aura/env.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 : client_view_(client_view), 320 : client_view_(client_view),
321 client_widget_(NULL), 321 client_widget_(NULL),
322 selection_handle_1_(new EditingHandleView(this, 322 selection_handle_1_(new EditingHandleView(this,
323 client_view->GetNativeView())), 323 client_view->GetNativeView())),
324 selection_handle_2_(new EditingHandleView(this, 324 selection_handle_2_(new EditingHandleView(this,
325 client_view->GetNativeView())), 325 client_view->GetNativeView())),
326 cursor_handle_(new EditingHandleView(this, 326 cursor_handle_(new EditingHandleView(this,
327 client_view->GetNativeView())), 327 client_view->GetNativeView())),
328 context_menu_(NULL), 328 context_menu_(NULL),
329 dragging_handle_(NULL) { 329 dragging_handle_(NULL) {
330 client_widget_ = Widget::GetTopLevelWidgetForNativeView( 330 aura::Window* client_window = client_view_->GetNativeView();
331 client_view_->GetNativeView()); 331 client_window->AddObserver(this);
332 client_widget_ = Widget::GetTopLevelWidgetForNativeView(client_window);
332 if (client_widget_) 333 if (client_widget_)
333 client_widget_->AddObserver(this); 334 client_widget_->AddObserver(this);
334 aura::Env::GetInstance()->AddPreTargetHandler(this); 335 aura::Env::GetInstance()->AddPreTargetHandler(this);
335 } 336 }
336 337
337 TouchSelectionControllerImpl::~TouchSelectionControllerImpl() { 338 TouchSelectionControllerImpl::~TouchSelectionControllerImpl() {
338 HideContextMenu(); 339 HideContextMenu();
339 aura::Env::GetInstance()->RemovePreTargetHandler(this); 340 aura::Env::GetInstance()->RemovePreTargetHandler(this);
340 if (client_widget_) 341 if (client_widget_)
341 client_widget_->RemoveObserver(this); 342 client_widget_->RemoveObserver(this);
343 client_view_->GetNativeView()->RemoveObserver(this);
342 } 344 }
343 345
344 void TouchSelectionControllerImpl::SelectionChanged() { 346 void TouchSelectionControllerImpl::SelectionChanged() {
345 gfx::Rect r1, r2; 347 gfx::Rect r1, r2;
346 client_view_->GetSelectionEndPoints(&r1, &r2); 348 client_view_->GetSelectionEndPoints(&r1, &r2);
347 gfx::Rect screen_rect_1 = ConvertToScreen(client_view_, r1); 349 gfx::Rect screen_rect_1 = ConvertToScreen(client_view_, r1);
348 gfx::Rect screen_rect_2 = ConvertToScreen(client_view_, r2); 350 gfx::Rect screen_rect_2 = ConvertToScreen(client_view_, r2);
349 gfx::Rect client_bounds = client_view_->GetBounds(); 351 gfx::Rect client_bounds = client_view_->GetBounds();
350 if (r1.y() < client_bounds.y()) 352 if (r1.y() < client_bounds.y())
351 r1.Inset(0, client_bounds.y() - r1.y(), 0, 0); 353 r1.Inset(0, client_bounds.y() - r1.y(), 0, 0);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 const gfx::Point anchor(rect.CenterPoint().x(), rect.y()); 504 const gfx::Point anchor(rect.CenterPoint().x(), rect.y());
503 HideContextMenu(); 505 HideContextMenu();
504 client_view_->OpenContextMenu(anchor); 506 client_view_->OpenContextMenu(anchor);
505 } 507 }
506 508
507 void TouchSelectionControllerImpl::OnMenuClosed(TouchEditingMenuView* menu) { 509 void TouchSelectionControllerImpl::OnMenuClosed(TouchEditingMenuView* menu) {
508 if (menu == context_menu_) 510 if (menu == context_menu_)
509 context_menu_ = NULL; 511 context_menu_ = NULL;
510 } 512 }
511 513
514 void TouchSelectionControllerImpl::OnAncestorWindowTransformed(
515 aura::Window* window,
516 aura::Window* ancestor) {
517 client_view_->DestroyTouchSelection();
518 }
519
512 void TouchSelectionControllerImpl::OnWidgetClosing(Widget* widget) { 520 void TouchSelectionControllerImpl::OnWidgetClosing(Widget* widget) {
513 DCHECK_EQ(client_widget_, widget); 521 DCHECK_EQ(client_widget_, widget);
514 client_widget_ = NULL; 522 client_widget_ = NULL;
515 } 523 }
516 524
517 void TouchSelectionControllerImpl::OnWidgetBoundsChanged( 525 void TouchSelectionControllerImpl::OnWidgetBoundsChanged(
518 Widget* widget, 526 Widget* widget,
519 const gfx::Rect& new_bounds) { 527 const gfx::Rect& new_bounds) {
520 DCHECK_EQ(client_widget_, widget); 528 DCHECK_EQ(client_widget_, widget);
521 SelectionChanged(); 529 SelectionChanged();
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 625
618 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { 626 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() {
619 return selection_handle_2_->IsWidgetVisible(); 627 return selection_handle_2_->IsWidgetVisible();
620 } 628 }
621 629
622 bool TouchSelectionControllerImpl::IsCursorHandleVisible() { 630 bool TouchSelectionControllerImpl::IsCursorHandleVisible() {
623 return cursor_handle_->IsWidgetVisible(); 631 return cursor_handle_->IsWidgetVisible();
624 } 632 }
625 633
626 } // namespace views 634 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/touchui/touch_selection_controller_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698