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

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

Issue 11418040: gfx::Transform API clean-up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month 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
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/web_contents_view_aura.h" 5 #include "content/browser/web_contents/web_contents_view_aura.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "content/browser/renderer_host/dip_util.h" 9 #include "content/browser/renderer_host/dip_util.h"
10 #include "content/browser/renderer_host/overscroll_controller.h" 10 #include "content/browser/renderer_host/overscroll_controller.h"
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 return; 435 return;
436 436
437 completed_overscroll_gesture_ = mode; 437 completed_overscroll_gesture_ = mode;
438 aura::Window* target = GetWindowToAnimateForOverscroll(); 438 aura::Window* target = GetWindowToAnimateForOverscroll();
439 ui::ScopedLayerAnimationSettings settings(target->layer()->GetAnimator()); 439 ui::ScopedLayerAnimationSettings settings(target->layer()->GetAnimator());
440 settings.SetPreemptionStrategy(ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); 440 settings.SetPreemptionStrategy(ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
441 settings.SetTweenType(ui::Tween::EASE_OUT); 441 settings.SetTweenType(ui::Tween::EASE_OUT);
442 settings.AddObserver(this); 442 settings.AddObserver(this);
443 gfx::Transform transform; 443 gfx::Transform transform;
444 int content_width = view_->GetViewBounds().width(); 444 int content_width = view_->GetViewBounds().width();
445 transform.SetTranslateX(mode == OVERSCROLL_WEST ? -content_width : 445 transform.Translate(mode == OVERSCROLL_WEST ? -content_width : content_width,
446 content_width); 446 0);
447 target->SetTransform(transform); 447 target->SetTransform(transform);
448 } 448 }
449 449
450 aura::Window* WebContentsViewAura::GetWindowToAnimateForOverscroll() { 450 aura::Window* WebContentsViewAura::GetWindowToAnimateForOverscroll() {
451 if (current_overscroll_gesture_ == OVERSCROLL_NONE) 451 if (current_overscroll_gesture_ == OVERSCROLL_NONE)
452 return NULL; 452 return NULL;
453 453
454 if (current_overscroll_gesture_ == OVERSCROLL_WEST && 454 if (current_overscroll_gesture_ == OVERSCROLL_WEST &&
455 web_contents_->GetController().CanGoForward()) { 455 web_contents_->GetController().CanGoForward()) {
456 return overscroll_window_.get(); 456 return overscroll_window_.get();
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 722
723 void WebContentsViewAura::OnOverscrollUpdate(float delta_x, float delta_y) { 723 void WebContentsViewAura::OnOverscrollUpdate(float delta_x, float delta_y) {
724 if (current_overscroll_gesture_ == OVERSCROLL_NONE) 724 if (current_overscroll_gesture_ == OVERSCROLL_NONE)
725 return; 725 return;
726 726
727 aura::Window* target = GetWindowToAnimateForOverscroll(); 727 aura::Window* target = GetWindowToAnimateForOverscroll();
728 ui::ScopedLayerAnimationSettings settings(target->layer()->GetAnimator()); 728 ui::ScopedLayerAnimationSettings settings(target->layer()->GetAnimator());
729 settings.SetPreemptionStrategy(ui::LayerAnimator::IMMEDIATELY_SET_NEW_TARGET); 729 settings.SetPreemptionStrategy(ui::LayerAnimator::IMMEDIATELY_SET_NEW_TARGET);
730 gfx::Vector2d translate = GetTranslationForOverscroll(delta_x, delta_y); 730 gfx::Vector2d translate = GetTranslationForOverscroll(delta_x, delta_y);
731 gfx::Transform transform; 731 gfx::Transform transform;
732 transform.SetTranslate(translate.x(), translate.y()); 732 transform.Translate(translate.x(), translate.y());
733 target->SetTransform(transform); 733 target->SetTransform(transform);
734 } 734 }
735 735
736 void WebContentsViewAura::OnOverscrollComplete(OverscrollMode mode) { 736 void WebContentsViewAura::OnOverscrollComplete(OverscrollMode mode) {
737 if (mode == OVERSCROLL_WEST) { 737 if (mode == OVERSCROLL_WEST) {
738 NavigationControllerImpl& controller = web_contents_->GetController(); 738 NavigationControllerImpl& controller = web_contents_->GetController();
739 if (controller.CanGoForward()) { 739 if (controller.CanGoForward()) {
740 CompleteOverscrollNavigation(mode); 740 CompleteOverscrollNavigation(mode);
741 return; 741 return;
742 } 742 }
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 event.location(), 980 event.location(),
981 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), 981 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(),
982 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); 982 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags()));
983 if (drag_dest_delegate_) 983 if (drag_dest_delegate_)
984 drag_dest_delegate_->OnDrop(); 984 drag_dest_delegate_->OnDrop();
985 current_drop_data_.reset(); 985 current_drop_data_.reset();
986 return current_drag_op_; 986 return current_drag_op_;
987 } 987 }
988 988
989 } // namespace content 989 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_install_dialog_view.cc ('k') | ui/aura/root_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698