OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 7 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 // If new_width or new_height is non-zero, the window size (content region) | 316 // If new_width or new_height is non-zero, the window size (content region) |
317 // will be updated accordingly; if they are zero, the existing size will be | 317 // will be updated accordingly; if they are zero, the existing size will be |
318 // preserved. | 318 // preserved. |
319 static void UpdateDummyWindowBoundsWithOffset(WindowRef window, | 319 static void UpdateDummyWindowBoundsWithOffset(WindowRef window, |
320 int x_offset, int y_offset, | 320 int x_offset, int y_offset, |
321 int new_width, int new_height) { | 321 int new_width, int new_height) { |
322 int target_x = g_current_x_offset + x_offset; | 322 int target_x = g_current_x_offset + x_offset; |
323 int target_y = g_current_y_offset + y_offset; | 323 int target_y = g_current_y_offset + y_offset; |
324 Rect window_bounds; | 324 Rect window_bounds; |
325 GetWindowBounds(window, kWindowContentRgn, &window_bounds); | 325 GetWindowBounds(window, kWindowContentRgn, &window_bounds); |
326 if ((window_bounds.left != target_x) || | 326 int old_width = window_bounds.right - window_bounds.left; |
327 (window_bounds.top != target_y)) { | 327 int old_height = window_bounds.bottom - window_bounds.top; |
328 int height = new_height ? new_height | 328 if (window_bounds.left != target_x || |
329 : window_bounds.bottom - window_bounds.top; | 329 window_bounds.top != target_y || |
330 int width = new_width ? new_width | 330 (new_width && new_width != old_width) || |
331 : window_bounds.right - window_bounds.left; | 331 (new_height && new_height != old_height)) { |
| 332 int height = new_height ? new_height : old_height; |
| 333 int width = new_width ? new_width : old_width; |
332 window_bounds.left = target_x; | 334 window_bounds.left = target_x; |
333 window_bounds.top = target_y; | 335 window_bounds.top = target_y; |
334 window_bounds.right = window_bounds.left + width; | 336 window_bounds.right = window_bounds.left + width; |
335 window_bounds.bottom = window_bounds.top + height; | 337 window_bounds.bottom = window_bounds.top + height; |
336 SetWindowBounds(window, kWindowContentRgn, &window_bounds); | 338 SetWindowBounds(window, kWindowContentRgn, &window_bounds); |
337 } | 339 } |
338 } | 340 } |
339 | 341 |
340 void WebPluginDelegateImpl::WindowlessSetWindow(bool force_set_window) { | 342 void WebPluginDelegateImpl::WindowlessSetWindow(bool force_set_window) { |
341 if (!instance()) | 343 if (!instance()) |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 | 737 |
736 #ifndef NP_NO_CARBON | 738 #ifndef NP_NO_CARBON |
737 if (instance_->event_model() == NPEventModelCarbon) { | 739 if (instance_->event_model() == NPEventModelCarbon) { |
738 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 740 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
739 null_event_factory_.NewRunnableMethod( | 741 null_event_factory_.NewRunnableMethod( |
740 &WebPluginDelegateImpl::OnNullEvent), | 742 &WebPluginDelegateImpl::OnNullEvent), |
741 kPluginIdleThrottleDelayMs); | 743 kPluginIdleThrottleDelayMs); |
742 } | 744 } |
743 #endif | 745 #endif |
744 } | 746 } |
OLD | NEW |