mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- Add off-screen rendering support for Mac OS-X (issue #540).
- Add patch for ninja build support on Mac OS-X. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@624 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -29,18 +29,19 @@ CefWindowHandle CefBrowserImpl::GetWindowHandle() {
|
||||
}
|
||||
|
||||
bool CefBrowserImpl::IsWindowRenderingDisabled() {
|
||||
// TODO(port): Add support for off-screen rendering.
|
||||
return false;
|
||||
return (window_info_.m_bWindowRenderingDisabled ? true : false);
|
||||
}
|
||||
|
||||
gfx::NativeView CefBrowserImpl::UIT_GetMainWndHandle() {
|
||||
REQUIRE_UIT();
|
||||
return window_info_.m_View;
|
||||
return window_info_.m_bWindowRenderingDisabled ?
|
||||
window_info_.m_ParentView : window_info_.m_View;
|
||||
}
|
||||
|
||||
void CefBrowserImpl::UIT_ClearMainWndHandle() {
|
||||
REQUIRE_UIT();
|
||||
window_info_.m_View = NULL;
|
||||
if (!window_info_.m_bWindowRenderingDisabled)
|
||||
window_info_.m_View = NULL;
|
||||
}
|
||||
|
||||
bool CefBrowserImpl::UIT_CreateBrowser(const CefString& url) {
|
||||
@@ -61,29 +62,35 @@ bool CefBrowserImpl::UIT_CreateBrowser(const CefString& url) {
|
||||
NSView* parentView = window_info_.m_ParentView;
|
||||
gfx::Rect contentRect(window_info_.m_x, window_info_.m_y,
|
||||
window_info_.m_nWidth, window_info_.m_nHeight);
|
||||
if (parentView == nil) {
|
||||
// Create a new window.
|
||||
NSRect screen_rect = [[NSScreen mainScreen] visibleFrame];
|
||||
NSRect window_rect = {{window_info_.m_x,
|
||||
screen_rect.size.height - window_info_.m_y},
|
||||
{window_info_.m_nWidth, window_info_.m_nHeight}};
|
||||
if (window_rect.size.width == 0)
|
||||
window_rect.size.width = 750;
|
||||
if (window_rect.size.height == 0)
|
||||
window_rect.size.height = 750;
|
||||
contentRect.SetRect(0, 0, window_rect.size.width, window_rect.size.height);
|
||||
if (!window_info_.m_bWindowRenderingDisabled) {
|
||||
if (parentView == nil) {
|
||||
// Create a new window.
|
||||
NSRect screen_rect = [[NSScreen mainScreen] visibleFrame];
|
||||
NSRect window_rect = {{window_info_.m_x,
|
||||
screen_rect.size.height - window_info_.m_y},
|
||||
{window_info_.m_nWidth, window_info_.m_nHeight}};
|
||||
if (window_rect.size.width == 0)
|
||||
window_rect.size.width = 750;
|
||||
if (window_rect.size.height == 0)
|
||||
window_rect.size.height = 750;
|
||||
contentRect.SetRect(0, 0, window_rect.size.width,
|
||||
window_rect.size.height);
|
||||
|
||||
newWnd = [[NSWindow alloc]
|
||||
initWithContentRect:window_rect
|
||||
styleMask:(NSTitledWindowMask |
|
||||
NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask |
|
||||
NSResizableWindowMask |
|
||||
NSUnifiedTitleAndToolbarWindowMask )
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO];
|
||||
parentView = [newWnd contentView];
|
||||
window_info_.m_ParentView = parentView;
|
||||
newWnd = [[NSWindow alloc]
|
||||
initWithContentRect:window_rect
|
||||
styleMask:(NSTitledWindowMask |
|
||||
NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask |
|
||||
NSResizableWindowMask |
|
||||
NSUnifiedTitleAndToolbarWindowMask )
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO];
|
||||
parentView = [newWnd contentView];
|
||||
window_info_.m_ParentView = parentView;
|
||||
}
|
||||
} else {
|
||||
// Create a new paint delegate.
|
||||
paint_delegate_.reset(new PaintDelegate(this));
|
||||
}
|
||||
|
||||
WebPreferences prefs;
|
||||
@@ -92,7 +99,11 @@ bool CefBrowserImpl::UIT_CreateBrowser(const CefString& url) {
|
||||
// Create the webview host object
|
||||
webviewhost_.reset(
|
||||
WebViewHost::Create(parentView, contentRect, delegate_.get(),
|
||||
NULL, dev_tools_agent_.get(), prefs));
|
||||
paint_delegate_.get(), dev_tools_agent_.get(),
|
||||
prefs));
|
||||
|
||||
if (window_info_.m_bTransparentPainting)
|
||||
webviewhost_->webview()->setIsTransparent(true);
|
||||
|
||||
if (!settings_.developer_tools_disabled)
|
||||
dev_tools_agent_->SetWebView(webviewhost_->webview());
|
||||
@@ -101,8 +112,10 @@ bool CefBrowserImpl::UIT_CreateBrowser(const CefString& url) {
|
||||
browserView.browser = this;
|
||||
window_info_.m_View = browserView;
|
||||
|
||||
if (!settings_.drag_drop_disabled)
|
||||
[browserView registerDragDrop];
|
||||
if (!window_info_.m_bWindowRenderingDisabled) {
|
||||
if (!settings_.drag_drop_disabled)
|
||||
[browserView registerDragDrop];
|
||||
}
|
||||
|
||||
Unlock();
|
||||
|
||||
@@ -142,11 +155,24 @@ void CefBrowserImpl::UIT_SetFocus(WebWidgetHost* host, bool enable) {
|
||||
}
|
||||
}
|
||||
|
||||
bool CefBrowserImpl::UIT_ViewDocumentString(WebKit::WebFrame *frame) {
|
||||
bool CefBrowserImpl::UIT_ViewDocumentString(WebKit::WebFrame* frame) {
|
||||
REQUIRE_UIT();
|
||||
|
||||
// TODO(port): Add implementation.
|
||||
NOTIMPLEMENTED();
|
||||
char sztmp[L_tmpnam+4];
|
||||
if (tmpnam(sztmp)) {
|
||||
strcat(sztmp, ".txt");
|
||||
|
||||
FILE* fp = fopen(sztmp, "wb");
|
||||
if (fp) {
|
||||
std::string markup = frame->contentAsMarkup().utf8();
|
||||
fwrite(markup.c_str(), 1, markup.size(), fp);
|
||||
fclose(fp);
|
||||
|
||||
char szopen[L_tmpnam + 14];
|
||||
snprintf(szopen, sizeof(szopen), "open -t \"%s\"", sztmp);
|
||||
return (system(szopen) >= 0);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user