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 "app/surface/io_surface_support_mac.h" | 9 #include "app/surface/io_surface_support_mac.h" |
10 #import "base/chrome_application_mac.h" | 10 #import "base/chrome_application_mac.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
166 | 166 |
167 if (![self surfaceWasSwapped]) | 167 if (![self surfaceWasSwapped]) |
168 return kCVReturnSuccess; | 168 return kCVReturnSuccess; |
169 | 169 |
170 [self drawView]; | 170 [self drawView]; |
171 [self setSurfaceWasSwapped:NO]; | 171 [self setSurfaceWasSwapped:NO]; |
172 return kCVReturnSuccess; | 172 return kCVReturnSuccess; |
173 } | 173 } |
174 | 174 |
175 // This is the renderer output callback function | 175 // This is the renderer output callback function |
176 static CVReturn MyDisplayLinkCallback( | 176 static CVReturn DrawOneAcceleratedPluginCallback( |
177 CVDisplayLinkRef displayLink, | 177 CVDisplayLinkRef displayLink, |
178 const CVTimeStamp* now, | 178 const CVTimeStamp* now, |
179 const CVTimeStamp* outputTime, | 179 const CVTimeStamp* outputTime, |
180 CVOptionFlags flagsIn, | 180 CVOptionFlags flagsIn, |
181 CVOptionFlags* flagsOut, | 181 CVOptionFlags* flagsOut, |
182 void* displayLinkContext) { | 182 void* displayLinkContext) { |
183 CVReturn result = | 183 CVReturn result = |
184 [(AcceleratedPluginView*)displayLinkContext getFrameForTime:outputTime]; | 184 [(AcceleratedPluginView*)displayLinkContext getFrameForTime:outputTime]; |
185 return result; | 185 return result; |
186 } | 186 } |
(...skipping 17 matching lines...) Expand all Loading... | |
204 cglContext_ = (CGLContextObj)[glContext_ CGLContextObj]; | 204 cglContext_ = (CGLContextObj)[glContext_ CGLContextObj]; |
205 cglPixelFormat_ = (CGLPixelFormatObj)[glPixelFormat_ CGLPixelFormatObj]; | 205 cglPixelFormat_ = (CGLPixelFormatObj)[glPixelFormat_ CGLPixelFormatObj]; |
206 | 206 |
207 // Draw at beam vsync. | 207 // Draw at beam vsync. |
208 GLint swapInterval = 1; | 208 GLint swapInterval = 1; |
209 [glContext_ setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval]; | 209 [glContext_ setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval]; |
210 | 210 |
211 | 211 |
212 // Set up a display link to do OpenGL rendering on a background thread. | 212 // Set up a display link to do OpenGL rendering on a background thread. |
213 CVDisplayLinkCreateWithActiveCGDisplays(&displayLink_); | 213 CVDisplayLinkCreateWithActiveCGDisplays(&displayLink_); |
214 CVDisplayLinkSetOutputCallback(displayLink_, &MyDisplayLinkCallback, self); | 214 CVDisplayLinkSetOutputCallback(displayLink_, |
215 &DrawOneAcceleratedPluginCallback, self); | |
215 CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext( | 216 CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext( |
216 displayLink_, cglContext_, cglPixelFormat_); | 217 displayLink_, cglContext_, cglPixelFormat_); |
217 CVDisplayLinkStart(displayLink_); | 218 CVDisplayLinkStart(displayLink_); |
218 } | 219 } |
219 return self; | 220 return self; |
220 } | 221 } |
221 | 222 |
222 - (void)drawView { | 223 - (void)drawView { |
223 // Called on a background thread. Synchronized via the CGL context lock. | 224 // Called on a background thread. Synchronized via the CGL context lock. |
224 CGLLockContext(cglContext_); | 225 CGLLockContext(cglContext_); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 | 427 |
427 gfx::Rect rect = geom.window_rect; | 428 gfx::Rect rect = geom.window_rect; |
428 if (geom.visible) { | 429 if (geom.visible) { |
429 rect.set_x(rect.x() + geom.clip_rect.x()); | 430 rect.set_x(rect.x() + geom.clip_rect.x()); |
430 rect.set_y(rect.y() + geom.clip_rect.y()); | 431 rect.set_y(rect.y() + geom.clip_rect.y()); |
431 rect.set_width(geom.clip_rect.width()); | 432 rect.set_width(geom.clip_rect.width()); |
432 rect.set_height(geom.clip_rect.height()); | 433 rect.set_height(geom.clip_rect.height()); |
433 } | 434 } |
434 | 435 |
435 PluginViewMap::iterator it = plugin_views_.find(geom.window); | 436 PluginViewMap::iterator it = plugin_views_.find(geom.window); |
436 CHECK(plugin_views_.end() != it); | 437 DCHECK(plugin_views_.end() != it); |
Nico
2010/08/19 22:24:22
what's the rationale for replacing these CHECKs wi
Ken Russell (switch to Gerrit)
2010/08/19 22:28:47
Stuart was concerned about the use of CHECK. I cou
stuartmorgan
2010/08/19 22:35:59
From that document:
"Sometimes it is preferable t
| |
438 if (plugin_views_.end() == it) { | |
439 continue; | |
440 } | |
437 NSRect new_rect([cocoa_view_ RectToNSRect:rect]); | 441 NSRect new_rect([cocoa_view_ RectToNSRect:rect]); |
438 [it->second setFrame:new_rect]; | 442 [it->second setFrame:new_rect]; |
439 [it->second setNeedsDisplay:YES]; | 443 [it->second setNeedsDisplay:YES]; |
440 | 444 |
441 plugin_container_manager_.MovePluginContainer(geom); | 445 plugin_container_manager_.SetPluginContainerGeometry(geom); |
442 } | 446 } |
443 } | 447 } |
444 } | 448 } |
445 | 449 |
446 void RenderWidgetHostViewMac::Focus() { | 450 void RenderWidgetHostViewMac::Focus() { |
447 [[cocoa_view_ window] makeFirstResponder:cocoa_view_]; | 451 [[cocoa_view_ window] makeFirstResponder:cocoa_view_]; |
448 } | 452 } |
449 | 453 |
450 void RenderWidgetHostViewMac::Blur() { | 454 void RenderWidgetHostViewMac::Blur() { |
451 [[cocoa_view_ window] makeFirstResponder:nil]; | 455 [[cocoa_view_ window] makeFirstResponder:nil]; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
582 // outside of themselves. On Windows, if Destroy is being called on a view, | 586 // outside of themselves. On Windows, if Destroy is being called on a view, |
583 // then the event causing the destroy had also cancelled any popups by the | 587 // then the event causing the destroy had also cancelled any popups by the |
584 // time Destroy() was called. On the Mac we have to destroy all the popups | 588 // time Destroy() was called. On the Mac we have to destroy all the popups |
585 // ourselves. | 589 // ourselves. |
586 | 590 |
587 if (!is_popup_menu_) { | 591 if (!is_popup_menu_) { |
588 // Depth-first destroy all popups. Use ShutdownHost() to enforce | 592 // Depth-first destroy all popups. Use ShutdownHost() to enforce |
589 // deepest-first ordering. | 593 // deepest-first ordering. |
590 for (NSView* subview in [cocoa_view_ subviews]) { | 594 for (NSView* subview in [cocoa_view_ subviews]) { |
591 if (![subview isKindOfClass:[RenderWidgetHostViewCocoa class]]) | 595 if (![subview isKindOfClass:[RenderWidgetHostViewCocoa class]]) |
592 continue; // Skip plugin views. | 596 continue; // Skip accelerated views. |
593 | 597 |
594 [static_cast<RenderWidgetHostViewCocoa*>(subview) | 598 [static_cast<RenderWidgetHostViewCocoa*>(subview) |
595 renderWidgetHostViewMac]->ShutdownHost(); | 599 renderWidgetHostViewMac]->ShutdownHost(); |
596 } | 600 } |
597 | 601 |
598 // We've been told to destroy. | 602 // We've been told to destroy. |
599 [cocoa_view_ retain]; | 603 [cocoa_view_ retain]; |
600 [cocoa_view_ removeFromSuperview]; | 604 [cocoa_view_ removeFromSuperview]; |
601 [cocoa_view_ autorelease]; | 605 [cocoa_view_ autorelease]; |
602 } else { | 606 } else { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
747 | 751 |
748 [cocoa_view_ addSubview:plugin_view]; | 752 [cocoa_view_ addSubview:plugin_view]; |
749 plugin_views_[handle] = plugin_view; | 753 plugin_views_[handle] = plugin_view; |
750 | 754 |
751 return handle; | 755 return handle; |
752 } | 756 } |
753 | 757 |
754 void RenderWidgetHostViewMac::DestroyFakePluginWindowHandle( | 758 void RenderWidgetHostViewMac::DestroyFakePluginWindowHandle( |
755 gfx::PluginWindowHandle window) { | 759 gfx::PluginWindowHandle window) { |
756 PluginViewMap::iterator it = plugin_views_.find(window); | 760 PluginViewMap::iterator it = plugin_views_.find(window); |
757 CHECK(plugin_views_.end() != it); | 761 DCHECK(plugin_views_.end() != it); |
762 if (plugin_views_.end() == it) { | |
763 return; | |
764 } | |
758 [it->second removeFromSuperview]; | 765 [it->second removeFromSuperview]; |
759 plugin_views_.erase(it); | 766 plugin_views_.erase(it); |
760 | |
761 plugin_container_manager_.DestroyFakePluginWindowHandle(window); | 767 plugin_container_manager_.DestroyFakePluginWindowHandle(window); |
762 } | 768 } |
763 | 769 |
764 void RenderWidgetHostViewMac::AcceleratedSurfaceSetIOSurface( | 770 void RenderWidgetHostViewMac::AcceleratedSurfaceSetIOSurface( |
765 gfx::PluginWindowHandle window, | 771 gfx::PluginWindowHandle window, |
766 int32 width, | 772 int32 width, |
767 int32 height, | 773 int32 height, |
768 uint64 io_surface_identifier) { | 774 uint64 io_surface_identifier) { |
769 PluginViewMap::iterator it = plugin_views_.find(window); | |
770 CHECK(plugin_views_.end() != it); | |
771 | |
772 plugin_container_manager_.SetSizeAndIOSurface(window, | 775 plugin_container_manager_.SetSizeAndIOSurface(window, |
773 width, | 776 width, |
774 height, | 777 height, |
775 io_surface_identifier); | 778 io_surface_identifier); |
776 | 779 |
777 if (plugin_container_manager_.IsRootContainer(window)) { | 780 if (plugin_container_manager_.IsRootContainer(window)) { |
778 // Fake up a WebPluginGeometry for the root window to set the | 781 // Fake up a WebPluginGeometry for the root window to set the |
779 // container's size; we will never get a notification from the | 782 // container's size; we will never get a notification from the |
780 // browser about the root window, only plugins. | 783 // browser about the root window, only plugins. |
781 webkit_glue::WebPluginGeometry geom; | 784 webkit_glue::WebPluginGeometry geom; |
782 gfx::Rect rect(0, 0, width, height); | 785 gfx::Rect rect(0, 0, width, height); |
783 geom.window = window; | 786 geom.window = window; |
784 geom.window_rect = rect; | 787 geom.window_rect = rect; |
785 geom.clip_rect = rect; | 788 geom.clip_rect = rect; |
786 geom.visible = true; | 789 geom.visible = true; |
787 MovePluginWindows(std::vector<webkit_glue::WebPluginGeometry>(1, geom)); | 790 MovePluginWindows(std::vector<webkit_glue::WebPluginGeometry>(1, geom)); |
788 } | 791 } |
789 } | 792 } |
790 | 793 |
791 void RenderWidgetHostViewMac::AcceleratedSurfaceSetTransportDIB( | 794 void RenderWidgetHostViewMac::AcceleratedSurfaceSetTransportDIB( |
792 gfx::PluginWindowHandle window, | 795 gfx::PluginWindowHandle window, |
793 int32 width, | 796 int32 width, |
794 int32 height, | 797 int32 height, |
795 TransportDIB::Handle transport_dib) { | 798 TransportDIB::Handle transport_dib) { |
796 PluginViewMap::iterator it = plugin_views_.find(window); | |
797 CHECK(plugin_views_.end() != it); | |
798 | |
799 plugin_container_manager_.SetSizeAndTransportDIB(window, | 799 plugin_container_manager_.SetSizeAndTransportDIB(window, |
800 width, | 800 width, |
801 height, | 801 height, |
802 transport_dib); | 802 transport_dib); |
803 } | 803 } |
804 | 804 |
805 void RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped( | 805 void RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped( |
806 gfx::PluginWindowHandle window) { | 806 gfx::PluginWindowHandle window) { |
807 PluginViewMap::iterator it = plugin_views_.find(window); | 807 PluginViewMap::iterator it = plugin_views_.find(window); |
808 CHECK(plugin_views_.end() != it); | 808 DCHECK(plugin_views_.end() != it); |
809 CHECK([it->second isKindOfClass:[AcceleratedPluginView class]]); | 809 if (plugin_views_.end() == it) { |
810 return; | |
811 } | |
812 DCHECK([it->second isKindOfClass:[AcceleratedPluginView class]]); | |
810 | 813 |
811 AcceleratedPluginView* view = static_cast<AcceleratedPluginView*>(it->second); | 814 AcceleratedPluginView* view = |
815 static_cast<AcceleratedPluginView*>(it->second); | |
812 [view setHidden:NO]; | 816 [view setHidden:NO]; |
813 [view setSurfaceWasSwapped:YES]; | 817 [view setSurfaceWasSwapped:YES]; |
814 } | 818 } |
815 | 819 |
816 void RenderWidgetHostViewMac::DrawAcceleratedSurfaceInstance( | 820 void RenderWidgetHostViewMac::DrawAcceleratedSurfaceInstance( |
817 CGLContextObj context, gfx::PluginWindowHandle plugin_handle) { | 821 CGLContextObj context, gfx::PluginWindowHandle plugin_handle) { |
818 // Called on the display link thread. | 822 // Called on the display link thread. |
819 PluginViewMap::iterator it = plugin_views_.find(plugin_handle); | 823 PluginViewMap::iterator it = plugin_views_.find(plugin_handle); |
820 CHECK(plugin_views_.end() != it); | 824 DCHECK(plugin_views_.end() != it); |
821 | 825 if (plugin_views_.end() == it) { |
826 return; | |
827 } | |
822 CGLSetCurrentContext(context); | 828 CGLSetCurrentContext(context); |
823 // TODO(thakis): Pixel or view coordinates? | 829 // TODO(thakis): Pixel or view coordinates? |
824 NSSize size = [it->second frame].size; | 830 NSSize size = [it->second frame].size; |
825 | 831 |
826 glMatrixMode(GL_PROJECTION); | 832 glMatrixMode(GL_PROJECTION); |
827 glLoadIdentity(); | 833 glLoadIdentity(); |
828 // Note that we place the origin at the upper left corner with +y | 834 // Note that we place the origin at the upper left corner with +y |
829 // going down | 835 // going down |
830 glOrtho(0, size.width, size.height, 0, -1, 1); | 836 glOrtho(0, size.width, size.height, 0, -1, 1); |
831 glMatrixMode(GL_MODELVIEW); | 837 glMatrixMode(GL_MODELVIEW); |
832 glLoadIdentity(); | 838 glLoadIdentity(); |
833 | 839 |
834 plugin_container_manager_.Draw( | 840 plugin_container_manager_.Draw( |
835 context, plugin_handle, GetRenderWidgetHost()->is_gpu_rendering_active()); | 841 context, |
842 plugin_handle, | |
843 GetRenderWidgetHost()->is_gpu_rendering_active()); | |
836 } | 844 } |
837 | 845 |
838 void RenderWidgetHostViewMac::ForceTextureReload() { | 846 void RenderWidgetHostViewMac::ForceTextureReload() { |
839 plugin_container_manager_.ForceTextureReload(); | 847 plugin_container_manager_.ForceTextureReload(); |
840 } | 848 } |
841 | 849 |
842 void RenderWidgetHostViewMac::SetVisuallyDeemphasized(bool deemphasized) { | 850 void RenderWidgetHostViewMac::SetVisuallyDeemphasized(bool deemphasized) { |
843 // Mac uses tab-modal sheets, so this is a no-op. | 851 // Mac uses tab-modal sheets, so this is a no-op. |
844 } | 852 } |
845 | 853 |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1331 | 1339 |
1332 - (void)drawRect:(NSRect)dirtyRect { | 1340 - (void)drawRect:(NSRect)dirtyRect { |
1333 if (!renderWidgetHostView_->render_widget_host_) { | 1341 if (!renderWidgetHostView_->render_widget_host_) { |
1334 // TODO(shess): Consider using something more noticable? | 1342 // TODO(shess): Consider using something more noticable? |
1335 [[NSColor whiteColor] set]; | 1343 [[NSColor whiteColor] set]; |
1336 NSRectFill(dirtyRect); | 1344 NSRectFill(dirtyRect); |
1337 return; | 1345 return; |
1338 } | 1346 } |
1339 | 1347 |
1340 if (renderWidgetHostView_->render_widget_host_->is_gpu_rendering_active()) { | 1348 if (renderWidgetHostView_->render_widget_host_->is_gpu_rendering_active()) { |
1341 // In this mode the accelerated plugin layer is considered to be | |
1342 // opaque. We do not want its contents to be blended with anything | |
1343 // underneath it. | |
1344 acceleratedPluginLayer_.get().opaque = YES; | |
1345 [acceleratedPluginLayer_.get() setNeedsDisplay]; | |
1346 return; | 1349 return; |
1347 } | 1350 } |
1348 | 1351 |
1349 DCHECK( | 1352 DCHECK( |
1350 renderWidgetHostView_->render_widget_host_->process()->HasConnection()); | 1353 renderWidgetHostView_->render_widget_host_->process()->HasConnection()); |
1351 DCHECK(!renderWidgetHostView_->about_to_validate_and_paint_); | 1354 DCHECK(!renderWidgetHostView_->about_to_validate_and_paint_); |
1352 | 1355 |
1353 renderWidgetHostView_->about_to_validate_and_paint_ = true; | 1356 renderWidgetHostView_->about_to_validate_and_paint_ = true; |
1354 BackingStoreMac* backing_store = static_cast<BackingStoreMac*>( | 1357 BackingStoreMac* backing_store = static_cast<BackingStoreMac*>( |
1355 renderWidgetHostView_->render_widget_host_->GetBackingStore(true)); | 1358 renderWidgetHostView_->render_widget_host_->GetBackingStore(true)); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1452 // Reset tab_switch_paint_time_ to 0 so future tab selections are | 1455 // Reset tab_switch_paint_time_ to 0 so future tab selections are |
1453 // recorded. | 1456 // recorded. |
1454 renderWidgetHostView_->tab_switch_paint_time_ = base::TimeTicks(); | 1457 renderWidgetHostView_->tab_switch_paint_time_ = base::TimeTicks(); |
1455 } | 1458 } |
1456 } else { | 1459 } else { |
1457 [[NSColor whiteColor] set]; | 1460 [[NSColor whiteColor] set]; |
1458 NSRectFill(dirtyRect); | 1461 NSRectFill(dirtyRect); |
1459 if (renderWidgetHostView_->whiteout_start_time_.is_null()) | 1462 if (renderWidgetHostView_->whiteout_start_time_.is_null()) |
1460 renderWidgetHostView_->whiteout_start_time_ = base::TimeTicks::Now(); | 1463 renderWidgetHostView_->whiteout_start_time_ = base::TimeTicks::Now(); |
1461 } | 1464 } |
1462 | |
1463 // If we get here then the accelerated plugin layer is not supposed | |
1464 // to be considered opaque -- plugins overlay the browser's normal | |
1465 // painting. | |
1466 acceleratedPluginLayer_.get().opaque = NO; | |
1467 | |
1468 // This helps keep accelerated plugins' output in better sync with the | |
1469 // window as it resizes. | |
1470 [acceleratedPluginLayer_.get() setNeedsDisplay]; | |
1471 } | 1465 } |
1472 | 1466 |
1473 - (BOOL)canBecomeKeyView { | 1467 - (BOOL)canBecomeKeyView { |
1474 if (!renderWidgetHostView_->render_widget_host_) | 1468 if (!renderWidgetHostView_->render_widget_host_) |
1475 return NO; | 1469 return NO; |
1476 | 1470 |
1477 return canBeKeyView_; | 1471 return canBeKeyView_; |
1478 } | 1472 } |
1479 | 1473 |
1480 - (BOOL)acceptsFirstResponder { | 1474 - (BOOL)acceptsFirstResponder { |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2130 } else { | 2124 } else { |
2131 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition( | 2125 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition( |
2132 base::SysNSStringToUTF16(im_text)); | 2126 base::SysNSStringToUTF16(im_text)); |
2133 } | 2127 } |
2134 | 2128 |
2135 // Inserting text will delete all marked text automatically. | 2129 // Inserting text will delete all marked text automatically. |
2136 hasMarkedText_ = NO; | 2130 hasMarkedText_ = NO; |
2137 } | 2131 } |
2138 | 2132 |
2139 - (void)viewDidMoveToWindow { | 2133 - (void)viewDidMoveToWindow { |
2140 // If we move into a new window, refresh the frame information. We don't need | |
2141 // to do it if it was the same window as it used to be in, since that case | |
2142 // is covered by DidBecomeSelected. | |
2143 // We only want to do this for real browser views, not popups. | |
2144 if (canBeKeyView_) { | 2134 if (canBeKeyView_) { |
2145 NSWindow* newWindow = [self window]; | 2135 NSWindow* newWindow = [self window]; |
2146 // Pointer comparison only, since we don't know if lastWindow_ is still | 2136 // Pointer comparison only, since we don't know if lastWindow_ is still |
2147 // valid. | 2137 // valid. |
2148 if (newWindow) { | 2138 if (newWindow) { |
2139 // If we move into a new window, refresh the frame information. We | |
2140 // don't need to do it if it was the same window as it used to be in, | |
2141 // since that case is covered by DidBecomeSelected. We only want to | |
2142 // do this for real browser views, not popups. | |
2149 if (newWindow != lastWindow_) { | 2143 if (newWindow != lastWindow_) { |
2150 lastWindow_ = newWindow; | 2144 lastWindow_ = newWindow; |
2151 renderWidgetHostView_->WindowFrameChanged(); | 2145 renderWidgetHostView_->WindowFrameChanged(); |
2152 } | 2146 } |
2153 renderWidgetHostView_->ForceTextureReload(); | 2147 renderWidgetHostView_->ForceTextureReload(); |
2154 } | 2148 } |
2155 } | 2149 } |
2156 | 2150 |
2157 // If we switch windows (or are removed from the view hierarchy), cancel any | 2151 // If we switch windows (or are removed from the view hierarchy), cancel any |
2158 // open mouse-downs. | 2152 // open mouse-downs. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2209 } | 2203 } |
2210 } | 2204 } |
2211 | 2205 |
2212 - (void)pasteAsPlainText:(id)sender { | 2206 - (void)pasteAsPlainText:(id)sender { |
2213 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { | 2207 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { |
2214 static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> | 2208 static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> |
2215 ForwardEditCommand("PasteAndMatchStyle", ""); | 2209 ForwardEditCommand("PasteAndMatchStyle", ""); |
2216 } | 2210 } |
2217 } | 2211 } |
2218 | 2212 |
2219 - (void)drawAcceleratedPluginLayer { | |
2220 [acceleratedPluginLayer_.get() setNeedsDisplay]; | |
2221 } | |
2222 | |
2223 - (void)cancelComposition { | 2213 - (void)cancelComposition { |
2224 if (!hasMarkedText_) | 2214 if (!hasMarkedText_) |
2225 return; | 2215 return; |
2226 | 2216 |
2227 // Cancel the ongoing composition. [NSInputManager markedTextAbandoned:] | 2217 // Cancel the ongoing composition. [NSInputManager markedTextAbandoned:] |
2228 // doesn't call any NSTextInput functions, such as setMarkedText or | 2218 // doesn't call any NSTextInput functions, such as setMarkedText or |
2229 // insertText. So, we need to send an IPC message to a renderer so it can | 2219 // insertText. So, we need to send an IPC message to a renderer so it can |
2230 // delete the composition node. | 2220 // delete the composition node. |
2231 NSInputManager *currentInputManager = [NSInputManager currentInputManager]; | 2221 NSInputManager *currentInputManager = [NSInputManager currentInputManager]; |
2232 [currentInputManager markedTextAbandoned:self]; | 2222 [currentInputManager markedTextAbandoned:self]; |
(...skipping 11 matching lines...) Expand all Loading... | |
2244 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition(); | 2234 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition(); |
2245 | 2235 |
2246 [self cancelComposition]; | 2236 [self cancelComposition]; |
2247 } | 2237 } |
2248 | 2238 |
2249 - (ViewID)viewID { | 2239 - (ViewID)viewID { |
2250 return VIEW_ID_TAB_CONTAINER_FOCUS_VIEW; | 2240 return VIEW_ID_TAB_CONTAINER_FOCUS_VIEW; |
2251 } | 2241 } |
2252 | 2242 |
2253 @end | 2243 @end |
OLD | NEW |