diff options
author | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-05 18:34:25 +0000 |
---|---|---|
committer | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-05 18:34:25 +0000 |
commit | 89eb3f4e9e2cd108e163f4d6a0e27476988c3a48 (patch) | |
tree | 677534f971c0ba08bff35f556cda3009e57712a8 | |
parent | bb95da2151c0d2eeb1b9a9cd52db041aa0ebf107 (diff) | |
download | chromium_src-89eb3f4e9e2cd108e163f4d6a0e27476988c3a48.zip chromium_src-89eb3f4e9e2cd108e163f4d6a0e27476988c3a48.tar.gz chromium_src-89eb3f4e9e2cd108e163f4d6a0e27476988c3a48.tar.bz2 |
make sure the host gets notified of invalidates so we only paint what changes
Review URL: http://codereview.chromium.org/9419
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4790 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/tools/test_shell/mac/test_webview_delegate.mm | 4 | ||||
-rw-r--r-- | webkit/tools/test_shell/mac/webwidget_host.mm | 9 |
2 files changed, 7 insertions, 6 deletions
diff --git a/webkit/tools/test_shell/mac/test_webview_delegate.mm b/webkit/tools/test_shell/mac/test_webview_delegate.mm index d9bb967..febbc7c 100644 --- a/webkit/tools/test_shell/mac/test_webview_delegate.mm +++ b/webkit/tools/test_shell/mac/test_webview_delegate.mm @@ -624,8 +624,8 @@ gfx::ViewHandle TestWebViewDelegate::GetContainingWindow(WebWidget* webwidget) { void TestWebViewDelegate::DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect) { - if (shell_ && shell_->webViewHost() && shell_->webViewHost()->window_handle()) - [shell_->webViewHost()->window_handle() setNeedsDisplay:YES]; + if (WebWidgetHost* host = GetHostForWidget(webwidget)) + host->DidInvalidateRect(rect); } void TestWebViewDelegate::DidScrollRect(WebWidget* webwidget, int dx, int dy, diff --git a/webkit/tools/test_shell/mac/webwidget_host.mm b/webkit/tools/test_shell/mac/webwidget_host.mm index 9341d03..a097c53 100644 --- a/webkit/tools/test_shell/mac/webwidget_host.mm +++ b/webkit/tools/test_shell/mac/webwidget_host.mm @@ -90,6 +90,8 @@ void WebWidgetHost::DidInvalidateRect(const gfx::Rect& damaged_rect) { paint_rect_ = paint_rect_.Union(damaged_rect); NSRect r = NSRectFromCGRect(damaged_rect.ToCGRect()); + // flip to cocoa coordinates + r.origin.y = [view_ frame].size.height - r.size.height - r.origin.y; [view_ setNeedsDisplayInRect:r]; } @@ -110,6 +112,8 @@ void WebWidgetHost::DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect) { scroll_dy_ = dy; NSRect r = NSRectFromCGRect(clip_rect.ToCGRect()); + // flip to cocoa coordinates + r.origin.y = [view_ frame].size.height - r.size.height - r.origin.y; [view_ setNeedsDisplayInRect:r]; } @@ -175,7 +179,7 @@ void WebWidgetHost::Paint() { // first time we call it. This is necessary because some WebCore rendering // objects update their layout only when painted. for (int i = 0; i < 2; ++i) { - paint_rect_ = client_rect;//.Intersect(paint_rect_); + paint_rect_ = client_rect.Intersect(paint_rect_); if (!paint_rect_.IsEmpty()) { gfx::Rect rect(paint_rect_); paint_rect_ = gfx::Rect(); @@ -201,9 +205,6 @@ void WebWidgetHost::Paint() { [view_ unlockFocus]; } - - // Draw children - // UpdateWindow(hwnd_); } void WebWidgetHost::Resize(const gfx::Rect& rect) { |