mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Improve the handling of invalidation/painting for off-screen rendering (issue #695).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@745 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -76,8 +76,9 @@ class WebWidgetHost {
|
||||
gfx::NativeView view_handle() const { return view_; }
|
||||
WebKit::WebWidget* webwidget() const { return webwidget_; }
|
||||
|
||||
void DidInvalidateRect(const gfx::Rect& rect);
|
||||
void DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect);
|
||||
void InvalidateRect(const gfx::Rect& rect);
|
||||
|
||||
void ScrollRect(int dx, int dy, const gfx::Rect& clip_rect);
|
||||
|
||||
// Called for accelerated content like WebGL.
|
||||
void ScheduleComposite();
|
||||
@@ -89,20 +90,11 @@ class WebWidgetHost {
|
||||
void SetCursor(HCURSOR cursor);
|
||||
#endif
|
||||
|
||||
// Update the region that will be painted to the canvas by WebKit the next
|
||||
// time that Paint() is called.
|
||||
void UpdatePaintRect(const gfx::Rect& rect);
|
||||
|
||||
// Update the region that will be drawn to the device the next time Paint()
|
||||
// is called. This is only used when window rendering is disabled.
|
||||
void UpdateRedrawRect(const gfx::Rect& rect);
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
void Paint(SkRegion& update_rgn);
|
||||
#else
|
||||
void Paint();
|
||||
#endif
|
||||
void InvalidateRect(const gfx::Rect& rect);
|
||||
|
||||
bool GetImage(int width, int height, void* buffer);
|
||||
|
||||
@@ -115,8 +107,6 @@ class WebWidgetHost {
|
||||
|
||||
WebKit::WebKeyboardEvent GetLastKeyEvent() const { return last_key_event_; }
|
||||
|
||||
void PaintRect(const gfx::Rect& rect);
|
||||
|
||||
void SetTooltipText(const CefString& tooltip_text);
|
||||
|
||||
void SendKeyEvent(cef_key_type_t type, const cef_key_info_t& keyInfo,
|
||||
@@ -137,6 +127,8 @@ class WebWidgetHost {
|
||||
|
||||
void SetFrameRate(int frames_per_second);
|
||||
|
||||
virtual bool IsTransparent() { return false; }
|
||||
|
||||
void set_popup(bool popup) { popup_ = popup; }
|
||||
bool popup() { return popup_; }
|
||||
|
||||
@@ -145,20 +137,26 @@ class WebWidgetHost {
|
||||
protected:
|
||||
WebWidgetHost();
|
||||
|
||||
// Called from the Schedule*() methods.
|
||||
void ScheduleInvalidateTimer();
|
||||
void DoInvalidate();
|
||||
// Update the region that will be painted to the canvas by WebKit the next
|
||||
// time that Paint() is called.
|
||||
void UpdatePaintRect(const gfx::Rect& rect);
|
||||
|
||||
// If window rendering is disabled paint messages are generated after all
|
||||
// other pending messages have been processed.
|
||||
void SchedulePaintTimer();
|
||||
void DoPaint();
|
||||
void PaintRect(const gfx::Rect& rect);
|
||||
|
||||
// Trigger the OS to invalidate/repaint the window.
|
||||
void InvalidateWindow();
|
||||
void InvalidateWindowRect(const gfx::Rect& rect);
|
||||
|
||||
// When window rendering is enabled this method invalidates the client area to
|
||||
// trigger repaint via the OS. When window rendering is disabled this method
|
||||
// is used to generate CefRenderHandler::OnPaint() calls.
|
||||
void ScheduleTimer();
|
||||
void DoTimer();
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Per-class wndproc. Returns true if the event should be swallowed.
|
||||
virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
void Resize(LPARAM lparam);
|
||||
virtual void MouseEvent(UINT message, WPARAM wparam, LPARAM lparam);
|
||||
void WheelEvent(WPARAM wparam, LPARAM lparam);
|
||||
virtual void KeyEvent(UINT message, WPARAM wparam, LPARAM lparam);
|
||||
@@ -181,7 +179,6 @@ class WebWidgetHost {
|
||||
#elif defined(OS_MACOSX)
|
||||
// These need to be called from a non-subclass, so they need to be public.
|
||||
public:
|
||||
void Resize(const gfx::Rect& rect);
|
||||
virtual void MouseEvent(NSEvent* event);
|
||||
void WheelEvent(NSEvent* event);
|
||||
virtual void KeyEvent(NSEvent* event);
|
||||
@@ -202,7 +199,6 @@ class WebWidgetHost {
|
||||
// ---------------------------------------------------------------------------
|
||||
static gfx::NativeView CreateWidget(gfx::NativeView parent_view,
|
||||
WebWidgetHost* host);
|
||||
void Resize(const gfx::Size& size);
|
||||
virtual void KeyEvent(GdkEventKey* event);
|
||||
#endif
|
||||
|
||||
@@ -239,14 +235,10 @@ class WebWidgetHost {
|
||||
gfx::Rect paint_rect_;
|
||||
#endif
|
||||
|
||||
// Used to coalesce DidInvalidateRect() events into a single DoPaint() call.
|
||||
// Used when window rendering is disabled.
|
||||
base::OneShotTimer<WebWidgetHost> paint_timer_;
|
||||
base::TimeTicks last_paint_time_;
|
||||
|
||||
// Used to coalesce Schedule*() events into a single Invalidate() call.
|
||||
base::OneShotTimer<WebWidgetHost> invalidate_timer_;
|
||||
base::TimeTicks last_invalidate_time_;
|
||||
base::OneShotTimer<WebWidgetHost> timer_;
|
||||
base::TimeTicks timer_last_;
|
||||
bool timer_executing_;
|
||||
bool timer_wanted_;
|
||||
|
||||
int64 frame_delay_;
|
||||
|
||||
@@ -255,9 +247,6 @@ class WebWidgetHost {
|
||||
base::RepeatingTimer<WebWidgetHost> ime_timer_;
|
||||
#endif
|
||||
|
||||
// Redraw rectangle requested by an explicit call to CefBrowser::Invalidate().
|
||||
gfx::Rect redraw_rect_;
|
||||
|
||||
// The map of windowed plugins that need to be drawn when window rendering is
|
||||
// disabled.
|
||||
typedef std::map<gfx::PluginWindowHandle, webkit::npapi::WebPluginGeometry>
|
||||
@@ -289,12 +278,6 @@ class WebWidgetHost {
|
||||
WebKit::WebMouseEvent::Button mouse_button_down_;
|
||||
#endif
|
||||
|
||||
#if defined(TOOLKIT_GTK)
|
||||
// Since GtkWindow resize is asynchronous, we have to stash the dimensions,
|
||||
// so that the backing store doesn't have to wait for sizing to take place.
|
||||
gfx::Size logical_size_;
|
||||
#endif
|
||||
|
||||
WebKit::WebKeyboardEvent last_key_event_;
|
||||
|
||||
bool painting_;
|
||||
|
Reference in New Issue
Block a user