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:
@ -35,6 +35,10 @@
|
||||
#include "ui/base/cursor/cursor.h"
|
||||
#endif
|
||||
|
||||
#if defined(USE_X11)
|
||||
#include "ui/base/x/x11_util.h"
|
||||
#endif
|
||||
|
||||
namespace content {
|
||||
struct NativeWebKeyboardEvent;
|
||||
}
|
||||
@ -152,6 +156,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
virtual void CloseDevTools() OVERRIDE;
|
||||
virtual void SetMouseCursorChangeDisabled(bool disabled) OVERRIDE;
|
||||
virtual bool IsMouseCursorChangeDisabled() OVERRIDE;
|
||||
virtual bool IsWindowRenderingDisabled() OVERRIDE;
|
||||
virtual void WasResized() OVERRIDE;
|
||||
virtual void WasHidden(bool hidden) OVERRIDE;
|
||||
virtual void NotifyScreenInfoChanged() OVERRIDE;
|
||||
virtual void Invalidate(PaintElementType type) OVERRIDE;
|
||||
virtual void SendKeyEvent(const CefKeyEvent& event) OVERRIDE;
|
||||
virtual void SendMouseClickEvent(const CefMouseEvent& event,
|
||||
MouseButtonType type,
|
||||
@ -162,6 +171,20 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
int deltaX, int deltaY) OVERRIDE;
|
||||
virtual void SendFocusEvent(bool setFocus) OVERRIDE;
|
||||
virtual void SendCaptureLostEvent() OVERRIDE;
|
||||
virtual CefTextInputContext GetNSTextInputContext() OVERRIDE;
|
||||
virtual void HandleKeyEventBeforeTextInputClient(CefEventHandle keyEvent)
|
||||
OVERRIDE;
|
||||
virtual void HandleKeyEventAfterTextInputClient(CefEventHandle keyEvent)
|
||||
OVERRIDE;
|
||||
virtual void DragTargetDragEnter(CefRefPtr<CefDragData> drag_data,
|
||||
const CefMouseEvent& event,
|
||||
DragOperationsMask allowed_ops);
|
||||
virtual void DragTargetDragOver(const CefMouseEvent& event,
|
||||
DragOperationsMask allowed_ops);
|
||||
virtual void DragTargetDragLeave();
|
||||
virtual void DragTargetDrop(const CefMouseEvent& event);
|
||||
virtual void DragSourceSystemDragEnded();
|
||||
virtual void DragSourceEndedAt(int x, int y, DragOperationsMask op);
|
||||
|
||||
// CefBrowser methods.
|
||||
virtual CefRefPtr<CefBrowserHost> GetHost() OVERRIDE;
|
||||
@ -188,6 +211,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
CefProcessId target_process,
|
||||
CefRefPtr<CefProcessMessage> message) OVERRIDE;
|
||||
|
||||
// Returns true if windowless rendering is enabled.
|
||||
bool IsWindowless() const;
|
||||
// Returns true if transparent painting is enabled.
|
||||
bool IsTransparent() const;
|
||||
|
||||
// Called when the OS window hosting the browser is destroyed.
|
||||
void WindowDestroyed();
|
||||
|
||||
@ -195,6 +223,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
// native browser window is not longer processing messages.
|
||||
void DestroyBrowser();
|
||||
|
||||
// Cancel display of the context menu, if any.
|
||||
void CancelContextMenu();
|
||||
|
||||
// Returns the native view for the WebContents.
|
||||
gfx::NativeView GetContentView() const;
|
||||
|
||||
@ -340,6 +371,16 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
content::WebContents* source,
|
||||
const content::DropData& data,
|
||||
blink::WebDragOperationsMask operations_allowed) OVERRIDE;
|
||||
virtual bool ShouldCreateWebContents(
|
||||
content::WebContents* web_contents,
|
||||
int route_id,
|
||||
WindowContainerType window_container_type,
|
||||
const base::string16& frame_name,
|
||||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
content::SessionStorageNamespace* session_storage_namespace,
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view) OVERRIDE;
|
||||
virtual void WebContentsCreated(content::WebContents* source_contents,
|
||||
int opener_render_frame_id,
|
||||
const base::string16& frame_name,
|
||||
@ -608,6 +649,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
#endif // defined(USE_AURA)
|
||||
#if defined(USE_X11)
|
||||
CefWindowX11* window_x11_;
|
||||
scoped_ptr<ui::XScopedCursor> invisible_cursor_;
|
||||
#endif // defined(USE_X11)
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefBrowserHostImpl);
|
||||
|
Reference in New Issue
Block a user