mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-23 23:47:43 +01:00
Don't generate update tasks while layout is occurring.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@369 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
587eb7871d
commit
9d2dbef101
@ -89,19 +89,17 @@ gfx::PluginWindowHandle WebWidgetHost::GetWindowedPluginAt(int x, int y)
|
||||
}
|
||||
|
||||
void WebWidgetHost::DoPaint() {
|
||||
has_update_task_ = false;
|
||||
|
||||
// TODO(cef): The below code is cross-platform but the IsIdle() method
|
||||
// currently requires patches to Chromium. Since this code is only executed
|
||||
// on Windows it's been stuck behind an #ifdef for now to avoid having to
|
||||
// patch Chromium code on other platforms.
|
||||
#if defined(OS_WIN)
|
||||
if (MessageLoop::current()->IsIdle()) {
|
||||
has_update_task_ = false;
|
||||
// Paint to the delegate. The rect argument is unused.
|
||||
Paint(gfx::Rect());
|
||||
} else {
|
||||
// Try again later.
|
||||
has_update_task_ = true;
|
||||
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||
base::Bind(&WebWidgetHost::DoPaint, weak_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ void WebWidgetHost::Paint(const gfx::Rect& /*dirty_rect*/) {
|
||||
|
||||
// Draw children
|
||||
UpdateWindow(view_);
|
||||
} else if(!damaged_rgn.isEmpty()) {
|
||||
} else {
|
||||
// Paint to the delegate.
|
||||
DCHECK(paint_delegate_);
|
||||
const SkBitmap& bitmap = canvas_->getDevice()->accessBitmap(false);
|
||||
@ -531,8 +531,9 @@ void WebWidgetHost::InvalidateRect(const gfx::Rect& rect)
|
||||
RECT r = rect.ToRECT();
|
||||
::InvalidateRect(view_, &r, FALSE);
|
||||
} else {
|
||||
// Paint() will be called by DoPaint().
|
||||
if (!has_update_task_) {
|
||||
// Don't post a paint task if this invalidation occurred during layout or if
|
||||
// a paint task is already pending. Paint() will be called by DoPaint().
|
||||
if (!layouting_ && !has_update_task_) {
|
||||
has_update_task_ = true;
|
||||
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||
base::Bind(&WebWidgetHost::DoPaint, weak_factory_.GetWeakPtr()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user