OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <QuartzCore/QuartzCore.h> | 5 #include <QuartzCore/QuartzCore.h> |
6 | 6 |
7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
8 | 8 |
9 #include "chrome/browser/chrome_thread.h" | 9 #include "chrome/browser/chrome_thread.h" |
10 #include "app/surface/io_surface_support_mac.h" | 10 #include "app/surface/io_surface_support_mac.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 // method does not pass the message up the responder chain, it handles it | 283 // method does not pass the message up the responder chain, it handles it |
284 // directly." | 284 // directly." |
285 // That's bad, we want the next responder (RWHVMac) to handle this event to | 285 // That's bad, we want the next responder (RWHVMac) to handle this event to |
286 // dispatch it to the renderer. | 286 // dispatch it to the renderer. |
287 [[self nextResponder] rightMouseDown:event]; | 287 [[self nextResponder] rightMouseDown:event]; |
288 } | 288 } |
289 | 289 |
290 - (void)globalFrameDidChange:(NSNotification*)notification { | 290 - (void)globalFrameDidChange:(NSNotification*)notification { |
291 globalFrameDidChangeCGLLockCount_++; | 291 globalFrameDidChangeCGLLockCount_++; |
292 CGLLockContext(cglContext_); | 292 CGLLockContext(cglContext_); |
| 293 // This call to -update can call -globalFrameDidChange: again, see |
| 294 // http://crbug.com/55754 comments 22 and 24. |
293 [glContext_ update]; | 295 [glContext_ update]; |
294 | 296 |
295 // You would think that -update updates the viewport. You would be wrong. | 297 // You would think that -update updates the viewport. You would be wrong. |
296 CGLSetCurrentContext(cglContext_); | 298 CGLSetCurrentContext(cglContext_); |
297 NSSize size = [self frame].size; | 299 NSSize size = [self frame].size; |
298 glViewport(0, 0, size.width, size.height); | 300 glViewport(0, 0, size.width, size.height); |
299 | 301 |
300 CGLUnlockContext(cglContext_); | 302 CGLUnlockContext(cglContext_); |
301 globalFrameDidChangeCGLLockCount_--; | 303 globalFrameDidChangeCGLLockCount_--; |
302 | 304 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 - (void)viewWillMoveToWindow:(NSWindow*)newWindow { | 341 - (void)viewWillMoveToWindow:(NSWindow*)newWindow { |
340 // Stop the display link thread while the view is not visible. | 342 // Stop the display link thread while the view is not visible. |
341 if (newWindow) { | 343 if (newWindow) { |
342 if (displayLink_ && !CVDisplayLinkIsRunning(displayLink_)) | 344 if (displayLink_ && !CVDisplayLinkIsRunning(displayLink_)) |
343 CVDisplayLinkStart(displayLink_); | 345 CVDisplayLinkStart(displayLink_); |
344 } else { | 346 } else { |
345 if (displayLink_ && CVDisplayLinkIsRunning(displayLink_)) | 347 if (displayLink_ && CVDisplayLinkIsRunning(displayLink_)) |
346 CVDisplayLinkStop(displayLink_); | 348 CVDisplayLinkStop(displayLink_); |
347 } | 349 } |
348 | 350 |
349 // If hole pushing is enabled, inform the window hosing this accelerated view | 351 // If hole punching is enabled, inform the window hosting this accelerated |
350 // that it needs to be opaque. | 352 // view that it needs to be opaque. |
351 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 353 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
352 switches::kDisableHolePunching)) { | 354 switches::kDisableHolePunching)) { |
353 if ([[self window] respondsToSelector:@selector(underlaySurfaceRemoved)]) { | 355 if ([[self window] respondsToSelector:@selector(underlaySurfaceRemoved)]) { |
354 [static_cast<id>([self window]) underlaySurfaceRemoved]; | 356 [static_cast<id>([self window]) underlaySurfaceRemoved]; |
355 } | 357 } |
356 | 358 |
357 if ([newWindow respondsToSelector:@selector(underlaySurfaceAdded)]) { | 359 if ([newWindow respondsToSelector:@selector(underlaySurfaceAdded)]) { |
358 [static_cast<id>(newWindow) underlaySurfaceAdded]; | 360 [static_cast<id>(newWindow) underlaySurfaceAdded]; |
359 } | 361 } |
360 } | 362 } |
(...skipping 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2447 if (!string) return NO; | 2449 if (!string) return NO; |
2448 | 2450 |
2449 // If the user is currently using an IME, confirm the IME input, | 2451 // If the user is currently using an IME, confirm the IME input, |
2450 // and then insert the text from the service, the same as TextEdit and Safari. | 2452 // and then insert the text from the service, the same as TextEdit and Safari. |
2451 [self confirmComposition]; | 2453 [self confirmComposition]; |
2452 [self insertText:string]; | 2454 [self insertText:string]; |
2453 return YES; | 2455 return YES; |
2454 } | 2456 } |
2455 | 2457 |
2456 @end | 2458 @end |
OLD | NEW |