summaryrefslogtreecommitdiffstats
path: root/webkit/tools
diff options
context:
space:
mode:
authoravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-14 15:09:16 +0000
committeravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-14 15:09:16 +0000
commitc598ef063e39a389658efdeca4f0054d8a61582a (patch)
tree7070b289a0de2263663f31117432233288cdb6bf /webkit/tools
parentd602155583957d1a807f528a2b415e02bf39c7df (diff)
downloadchromium_src-c598ef063e39a389658efdeca4f0054d8a61582a.zip
chromium_src-c598ef063e39a389658efdeca4f0054d8a61582a.tar.gz
chromium_src-c598ef063e39a389658efdeca4f0054d8a61582a.tar.bz2
Pass the Cocoa dirty rect to the web view for adding to its dirty rect.
Review URL: http://codereview.chromium.org/10701 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5475 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r--webkit/tools/test_shell/mac/test_shell_webview.mm9
-rw-r--r--webkit/tools/test_shell/mac/webwidget_host.mm4
-rw-r--r--webkit/tools/test_shell/webwidget_host.h12
3 files changed, 20 insertions, 5 deletions
diff --git a/webkit/tools/test_shell/mac/test_shell_webview.mm b/webkit/tools/test_shell/mac/test_shell_webview.mm
index f0b28ef..17d6b79 100644
--- a/webkit/tools/test_shell/mac/test_shell_webview.mm
+++ b/webkit/tools/test_shell/mac/test_shell_webview.mm
@@ -48,8 +48,15 @@
CGContextSetRGBFillColor (context, 1, 0, 1, 1);
CGContextFillRect(context, NSRectToCGRect(rect));
- if (shell_ && shell_->webView())
+ if (shell_ && shell_->webView()) {
+ gfx::Rect client_rect(NSRectToCGRect(rect));
+ // flip from cocoa coordinates
+ client_rect.set_y([self frame].size.height -
+ client_rect.height() - client_rect.y());
+
+ shell_->webViewHost()->UpdatePaintRect(client_rect);
shell_->webViewHost()->Paint();
+ }
}
- (IBAction)goBack:(id)sender {
diff --git a/webkit/tools/test_shell/mac/webwidget_host.mm b/webkit/tools/test_shell/mac/webwidget_host.mm
index 09151d4..95c2b92 100644
--- a/webkit/tools/test_shell/mac/webwidget_host.mm
+++ b/webkit/tools/test_shell/mac/webwidget_host.mm
@@ -143,6 +143,10 @@ WebWidgetHost::~WebWidgetHost() {
webwidget_->Release();
}
+void WebWidgetHost::UpdatePaintRect(const gfx::Rect& rect) {
+ paint_rect_ = paint_rect_.Union(rect);
+}
+
void WebWidgetHost::Paint() {
NSRect r = [view_ frame];
gfx::Rect client_rect(NSRectToCGRect(r));
diff --git a/webkit/tools/test_shell/webwidget_host.h b/webkit/tools/test_shell/webwidget_host.h
index 3bc2ac8..4f78744 100644
--- a/webkit/tools/test_shell/webwidget_host.h
+++ b/webkit/tools/test_shell/webwidget_host.h
@@ -48,6 +48,14 @@ class WebWidgetHost {
WebWidgetHost();
~WebWidgetHost();
+#if defined(OS_MACOSX) || defined(OS_LINUX)
+ public:
+ // Allow clients to update the paint rect. For example, if we get a gdk
+ // expose event, we need to update the paint rect.
+ void UpdatePaintRect(const gfx::Rect& rect);
+ protected:
+#endif
+
#if defined(OS_WIN)
// Per-class wndproc. Returns true if the event should be swallowed.
virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam);
@@ -83,10 +91,6 @@ class WebWidgetHost {
static gfx::WindowHandle CreateWindow(gfx::WindowHandle parent, void* host);
void WindowDestroyed();
void Resize(const gfx::Size& size);
-
- // Allow clients to update the paint rect. For example, if we get a gdk
- // expose event, we need to update the paint rect.
- void UpdatePaintRect(const gfx::Rect& rect);
#endif
void TrackMouseLeave(bool enable);