OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/gtk/slide_animator_gtk.h" | 5 #include "chrome/browser/gtk/slide_animator_gtk.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/common/animation.h" | 8 #include "chrome/common/animation.h" |
9 #include "chrome/common/slide_animation.h" | 9 #include "chrome/common/slide_animation.h" |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 void OnFixedSizeAllocate(GtkWidget* fixed, | 13 void OnFixedSizeAllocate(GtkWidget* fixed, |
14 GtkAllocation* allocation, | 14 GtkAllocation* allocation, |
15 GtkWidget* child) { | 15 GtkWidget* child) { |
16 gint height; | |
17 gtk_widget_get_size_request(child, NULL, &height); | |
18 // The size of the GtkFixed has changed. We want |child_| to match widths, | 16 // The size of the GtkFixed has changed. We want |child_| to match widths, |
19 // but the height should always be |widget_height_|. | 17 // but the height should not change. |
20 gtk_widget_set_size_request(child, allocation->width, height); | 18 GtkAllocation new_allocation = child->allocation; |
| 19 new_allocation.width = allocation->width; |
| 20 gtk_widget_size_allocate(child, &new_allocation); |
21 } | 21 } |
22 | 22 |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 SlideAnimatorGtk::SlideAnimatorGtk(GtkWidget* child, | 25 SlideAnimatorGtk::SlideAnimatorGtk(GtkWidget* child, |
26 Direction direction, | 26 Direction direction, |
27 int duration, | 27 int duration, |
28 bool linear, | 28 bool linear, |
29 Delegate* delegate) | 29 Delegate* delegate) |
30 : child_(child), | 30 : child_(child), |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // static | 99 // static |
100 void SlideAnimatorGtk::OnChildSizeAllocate(GtkWidget* child, | 100 void SlideAnimatorGtk::OnChildSizeAllocate(GtkWidget* child, |
101 GtkAllocation* allocation, | 101 GtkAllocation* allocation, |
102 SlideAnimatorGtk* slider) { | 102 SlideAnimatorGtk* slider) { |
103 if (!slider->fixed_needs_resize_) | 103 if (!slider->fixed_needs_resize_) |
104 return; | 104 return; |
105 | 105 |
106 slider->fixed_needs_resize_ = false; | 106 slider->fixed_needs_resize_ = false; |
107 slider->AnimationProgressed(slider->animation_.get()); | 107 slider->AnimationProgressed(slider->animation_.get()); |
108 } | 108 } |
OLD | NEW |