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

Unified Diff: ui/views/controls/slide_out_view.cc

Issue 11836003: Allow message center and related bubbles to render on Windows. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Move comment and early return instead of big blocks. Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/slide_out_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « ui/views/controls/slide_out_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698