On Mon, Apr 13, 2009 at 11:47 AM, Peter Kasting <pkast...@google.com> wrote:
> The issue I'm fixing is that if we get an updated rect from the renderer
> while DidPaintRect() is disabled, we don't repaint any extra damaged area in
> that rect until the next time it happens to get damaged, because we don't
> send anyone any notifications.  This is because we were putting in an
> anti-recursion check in the "model" when instead it should have been in the
> "view".

I always thought that, when we paint without a backing store, we're
painting the whole thing so this isn't an issue.

After patching in your change, the following makes Linux work for me. Hopefully
I have the correct end of the stick this time.

Gmail will probably mangle this patch, so it's attached as well.

diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
index 32135f9..eb1b966 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -159,6 +159,7 @@
RenderWidgetHostViewGtk::RenderWidgetHostViewGtk(RenderWidgetHost*
widget_host)
       parent_(NULL),
       popup_signal_id_(0),
       activatable_(true),
+      about_to_validate_and_paint_(false),
       is_loading_(false) {
   host_->set_view(this);
 }
@@ -277,7 +278,10 @@ void RenderWidgetHostViewGtk::IMEUpdateStatus(int control,
 }

 void RenderWidgetHostViewGtk::DidPaintRect(const gfx::Rect& rect) {
-  Paint(rect);
+  if (about_to_validate_and_paint_)
+    invalid_rect_ = invalid_rect_.Union(rect);
+  else
+    Paint(rect);
 }

 void RenderWidgetHostViewGtk::DidScrollRect(const gfx::Rect& rect, int dx,
@@ -338,7 +342,13 @@ void
RenderWidgetHostViewGtk::PasteFromSelectionClipboard() {
 }

 void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) {
+  DCHECK(!about_to_validate_and_paint_);
+
+  invalid_rect_ = damage_rect;
+  about_to_validate_and_paint_ = true;
   BackingStore* backing_store = host_->GetBackingStore();
+  // Calling GetBackingStore maybe have changed |invalid_rect_|...
+  about_to_validate_and_paint_ = false;

   GdkWindow* window = view_.get()->window;
   if (backing_store) {
@@ -347,7 +357,7 @@ void RenderWidgetHostViewGtk::Paint(const
gfx::Rect& damage_rect) {
     // Destroy()ed yet and it receives paint messages...
     if (window) {
       backing_store->ShowRect(
-          damage_rect, x11_util::GetX11WindowFromGtkWidget(view_.get()));
+          invalid_rect_, x11_util::GetX11WindowFromGtkWidget(view_.get()));
     }
   } else {
     if (window)
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.h
b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
index 215549d..cd49a8d 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
@@ -101,6 +101,12 @@ class RenderWidgetHostViewGtk : public
RenderWidgetHostView {
   // activatable popup: <select> dropdown. Example of non-activatable popup:
   // form autocomplete.
   bool activatable_;
+  // This is true when we are currently painting and thus should handle extra
+  // paint requests by expanding the invalid rect rather than actually
+  // painting.
+  bool about_to_validate_and_paint_;
+  // This is the rectangle which we'll paint.
+  gfx::Rect invalid_rect_;

   // Whether we are currently loading.
   bool is_loading_;

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Attachment: patch
Description: Binary data

Reply via email to