| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/mac/mac_util.h" |
| 11 #include "base/mac/scoped_cftyperef.h" | 12 #include "base/mac/scoped_cftyperef.h" |
| 12 #import "base/mac/scoped_nsautorelease_pool.h" | 13 #import "base/mac/scoped_nsautorelease_pool.h" |
| 13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 14 #import "base/memory/scoped_nsobject.h" | 15 #import "base/memory/scoped_nsobject.h" |
| 15 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 16 #include "base/sys_info.h" | 17 #include "base/sys_info.h" |
| 17 #include "base/sys_string_conversions.h" | 18 #include "base/sys_string_conversions.h" |
| 18 #include "chrome/browser/browser_trial.h" | 19 #include "chrome/browser/browser_trial.h" |
| 19 #import "chrome/browser/renderer_host/accelerated_plugin_view_mac.h" | 20 #import "chrome/browser/renderer_host/accelerated_plugin_view_mac.h" |
| 20 #import "chrome/browser/renderer_host/text_input_client_mac.h" | 21 #import "chrome/browser/renderer_host/text_input_client_mac.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 #include "content/common/gpu/gpu_messages.h" | 38 #include "content/common/gpu/gpu_messages.h" |
| 38 #include "content/common/native_web_keyboard_event.h" | 39 #include "content/common/native_web_keyboard_event.h" |
| 39 #include "content/common/plugin_messages.h" | 40 #include "content/common/plugin_messages.h" |
| 40 #include "content/common/view_messages.h" | 41 #include "content/common/view_messages.h" |
| 41 #include "skia/ext/platform_canvas.h" | 42 #include "skia/ext/platform_canvas.h" |
| 42 #import "third_party/mozilla/ComplexTextInputPanel.h" | 43 #import "third_party/mozilla/ComplexTextInputPanel.h" |
| 43 #include "third_party/skia/include/core/SkColor.h" | 44 #include "third_party/skia/include/core/SkColor.h" |
| 44 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebInputEventFact
ory.h" | 45 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebInputEventFact
ory.h" |
| 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 46 #include "ui/gfx/point.h" | 47 #include "ui/gfx/point.h" |
| 48 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| 47 #include "ui/gfx/surface/io_surface_support_mac.h" | 49 #include "ui/gfx/surface/io_surface_support_mac.h" |
| 48 #include "webkit/glue/webaccessibility.h" | 50 #include "webkit/glue/webaccessibility.h" |
| 49 #include "webkit/plugins/npapi/webplugin.h" | 51 #include "webkit/plugins/npapi/webplugin.h" |
| 50 | 52 |
| 51 using WebKit::WebInputEvent; | 53 using WebKit::WebInputEvent; |
| 52 using WebKit::WebInputEventFactory; | 54 using WebKit::WebInputEventFactory; |
| 53 using WebKit::WebMouseEvent; | 55 using WebKit::WebMouseEvent; |
| 54 using WebKit::WebMouseWheelEvent; | 56 using WebKit::WebMouseWheelEvent; |
| 57 using WebKit::WebGestureEvent; |
| 55 | 58 |
| 56 static inline int ToWebKitModifiers(NSUInteger flags) { | 59 static inline int ToWebKitModifiers(NSUInteger flags) { |
| 57 int modifiers = 0; | 60 int modifiers = 0; |
| 58 if (flags & NSControlKeyMask) modifiers |= WebInputEvent::ControlKey; | 61 if (flags & NSControlKeyMask) modifiers |= WebInputEvent::ControlKey; |
| 59 if (flags & NSShiftKeyMask) modifiers |= WebInputEvent::ShiftKey; | 62 if (flags & NSShiftKeyMask) modifiers |= WebInputEvent::ShiftKey; |
| 60 if (flags & NSAlternateKeyMask) modifiers |= WebInputEvent::AltKey; | 63 if (flags & NSAlternateKeyMask) modifiers |= WebInputEvent::AltKey; |
| 61 if (flags & NSCommandKeyMask) modifiers |= WebInputEvent::MetaKey; | 64 if (flags & NSCommandKeyMask) modifiers |= WebInputEvent::MetaKey; |
| 62 return modifiers; | 65 return modifiers; |
| 63 } | 66 } |
| 64 | 67 |
| 65 // Private methods: | 68 // Private methods: |
| 66 @interface RenderWidgetHostViewCocoa () | 69 @interface RenderWidgetHostViewCocoa () |
| 67 @property(nonatomic, assign) NSRange selectedRange; | 70 @property(nonatomic, assign) NSRange selectedRange; |
| 68 @property(nonatomic, assign) NSRange markedRange; | 71 @property(nonatomic, assign) NSRange markedRange; |
| 69 | 72 |
| 70 + (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event; | 73 + (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event; |
| 71 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r; | 74 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r; |
| 72 - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv; | 75 - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv; |
| 73 - (void)cancelChildPopups; | 76 - (void)cancelChildPopups; |
| 74 - (void)checkForPluginImeCancellation; | 77 - (void)checkForPluginImeCancellation; |
| 75 @end | 78 @end |
| 76 | 79 |
| 77 // This API was published since 10.6. Provide the declaration so it can be | 80 // This API was published since 10.6. Provide the declaration so it can be |
| 78 // // called below when building with the 10.5 SDK. | 81 // called below when building with the 10.5 SDK. |
| 79 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 | 82 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 |
| 80 @class NSTextInputContext; | 83 @class NSTextInputContext; |
| 81 @interface NSResponder (AppKitDetails) | 84 @interface NSResponder (AppKitDetails) |
| 82 - (NSTextInputContext *)inputContext; | 85 - (NSTextInputContext *)inputContext; |
| 86 - (void)beginGestureWithEvent:(NSEvent*)event; |
| 87 - (void)endGestureWithEvent:(NSEvent*)event; |
| 83 @end | 88 @end |
| 84 #endif | 89 #endif |
| 85 | 90 |
| 91 // Undocumented Lion method to get the pattern for the over-scroll area. |
| 92 @interface NSColor (LionSekretAPI) |
| 93 + (NSImage*)_linenPatternImage; |
| 94 @end |
| 95 |
| 96 // NSEvent subtype for scroll gestures events. |
| 97 static const short kIOHIDEventTypeScroll = 6; |
| 98 |
| 86 namespace { | 99 namespace { |
| 87 | 100 |
| 88 // Maximum number of characters we allow in a tooltip. | 101 // Maximum number of characters we allow in a tooltip. |
| 89 const size_t kMaxTooltipLength = 1024; | 102 const size_t kMaxTooltipLength = 1024; |
| 90 | 103 |
| 91 // TODO(suzhe): Upstream this function. | 104 // TODO(suzhe): Upstream this function. |
| 92 WebKit::WebColor WebColorFromNSColor(NSColor *color) { | 105 WebKit::WebColor WebColorFromNSColor(NSColor *color) { |
| 93 CGFloat r, g, b, a; | 106 CGFloat r, g, b, a; |
| 94 [color getRed:&r green:&g blue:&b alpha:&a]; | 107 [color getRed:&r green:&g blue:&b alpha:&a]; |
| 95 | 108 |
| (...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 [self confirmComposition]; | 1217 [self confirmComposition]; |
| 1205 } | 1218 } |
| 1206 | 1219 |
| 1207 const WebMouseEvent& event = | 1220 const WebMouseEvent& event = |
| 1208 WebInputEventFactory::mouseEvent(theEvent, self); | 1221 WebInputEventFactory::mouseEvent(theEvent, self); |
| 1209 | 1222 |
| 1210 if (renderWidgetHostView_->render_widget_host_) | 1223 if (renderWidgetHostView_->render_widget_host_) |
| 1211 renderWidgetHostView_->render_widget_host_->ForwardMouseEvent(event); | 1224 renderWidgetHostView_->render_widget_host_->ForwardMouseEvent(event); |
| 1212 } | 1225 } |
| 1213 | 1226 |
| 1227 - (void)beginGestureWithEvent:(NSEvent*)event { |
| 1228 if (base::mac::IsOSLionOrLater() && |
| 1229 [event subtype] == kIOHIDEventTypeScroll && |
| 1230 renderWidgetHostView_->render_widget_host_) { |
| 1231 WebGestureEvent webEvent = WebInputEventFactory::gestureEvent(event, self); |
| 1232 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(webEvent); |
| 1233 } |
| 1234 |
| 1235 // Forward the gesture event to the next responder so that the browser window |
| 1236 // controller has a chance to act on back/forward gestures. |
| 1237 [[self nextResponder] beginGestureWithEvent:event]; |
| 1238 } |
| 1239 |
| 1240 - (void)endGestureWithEvent:(NSEvent*)event { |
| 1241 if (base::mac::IsOSLionOrLater() && |
| 1242 [event subtype] == kIOHIDEventTypeScroll && |
| 1243 renderWidgetHostView_->render_widget_host_) { |
| 1244 WebGestureEvent webEvent = WebInputEventFactory::gestureEvent(event, self); |
| 1245 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(webEvent); |
| 1246 } |
| 1247 |
| 1248 // Forward the gesture event to the next responder so that the browser window |
| 1249 // controller has a chance to act on back/forward gestures. |
| 1250 [[self nextResponder] endGestureWithEvent:event]; |
| 1251 } |
| 1252 |
| 1214 - (BOOL)performKeyEquivalent:(NSEvent*)theEvent { | 1253 - (BOOL)performKeyEquivalent:(NSEvent*)theEvent { |
| 1215 // |performKeyEquivalent:| is sent to all views of a window, not only down the | 1254 // |performKeyEquivalent:| is sent to all views of a window, not only down the |
| 1216 // responder chain (cf. "Handling Key Equivalents" in | 1255 // responder chain (cf. "Handling Key Equivalents" in |
| 1217 // http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Event
Overview/HandlingKeyEvents/HandlingKeyEvents.html | 1256 // http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Event
Overview/HandlingKeyEvents/HandlingKeyEvents.html |
| 1218 // ). We only want to handle key equivalents if we're first responder. | 1257 // ). We only want to handle key equivalents if we're first responder. |
| 1219 if ([[self window] firstResponder] != self) | 1258 if ([[self window] firstResponder] != self) |
| 1220 return NO; | 1259 return NO; |
| 1221 | 1260 |
| 1222 // If we return |NO| from this function, cocoa will send the key event to | 1261 // If we return |NO| from this function, cocoa will send the key event to |
| 1223 // the menu and only if the menu does not process the event to |keyDown:|. We | 1262 // the menu and only if the menu does not process the event to |keyDown:|. We |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1240 return YES; | 1279 return YES; |
| 1241 } | 1280 } |
| 1242 | 1281 |
| 1243 - (BOOL)_wantsKeyDownForEvent:(NSEvent*)event { | 1282 - (BOOL)_wantsKeyDownForEvent:(NSEvent*)event { |
| 1244 // This is a SPI that AppKit apparently calls after |performKeyEquivalent:| | 1283 // This is a SPI that AppKit apparently calls after |performKeyEquivalent:| |
| 1245 // returned NO. If this function returns |YES|, Cocoa sends the event to | 1284 // returned NO. If this function returns |YES|, Cocoa sends the event to |
| 1246 // |keyDown:| instead of doing other things with it. Ctrl-tab will be sent | 1285 // |keyDown:| instead of doing other things with it. Ctrl-tab will be sent |
| 1247 // to us instead of doing key view loop control, ctrl-left/right get handled | 1286 // to us instead of doing key view loop control, ctrl-left/right get handled |
| 1248 // correctly, etc. | 1287 // correctly, etc. |
| 1249 // (However, there are still some keys that Cocoa swallows, e.g. the key | 1288 // (However, there are still some keys that Cocoa swallows, e.g. the key |
| 1250 // equivalent that Cocoa uses for toggling the input langauge. In this case, | 1289 // equivalent that Cocoa uses for toggling the input language. In this case, |
| 1251 // that's actually a good thing, though -- see http://crbug.com/26115 .) | 1290 // that's actually a good thing, though -- see http://crbug.com/26115 .) |
| 1252 return YES; | 1291 return YES; |
| 1253 } | 1292 } |
| 1254 | 1293 |
| 1255 - (void)keyEvent:(NSEvent*)theEvent { | 1294 - (void)keyEvent:(NSEvent*)theEvent { |
| 1256 [self keyEvent:theEvent wasKeyEquivalent:NO]; | 1295 [self keyEvent:theEvent wasKeyEquivalent:NO]; |
| 1257 } | 1296 } |
| 1258 | 1297 |
| 1259 - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv { | 1298 - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv { |
| 1260 DCHECK([theEvent type] != NSKeyDown || | 1299 DCHECK([theEvent type] != NSKeyDown || |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 y += height; | 1598 y += height; |
| 1560 height = -height; | 1599 height = -height; |
| 1561 } | 1600 } |
| 1562 | 1601 |
| 1563 NSRect r = [self flipRectToNSRect:gfx::Rect(x, y, width, height)]; | 1602 NSRect r = [self flipRectToNSRect:gfx::Rect(x, y, width, height)]; |
| 1564 [[NSColor whiteColor] set]; | 1603 [[NSColor whiteColor] set]; |
| 1565 NSRectFill(r); | 1604 NSRectFill(r); |
| 1566 } | 1605 } |
| 1567 } | 1606 } |
| 1568 | 1607 |
| 1608 - (void)fillRect:(NSRect)rect withPattern:(NSImage*)patternImage { |
| 1609 if (NSIsEmptyRect(rect)) |
| 1610 return; |
| 1611 |
| 1612 NSColor* patternColor = [NSColor colorWithPatternImage:patternImage]; |
| 1613 [patternColor set]; |
| 1614 NSRectFill(rect); |
| 1615 } |
| 1616 |
| 1617 - (void)drawShadow:(NSShadow*)shadow |
| 1618 withRect:(NSRect)rect |
| 1619 clip:(NSRect)clipRect { |
| 1620 gfx::ScopedNSGraphicsContextSaveGState scopedGState; |
| 1621 NSBezierPath* drawingPath = [NSBezierPath bezierPathWithRect:rect]; |
| 1622 [shadow set]; |
| 1623 [[NSColor blackColor] set]; |
| 1624 [[NSBezierPath bezierPathWithRect:clipRect] addClip]; |
| 1625 [drawingPath fill]; |
| 1626 } |
| 1627 |
| 1628 - (NSRect)computeVisibleContentRect { |
| 1629 const RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host_; |
| 1630 gfx::Point offset = rwh->last_scroll_offset(); |
| 1631 gfx::Size size = rwh->contents_size(); |
| 1632 NSRect contentRect = |
| 1633 NSMakeRect(-offset.x(), -offset.y(), size.width(), size.height()); |
| 1634 NSRect frameRect = [self frame]; |
| 1635 frameRect.origin = NSMakePoint(0, 0); |
| 1636 return NSIntersectionRect(frameRect, contentRect); |
| 1637 } |
| 1638 |
| 1639 - (void)fillOverScrollAreas:(NSRect)dirtyRect { |
| 1640 if (![NSColor respondsToSelector:@selector(_linenPatternImage)]) |
| 1641 return; |
| 1642 |
| 1643 NSRect visibleContentRect = [self computeVisibleContentRect]; |
| 1644 NSSize frameSize = [self frame].size; |
| 1645 bool hasHorizontalOverflow = (NSWidth(visibleContentRect) < frameSize.width); |
| 1646 bool hasVerticalOverflow = (NSHeight(visibleContentRect) < frameSize.height); |
| 1647 |
| 1648 if (!hasHorizontalOverflow && !hasVerticalOverflow) |
| 1649 return; |
| 1650 |
| 1651 NSRect xRect = NSMakeRect(0, |
| 1652 0, |
| 1653 frameSize.width - NSWidth(visibleContentRect), |
| 1654 frameSize.height); |
| 1655 NSRect yRect = NSMakeRect(0, |
| 1656 0, |
| 1657 frameSize.width, |
| 1658 frameSize.height - NSHeight(visibleContentRect)); |
| 1659 NSImage* background = [NSColor _linenPatternImage]; |
| 1660 scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); |
| 1661 [shadow.get() setShadowColor:[NSColor blackColor]]; |
| 1662 [shadow setShadowBlurRadius:5]; |
| 1663 |
| 1664 if (hasHorizontalOverflow) { |
| 1665 NSRect shadowRect; |
| 1666 if (visibleContentRect.origin.x > 0) { |
| 1667 shadowRect = xRect; |
| 1668 shadowRect.origin.x += NSWidth(shadowRect); |
| 1669 } else { |
| 1670 xRect.origin.x = NSWidth(visibleContentRect); |
| 1671 shadowRect = xRect; |
| 1672 shadowRect.origin.x -= 1; |
| 1673 } |
| 1674 shadowRect.size.width = 1; |
| 1675 NSRect intersectRect = NSIntersectionRect(dirtyRect, xRect); |
| 1676 [self fillRect:intersectRect withPattern:background]; |
| 1677 [self drawShadow:shadow.get() withRect:shadowRect clip:intersectRect]; |
| 1678 } |
| 1679 |
| 1680 if (hasVerticalOverflow) { |
| 1681 NSRect shadowRect = visibleContentRect; |
| 1682 if (visibleContentRect.origin.y > 0) { |
| 1683 yRect.origin.y = NSHeight(visibleContentRect); |
| 1684 shadowRect.origin.y = yRect.origin.y - 1; |
| 1685 } else { |
| 1686 shadowRect.origin.y = yRect.origin.y + NSHeight(yRect); |
| 1687 } |
| 1688 shadowRect.size.height = 1; |
| 1689 NSRect intersectRect = NSIntersectionRect(dirtyRect, yRect); |
| 1690 [self fillRect:intersectRect withPattern:background]; |
| 1691 [self drawShadow:shadow.get() withRect:shadowRect clip:intersectRect]; |
| 1692 } |
| 1693 } |
| 1694 |
| 1569 - (void)drawRect:(NSRect)dirtyRect { | 1695 - (void)drawRect:(NSRect)dirtyRect { |
| 1570 if (!renderWidgetHostView_->render_widget_host_) { | 1696 if (!renderWidgetHostView_->render_widget_host_) { |
| 1571 // TODO(shess): Consider using something more noticable? | 1697 // TODO(shess): Consider using something more noticable? |
| 1572 [[NSColor whiteColor] set]; | 1698 [[NSColor whiteColor] set]; |
| 1573 NSRectFill(dirtyRect); | 1699 NSRectFill(dirtyRect); |
| 1574 return; | 1700 return; |
| 1575 } | 1701 } |
| 1576 | 1702 |
| 1577 const gfx::Rect damagedRect([self flipNSRectToRect:dirtyRect]); | 1703 const gfx::Rect damagedRect([self flipNSRectToRect:dirtyRect]); |
| 1578 | 1704 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1634 CGBitmapContextCreateImage(backingStore->cg_bitmap())); | 1760 CGBitmapContextCreateImage(backingStore->cg_bitmap())); |
| 1635 CGRect imageRect = bitmapRect.ToCGRect(); | 1761 CGRect imageRect = bitmapRect.ToCGRect(); |
| 1636 imageRect.origin.y = yOffset; | 1762 imageRect.origin.y = yOffset; |
| 1637 CGContextDrawImage(context, imageRect, image); | 1763 CGContextDrawImage(context, imageRect, image); |
| 1638 } | 1764 } |
| 1639 } | 1765 } |
| 1640 | 1766 |
| 1641 // Fill the remaining portion of the damagedRect with white | 1767 // Fill the remaining portion of the damagedRect with white |
| 1642 [self fillBottomRightRemainderOfRect:bitmapRect dirtyRect:damagedRect]; | 1768 [self fillBottomRightRemainderOfRect:bitmapRect dirtyRect:damagedRect]; |
| 1643 | 1769 |
| 1770 // Fill the over-scroll areas, if any, with the appropriate pattern. |
| 1771 [self fillOverScrollAreas:dirtyRect]; |
| 1772 |
| 1644 if (!renderWidgetHostView_->whiteout_start_time_.is_null()) { | 1773 if (!renderWidgetHostView_->whiteout_start_time_.is_null()) { |
| 1645 base::TimeDelta whiteout_duration = base::TimeTicks::Now() - | 1774 base::TimeDelta whiteout_duration = base::TimeTicks::Now() - |
| 1646 renderWidgetHostView_->whiteout_start_time_; | 1775 renderWidgetHostView_->whiteout_start_time_; |
| 1647 UMA_HISTOGRAM_TIMES("MPArch.RWHH_WhiteoutDuration", whiteout_duration); | 1776 UMA_HISTOGRAM_TIMES("MPArch.RWHH_WhiteoutDuration", whiteout_duration); |
| 1648 | 1777 |
| 1649 // Reset the start time to 0 so that we start recording again the next | 1778 // Reset the start time to 0 so that we start recording again the next |
| 1650 // time the backing store is NULL... | 1779 // time the backing store is NULL... |
| 1651 renderWidgetHostView_->whiteout_start_time_ = base::TimeTicks(); | 1780 renderWidgetHostView_->whiteout_start_time_ = base::TimeTicks(); |
| 1652 } | 1781 } |
| 1653 if (!renderWidgetHostView_->tab_switch_paint_time_.is_null()) { | 1782 if (!renderWidgetHostView_->tab_switch_paint_time_.is_null()) { |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host_; | 2010 RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host_; |
| 1882 rwh->Send(new ViewMsg_SetAccessibilityFocus( | 2011 rwh->Send(new ViewMsg_SetAccessibilityFocus( |
| 1883 rwh->routing_id(), accessibilityObjectId)); | 2012 rwh->routing_id(), accessibilityObjectId)); |
| 1884 } | 2013 } |
| 1885 } | 2014 } |
| 1886 | 2015 |
| 1887 - (void)performShowMenuAction:(BrowserAccessibilityCocoa*)accessibility { | 2016 - (void)performShowMenuAction:(BrowserAccessibilityCocoa*)accessibility { |
| 1888 // Performs a right click copying WebKit's | 2017 // Performs a right click copying WebKit's |
| 1889 // accessibilityPerformShowMenuAction. | 2018 // accessibilityPerformShowMenuAction. |
| 1890 NSPoint location = [self accessibilityPointInScreen:accessibility]; | 2019 NSPoint location = [self accessibilityPointInScreen:accessibility]; |
| 1891 NSSize size = [[accessibility size] sizeValue]; | 2020 NSSize size = [[accessibility size] sizeValue]; |
| 1892 location = [[self window] convertScreenToBase:location]; | 2021 location = [[self window] convertScreenToBase:location]; |
| 1893 location.x += size.width/2; | 2022 location.x += size.width/2; |
| 1894 location.y += size.height/2; | 2023 location.y += size.height/2; |
| 1895 | 2024 |
| 1896 NSEvent* fakeRightClick = [NSEvent | 2025 NSEvent* fakeRightClick = [NSEvent |
| 1897 mouseEventWithType:NSRightMouseDown | 2026 mouseEventWithType:NSRightMouseDown |
| 1898 location:location | 2027 location:location |
| 1899 modifierFlags:nil | 2028 modifierFlags:nil |
| 1900 timestamp:0 | 2029 timestamp:0 |
| 1901 windowNumber:[[self window] windowNumber] | 2030 windowNumber:[[self window] windowNumber] |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2627 if (!string) return NO; | 2756 if (!string) return NO; |
| 2628 | 2757 |
| 2629 // If the user is currently using an IME, confirm the IME input, | 2758 // If the user is currently using an IME, confirm the IME input, |
| 2630 // and then insert the text from the service, the same as TextEdit and Safari. | 2759 // and then insert the text from the service, the same as TextEdit and Safari. |
| 2631 [self confirmComposition]; | 2760 [self confirmComposition]; |
| 2632 [self insertText:string]; | 2761 [self insertText:string]; |
| 2633 return YES; | 2762 return YES; |
| 2634 } | 2763 } |
| 2635 | 2764 |
| 2636 @end | 2765 @end |
| OLD | NEW |