Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(765)

Side by Side Diff: webkit/tools/test_shell/webwidget_host_gtk.cc

Issue 6136005: Chromium support for window.webkitRequestAnimationFrame() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ScheduleAnimation implemented as part of WebWidgetHost Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/tools/test_shell/webwidget_host.h" 5 #include "webkit/tools/test_shell/webwidget_host.h"
6 6
7 #include <cairo/cairo.h> 7 #include <cairo/cairo.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 height 320 height
321 }; 321 };
322 GdkWindow* window = view_->window; 322 GdkWindow* window = view_->window;
323 gdk_window_invalidate_rect(window, &grect, 0); 323 gdk_window_invalidate_rect(window, &grect, 0);
324 } 324 }
325 325
326 WebWidgetHost::WebWidgetHost() 326 WebWidgetHost::WebWidgetHost()
327 : view_(NULL), 327 : view_(NULL),
328 webwidget_(NULL), 328 webwidget_(NULL),
329 scroll_dx_(0), 329 scroll_dx_(0),
330 scroll_dy_(0) { 330 scroll_dy_(0),
331 ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) {
331 set_painting(false); 332 set_painting(false);
332 } 333 }
333 334
334 WebWidgetHost::~WebWidgetHost() { 335 WebWidgetHost::~WebWidgetHost() {
335 // We may be deleted before the view_. Clear out the signals so that we don't 336 // We may be deleted before the view_. Clear out the signals so that we don't
336 // attempt to invoke something on a deleted object. 337 // attempt to invoke something on a deleted object.
337 g_object_set_data(G_OBJECT(view_), kWebWidgetHostKey, NULL); 338 g_object_set_data(G_OBJECT(view_), kWebWidgetHostKey, NULL);
338 g_signal_handlers_disconnect_matched(view_, 339 g_signal_handlers_disconnect_matched(view_,
339 G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, this); 340 G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, this);
340 webwidget_->close(); 341 webwidget_->close();
(...skipping 16 matching lines...) Expand all
357 ResetScrollRect(); 358 ResetScrollRect();
358 paint_rect_ = client_rect; 359 paint_rect_ = client_rect;
359 canvas_.reset(new skia::PlatformCanvas(width, height, true)); 360 canvas_.reset(new skia::PlatformCanvas(width, height, true));
360 if (!canvas_.get()) { 361 if (!canvas_.get()) {
361 // memory allocation failed, we can't paint. 362 // memory allocation failed, we can't paint.
362 LOG(ERROR) << "Failed to allocate memory for " << width << "x" << height; 363 LOG(ERROR) << "Failed to allocate memory for " << width << "x" << height;
363 return; 364 return;
364 } 365 }
365 } 366 }
366 367
368 webwidget_->animate();
369
367 // This may result in more invalidation 370 // This may result in more invalidation
368 webwidget_->layout(); 371 webwidget_->layout();
369 372
370 // Paint the canvas if necessary. Allow painting to generate extra rects the 373 // Paint the canvas if necessary. Allow painting to generate extra rects the
371 // first time we call it. This is necessary because some WebCore rendering 374 // first time we call it. This is necessary because some WebCore rendering
372 // objects update their layout only when painted. 375 // objects update their layout only when painted.
373 // Store the total area painted in total_paint. Then tell the gdk window 376 // Store the total area painted in total_paint. Then tell the gdk window
374 // to update that area after we're done painting it. 377 // to update that area after we're done painting it.
375 gfx::Rect total_paint; 378 gfx::Rect total_paint;
376 for (int i = 0; i < 2; ++i) { 379 for (int i = 0; i < 2; ++i) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 425
423 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { 426 void WebWidgetHost::PaintRect(const gfx::Rect& rect) {
424 set_painting(true); 427 set_painting(true);
425 webwidget_->paint(canvas_.get(), rect); 428 webwidget_->paint(canvas_.get(), rect);
426 set_painting(false); 429 set_painting(false);
427 } 430 }
428 431
429 void WebWidgetHost::WindowDestroyed() { 432 void WebWidgetHost::WindowDestroyed() {
430 delete this; 433 delete this;
431 } 434 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698