| Index: ui/views/controls/slide_out_view.cc
|
| diff --git a/ui/views/controls/slide_out_view.cc b/ui/views/controls/slide_out_view.cc
|
| index 2ecf3cda6bc0b182cb5364872211b1fd3dbe8bfc..d7cb3f6ef5fed7f0157b206bec119dcadafd73cf 100644
|
| --- a/ui/views/controls/slide_out_view.cc
|
| +++ b/ui/views/controls/slide_out_view.cc
|
| @@ -12,8 +12,12 @@ namespace views {
|
|
|
| SlideOutView::SlideOutView()
|
| : gesture_scroll_amount_(0.f) {
|
| - SetPaintToLayer(true);
|
| - SetFillsBoundsOpaquely(false);
|
| + // If accelerated compositing is not available, this widget tracks the
|
| + // OnSlideOut event but does not render any visible changes.
|
| + if (get_use_acceleration_when_possible()) {
|
| + SetPaintToLayer(true);
|
| + SetFillsBoundsOpaquely(false);
|
| + }
|
| }
|
|
|
| SlideOutView::~SlideOutView() {
|
| @@ -43,11 +47,14 @@ void SlideOutView::OnGestureEvent(ui::GestureEvent* event) {
|
| // The scroll-update events include the incremental scroll amount.
|
| gesture_scroll_amount_ += event->details().scroll_x();
|
|
|
| - gfx::Transform transform;
|
| - transform.Translate(gesture_scroll_amount_, 0.0);
|
| - layer()->SetTransform(transform);
|
| - layer()->SetOpacity(
|
| - 1.f - std::min(fabsf(gesture_scroll_amount_) / width(), 1.f));
|
| + if (get_use_acceleration_when_possible()) {
|
| + gfx::Transform transform;
|
| + transform.Translate(gesture_scroll_amount_, 0.0);
|
| + layer()->SetTransform(transform);
|
| + layer()->SetOpacity(
|
| + 1.f - std::min(fabsf(gesture_scroll_amount_) / width(), 1.f));
|
| + }
|
| +
|
| } else if (event->type() == ui::ET_GESTURE_SCROLL_END) {
|
| const float kScrollRatioForClosingNotification = 0.5f;
|
| float scrolled_ratio = fabsf(gesture_scroll_amount_) / width();
|
| @@ -63,6 +70,9 @@ void SlideOutView::OnGestureEvent(ui::GestureEvent* event) {
|
| }
|
|
|
| void SlideOutView::RestoreVisualState() {
|
| + if (!get_use_acceleration_when_possible())
|
| + return;
|
| +
|
| // Restore the layer state.
|
| const int kSwipeRestoreDurationMS = 150;
|
| ui::ScopedLayerAnimationSettings settings(layer()->GetAnimator());
|
| @@ -73,6 +83,11 @@ void SlideOutView::RestoreVisualState() {
|
| }
|
|
|
| void SlideOutView::SlideOutAndClose(SlideDirection direction) {
|
| + if (!get_use_acceleration_when_possible()) {
|
| + // No animations, so don't wait to fire the OnSlideOut event.
|
| + OnSlideOut();
|
| + return;
|
| + }
|
| const int kSwipeOutTotalDurationMS = 150;
|
| int swipe_out_duration = kSwipeOutTotalDurationMS * layer()->opacity();
|
| ui::ScopedLayerAnimationSettings settings(layer()->GetAnimator());
|
|
|