summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-15 16:18:33 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-15 16:18:33 +0000
commit86272b73e152161cb64647490810e5c2c54f59da (patch)
treecc709ed57422ae2f511d554620b6b16eaa5c5848 /chrome
parent14b67ce757d4d7fd38ff402cdb738a24fa741719 (diff)
downloadchromium_src-86272b73e152161cb64647490810e5c2c54f59da.zip
chromium_src-86272b73e152161cb64647490810e5c2c54f59da.tar.gz
chromium_src-86272b73e152161cb64647490810e5c2c54f59da.tar.bz2
[Mac] Fix recursive drawing in DidPaintRect() to defer painting of the second invalid rect.
BUG=http://crbug.com/24779 TEST=See test case in bug. Gmail should paint correctly when returning from fullscreen. Review URL: http://codereview.chromium.org/335029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41590 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.h3
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.mm16
2 files changed, 11 insertions, 8 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.h b/chrome/browser/renderer_host/render_widget_host_view_mac.h
index f95a418..10a21c8 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.h
@@ -155,9 +155,6 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView {
// 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.
- NSRect invalid_rect_;
-
// The time at which this view started displaying white pixels as a result of
// not having anything to paint (empty backing store from renderer). This
// value returns true for is_null() if we are not recording whiteout times.
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
index 178a670..0ee2c885 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
@@ -48,6 +48,7 @@ static inline int ToWebKitModifiers(NSUInteger flags) {
- (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r;
- (void)keyEvent:(NSEvent *)theEvent wasKeyEquivalent:(BOOL)equiv;
- (void)cancelChildPopups;
+- (void)callSetNeedsDisplayInRect:(NSValue*)rect;
@end
namespace {
@@ -329,9 +330,12 @@ void RenderWidgetHostViewMac::DidPaintBackingStoreRects(
if (about_to_validate_and_paint_) {
// As much as we'd like to use -setNeedsDisplayInRect: here, we can't.
// We're in the middle of executing a -drawRect:, and as soon as it
- // returns Cocoa will clear its record of what needs display. If we want
- // to handle the recursive drawing, we need to do it ourselves.
- invalid_rect_ = NSUnionRect(invalid_rect_, ns_rect);
+ // returns Cocoa will clear its record of what needs display. We instead
+ // use |performSelector:| to call |setNeedsDisplayInRect:| after returning
+ // to the main loop, at which point |drawRect:| is no longer on the stack.
+ [cocoa_view_ performSelector:@selector(callSetNeedsDisplayInRect:)
+ withObject:[NSValue valueWithRect:ns_rect]
+ afterDelay:0];
} else {
[cocoa_view_ setNeedsDisplayInRect:ns_rect];
}
@@ -934,6 +938,10 @@ bool RenderWidgetHostViewMac::ContainsNativeView(
renderWidgetHostView_->render_widget_host_->WasResized();
}
+- (void)callSetNeedsDisplayInRect:(NSValue*)rect {
+ [self setNeedsDisplayInRect:[rect rectValue]];
+}
+
- (void)drawRect:(NSRect)dirtyRect {
if (!renderWidgetHostView_->render_widget_host_) {
// TODO(shess): Consider using something more noticable?
@@ -945,12 +953,10 @@ bool RenderWidgetHostViewMac::ContainsNativeView(
DCHECK(renderWidgetHostView_->render_widget_host_->process()->HasConnection());
DCHECK(!renderWidgetHostView_->about_to_validate_and_paint_);
- renderWidgetHostView_->invalid_rect_ = dirtyRect;
renderWidgetHostView_->about_to_validate_and_paint_ = true;
BackingStoreMac* backing_store = static_cast<BackingStoreMac*>(
renderWidgetHostView_->render_widget_host_->GetBackingStore(true));
renderWidgetHostView_->about_to_validate_and_paint_ = false;
- dirtyRect = renderWidgetHostView_->invalid_rect_;
if (backing_store) {
NSRect view_bounds = [self bounds];