mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Implement off-screen rendering support using delegated rendering (issue #1257).
This implementation supports both GPU compositing and software compositing (used when GPU is not supported or when passing `--disable-gpu --disable-gpu-compositing` command-line flags). GPU-accelerated features (WebGL and 3D CSS) that did not work with the previous off-screen rendering implementation do work with this implementation when GPU support is available. Rendering now operates on a per-frame basis. The frame rate is configurable via CefBrowserSettings.windowless_frame_rate up to a maximum of 60fps (potentially limited by how fast the system can generate new frames). CEF generates a bitmap from the compositor backing and passes it to CefRenderHandler::OnPaint. The previous CefRenderHandler/CefBrowserHost API for off-screen rendering has been restored mostly as-is with some minor changes: - CefBrowserHost::Invalidate no longer accepts a CefRect region argument. Instead of invalidating a specific region it now triggers generation of a new frame. - The |dirtyRects| argument to CefRenderHandler::OnPaint will now always be a single CefRect representing the whole view (frame) size. Previously, invalidated regions were listed separately. - Linux: CefBrowserHost::SendKeyEvent now expects X11 event information instead of GTK event information. See cefclient for an example of converting GTK events to the necessary format. - Sizes passed to the CefRenderHandler OnPaint and OnPopupSize methods are now already DPI scaled. Previously, the client had to perform DPI scaling. - Includes drag&drop implementation from issue #1032. - Includes unit test fixes from issue #1245. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1751 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
|
||||
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/browser_host_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/drag_data_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/request_context_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/client_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.h"
|
||||
@ -410,6 +411,70 @@ int CEF_CALLBACK browser_host_is_mouse_cursor_change_disabled(
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK browser_host_is_window_rendering_disabled(
|
||||
struct _cef_browser_host_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefBrowserHostCppToC::Get(self)->IsWindowRenderingDisabled();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_was_resized(struct _cef_browser_host_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefBrowserHostCppToC::Get(self)->WasResized();
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_was_hidden(struct _cef_browser_host_t* self,
|
||||
int hidden) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefBrowserHostCppToC::Get(self)->WasHidden(
|
||||
hidden?true:false);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_notify_screen_info_changed(
|
||||
struct _cef_browser_host_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefBrowserHostCppToC::Get(self)->NotifyScreenInfoChanged();
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_invalidate(struct _cef_browser_host_t* self,
|
||||
cef_paint_element_type_t type) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefBrowserHostCppToC::Get(self)->Invalidate(
|
||||
type);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_send_key_event(struct _cef_browser_host_t* self,
|
||||
const struct _cef_key_event_t* event) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
@ -532,6 +597,164 @@ void CEF_CALLBACK browser_host_send_capture_lost_event(
|
||||
CefBrowserHostCppToC::Get(self)->SendCaptureLostEvent();
|
||||
}
|
||||
|
||||
cef_text_input_context_t CEF_CALLBACK browser_host_get_nstext_input_context(
|
||||
struct _cef_browser_host_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
cef_text_input_context_t _retval = CefBrowserHostCppToC::Get(
|
||||
self)->GetNSTextInputContext();
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_handle_key_event_before_text_input_client(
|
||||
struct _cef_browser_host_t* self, cef_event_handle_t keyEvent) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefBrowserHostCppToC::Get(self)->HandleKeyEventBeforeTextInputClient(
|
||||
keyEvent);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_handle_key_event_after_text_input_client(
|
||||
struct _cef_browser_host_t* self, cef_event_handle_t keyEvent) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefBrowserHostCppToC::Get(self)->HandleKeyEventAfterTextInputClient(
|
||||
keyEvent);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_drag_target_drag_enter(
|
||||
struct _cef_browser_host_t* self, struct _cef_drag_data_t* drag_data,
|
||||
const struct _cef_mouse_event_t* event,
|
||||
cef_drag_operations_mask_t allowed_ops) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: drag_data; type: refptr_same
|
||||
DCHECK(drag_data);
|
||||
if (!drag_data)
|
||||
return;
|
||||
// Verify param: event; type: struct_byref_const
|
||||
DCHECK(event);
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
// Translate param: event; type: struct_byref_const
|
||||
CefMouseEvent eventObj;
|
||||
if (event)
|
||||
eventObj.Set(*event, false);
|
||||
|
||||
// Execute
|
||||
CefBrowserHostCppToC::Get(self)->DragTargetDragEnter(
|
||||
CefDragDataCppToC::Unwrap(drag_data),
|
||||
eventObj,
|
||||
allowed_ops);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_drag_target_drag_over(
|
||||
struct _cef_browser_host_t* self, const struct _cef_mouse_event_t* event,
|
||||
cef_drag_operations_mask_t allowed_ops) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: event; type: struct_byref_const
|
||||
DCHECK(event);
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
// Translate param: event; type: struct_byref_const
|
||||
CefMouseEvent eventObj;
|
||||
if (event)
|
||||
eventObj.Set(*event, false);
|
||||
|
||||
// Execute
|
||||
CefBrowserHostCppToC::Get(self)->DragTargetDragOver(
|
||||
eventObj,
|
||||
allowed_ops);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_drag_target_drag_leave(
|
||||
struct _cef_browser_host_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefBrowserHostCppToC::Get(self)->DragTargetDragLeave();
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_drag_target_drop(
|
||||
struct _cef_browser_host_t* self, const struct _cef_mouse_event_t* event) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: event; type: struct_byref_const
|
||||
DCHECK(event);
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
// Translate param: event; type: struct_byref_const
|
||||
CefMouseEvent eventObj;
|
||||
if (event)
|
||||
eventObj.Set(*event, false);
|
||||
|
||||
// Execute
|
||||
CefBrowserHostCppToC::Get(self)->DragTargetDrop(
|
||||
eventObj);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_drag_source_ended_at(
|
||||
struct _cef_browser_host_t* self, int x, int y,
|
||||
cef_drag_operations_mask_t op) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefBrowserHostCppToC::Get(self)->DragSourceEndedAt(
|
||||
x,
|
||||
y,
|
||||
op);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_drag_source_system_drag_ended(
|
||||
struct _cef_browser_host_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefBrowserHostCppToC::Get(self)->DragSourceSystemDragEnded();
|
||||
}
|
||||
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
@ -559,6 +782,13 @@ CefBrowserHostCppToC::CefBrowserHostCppToC(CefBrowserHost* cls)
|
||||
browser_host_set_mouse_cursor_change_disabled;
|
||||
struct_.struct_.is_mouse_cursor_change_disabled =
|
||||
browser_host_is_mouse_cursor_change_disabled;
|
||||
struct_.struct_.is_window_rendering_disabled =
|
||||
browser_host_is_window_rendering_disabled;
|
||||
struct_.struct_.was_resized = browser_host_was_resized;
|
||||
struct_.struct_.was_hidden = browser_host_was_hidden;
|
||||
struct_.struct_.notify_screen_info_changed =
|
||||
browser_host_notify_screen_info_changed;
|
||||
struct_.struct_.invalidate = browser_host_invalidate;
|
||||
struct_.struct_.send_key_event = browser_host_send_key_event;
|
||||
struct_.struct_.send_mouse_click_event = browser_host_send_mouse_click_event;
|
||||
struct_.struct_.send_mouse_move_event = browser_host_send_mouse_move_event;
|
||||
@ -566,6 +796,19 @@ CefBrowserHostCppToC::CefBrowserHostCppToC(CefBrowserHost* cls)
|
||||
struct_.struct_.send_focus_event = browser_host_send_focus_event;
|
||||
struct_.struct_.send_capture_lost_event =
|
||||
browser_host_send_capture_lost_event;
|
||||
struct_.struct_.get_nstext_input_context =
|
||||
browser_host_get_nstext_input_context;
|
||||
struct_.struct_.handle_key_event_before_text_input_client =
|
||||
browser_host_handle_key_event_before_text_input_client;
|
||||
struct_.struct_.handle_key_event_after_text_input_client =
|
||||
browser_host_handle_key_event_after_text_input_client;
|
||||
struct_.struct_.drag_target_drag_enter = browser_host_drag_target_drag_enter;
|
||||
struct_.struct_.drag_target_drag_over = browser_host_drag_target_drag_over;
|
||||
struct_.struct_.drag_target_drag_leave = browser_host_drag_target_drag_leave;
|
||||
struct_.struct_.drag_target_drop = browser_host_drag_target_drop;
|
||||
struct_.struct_.drag_source_ended_at = browser_host_drag_source_ended_at;
|
||||
struct_.struct_.drag_source_system_drag_ended =
|
||||
browser_host_drag_source_system_drag_ended;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
Reference in New Issue
Block a user