Index: ui/aura/toplevel_window_event_filter.cc |
diff --git a/ui/aura/toplevel_window_event_filter.cc b/ui/aura/toplevel_window_event_filter.cc |
index 98d29d302ca3d7e22f83460086447e22a07668d6..582144631b554b844d81883bddddeab15c1b9635 100644 |
--- a/ui/aura/toplevel_window_event_filter.cc |
+++ b/ui/aura/toplevel_window_event_filter.cc |
@@ -129,11 +129,9 @@ bool ToplevelWindowEventFilter::OnMouseEvent(Window* target, |
EventFilter::OnMouseEvent(target, event); |
switch (event->type()) { |
- case ui::ET_MOUSE_MOVED: |
+ case ui::ET_MOUSE_PRESSED: |
oshima
2011/10/15 02:10:50
This change was necessary to handle this scenario:
Ben Goodger (Google)
2011/10/15 05:36:30
We need to capture the window_component_ on every
oshima
2011/10/15 17:47:06
Done.
|
window_component_ = |
target->delegate()->GetNonClientComponent(event->location()); |
- break; |
- case ui::ET_MOUSE_PRESSED: |
mouse_down_bounds_ = target->bounds(); |
mouse_down_offset_in_target_ = event->location(); |
mouse_down_offset_in_parent_ = mouse_down_offset_in_target_; |
@@ -232,10 +230,18 @@ gfx::Size ToplevelWindowEventFilter::GetSizeForDrag(int bounds_change, |
int x_multiplier = GetXMultiplierForWindowComponent(window_component_); |
int y_multiplier = GetYMultiplierForWindowComponent(window_component_); |
- size.Enlarge(size_change_direction & kBoundsChangeDirection_Horizontal ? |
- x_multiplier * (first_x - second_x) : 0, |
- size_change_direction & kBoundsChangeDirection_Vertical ? |
- y_multiplier * (first_y - second_y) : 0); |
+ |
+ int width = size.width() + |
+ (size_change_direction & kBoundsChangeDirection_Horizontal ? |
+ x_multiplier * (first_x - second_x) : 0); |
+ int height = size.height() + |
+ (size_change_direction & kBoundsChangeDirection_Vertical ? |
+ y_multiplier * (first_y - second_y) : 0); |
+ |
+ // Enforce minimum window size. |
+ const gfx::Size min_size = target->minimum_size(); |
+ size.SetSize(std::max(width, min_size.width()), |
+ std::max(height, min_size.height())); |
} |
return size; |
} |