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:
@@ -14,6 +14,7 @@
|
||||
#include "libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/browser_host_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/drag_data_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/request_context_ctocpp.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
|
||||
@@ -330,6 +331,61 @@ bool CefBrowserHostCToCpp::IsMouseCursorChangeDisabled() {
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
bool CefBrowserHostCToCpp::IsWindowRenderingDisabled() {
|
||||
if (CEF_MEMBER_MISSING(struct_, is_window_rendering_disabled))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = struct_->is_window_rendering_disabled(struct_);
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::WasResized() {
|
||||
if (CEF_MEMBER_MISSING(struct_, was_resized))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->was_resized(struct_);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::WasHidden(bool hidden) {
|
||||
if (CEF_MEMBER_MISSING(struct_, was_hidden))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->was_hidden(struct_,
|
||||
hidden);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::NotifyScreenInfoChanged() {
|
||||
if (CEF_MEMBER_MISSING(struct_, notify_screen_info_changed))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->notify_screen_info_changed(struct_);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::Invalidate(PaintElementType type) {
|
||||
if (CEF_MEMBER_MISSING(struct_, invalidate))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->invalidate(struct_,
|
||||
type);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::SendKeyEvent(const CefKeyEvent& event) {
|
||||
if (CEF_MEMBER_MISSING(struct_, send_key_event))
|
||||
return;
|
||||
@@ -404,6 +460,120 @@ void CefBrowserHostCToCpp::SendCaptureLostEvent() {
|
||||
struct_->send_capture_lost_event(struct_);
|
||||
}
|
||||
|
||||
CefTextInputContext CefBrowserHostCToCpp::GetNSTextInputContext() {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_nstext_input_context))
|
||||
return NULL;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_text_input_context_t _retval = struct_->get_nstext_input_context(struct_);
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::HandleKeyEventBeforeTextInputClient(
|
||||
CefEventHandle keyEvent) {
|
||||
if (CEF_MEMBER_MISSING(struct_, handle_key_event_before_text_input_client))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->handle_key_event_before_text_input_client(struct_,
|
||||
keyEvent);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::HandleKeyEventAfterTextInputClient(
|
||||
CefEventHandle keyEvent) {
|
||||
if (CEF_MEMBER_MISSING(struct_, handle_key_event_after_text_input_client))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->handle_key_event_after_text_input_client(struct_,
|
||||
keyEvent);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::DragTargetDragEnter(CefRefPtr<CefDragData> drag_data,
|
||||
const CefMouseEvent& event, DragOperationsMask allowed_ops) {
|
||||
if (CEF_MEMBER_MISSING(struct_, drag_target_drag_enter))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: drag_data; type: refptr_same
|
||||
DCHECK(drag_data.get());
|
||||
if (!drag_data.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
struct_->drag_target_drag_enter(struct_,
|
||||
CefDragDataCToCpp::Unwrap(drag_data),
|
||||
&event,
|
||||
allowed_ops);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::DragTargetDragOver(const CefMouseEvent& event,
|
||||
DragOperationsMask allowed_ops) {
|
||||
if (CEF_MEMBER_MISSING(struct_, drag_target_drag_over))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->drag_target_drag_over(struct_,
|
||||
&event,
|
||||
allowed_ops);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::DragTargetDragLeave() {
|
||||
if (CEF_MEMBER_MISSING(struct_, drag_target_drag_leave))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->drag_target_drag_leave(struct_);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::DragTargetDrop(const CefMouseEvent& event) {
|
||||
if (CEF_MEMBER_MISSING(struct_, drag_target_drop))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->drag_target_drop(struct_,
|
||||
&event);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::DragSourceEndedAt(int x, int y,
|
||||
DragOperationsMask op) {
|
||||
if (CEF_MEMBER_MISSING(struct_, drag_source_ended_at))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->drag_source_ended_at(struct_,
|
||||
x,
|
||||
y,
|
||||
op);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::DragSourceSystemDragEnded() {
|
||||
if (CEF_MEMBER_MISSING(struct_, drag_source_system_drag_ended))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->drag_source_system_drag_ended(struct_);
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCToCpp<CefBrowserHostCToCpp, CefBrowserHost,
|
||||
|
Reference in New Issue
Block a user