Merge revision 1226 changes:

Mac: Add off-screen rendering support (issue #518).
- Build with the 10.7 SDK (set GYP_DEFINES='mac_sdk=10.7') to include Retina support in the cefclient OSR example.

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1453@1227 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2013-04-16 19:24:30 +00:00
parent 02217f4a85
commit dd06cf5105
49 changed files with 2447 additions and 204 deletions

View File

@@ -35,7 +35,9 @@ bool CefMenuCreatorRunnerMac::RunContextMenu(CefMenuCreator* manager) {
// [NSApp currentEvent] will return a valid event.
NSEvent* currentEvent = [NSApp currentEvent];
NSWindow* window = [parent_view window];
NSPoint position = [window mouseLocationOutsideOfEventStream];
NSTimeInterval eventTime = [currentEvent timestamp];
NSEvent* clickEvent = [NSEvent mouseEventWithType:NSRightMouseDown
location:position
@@ -59,9 +61,33 @@ bool CefMenuCreatorRunnerMac::RunContextMenu(CefMenuCreator* manager) {
base::mac::ScopedSendingEvent sendingEventScoper;
// Show the menu. Blocks until the menu is dismissed.
[NSMenu popUpContextMenu:[menu_controller_ menu]
withEvent:clickEvent
forView:parent_view];
if (manager->browser()->IsWindowRenderingDisabled()) {
// Showing the menu in OSR is pretty much self contained, only using
// the initialized menu_controller_ in this function, and the scoped
// variables in this block.
int screenX = 0, screenY = 0;
CefRefPtr<CefRenderHandler> handler =
manager->browser()->GetClient()->GetRenderHandler();
if (!handler->GetScreenPoint(manager->browser(),
manager->params().x, manager->params().y,
screenX, screenY)) {
return false;
}
// Don't show the menu unless there is a parent native window to tie it to
if (!manager->browser()->GetWindowHandle())
return false;
NSPoint screen_position =
NSPointFromCGPoint(gfx::Point(screenX, screenY).ToCGPoint());
[[menu_controller_ menu] popUpMenuPositioningItem:nil
atLocation:screen_position
inView:nil];
} else {
[NSMenu popUpContextMenu:[menu_controller_ menu]
withEvent:clickEvent
forView:parent_view];
}
}
return true;