diff options
-rw-r--r-- | chrome/browser/resource_message_filter.cc | 13 | ||||
-rw-r--r-- | chrome/browser/resource_message_filter.h | 3 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 6 | ||||
-rw-r--r-- | chrome/renderer/render_widget.cc | 5 | ||||
-rw-r--r-- | chrome/renderer/render_widget.h | 2 | ||||
-rw-r--r-- | webkit/glue/chrome_client_impl.cc | 2 | ||||
-rw-r--r-- | webkit/glue/webwidget_delegate.h | 6 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.cc | 10 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.h | 1 |
9 files changed, 36 insertions, 12 deletions
diff --git a/chrome/browser/resource_message_filter.cc b/chrome/browser/resource_message_filter.cc index d349839..77ae6b1 100644 --- a/chrome/browser/resource_message_filter.cc +++ b/chrome/browser/resource_message_filter.cc @@ -183,6 +183,7 @@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(ViewHostMsg_ClipboardReadHTML, OnClipboardReadHTML) IPC_MESSAGE_HANDLER(ViewHostMsg_GetWindowRect, OnGetWindowRect) + IPC_MESSAGE_HANDLER(ViewHostMsg_GetRootWindowRect, OnGetRootWindowRect) IPC_MESSAGE_HANDLER(ViewHostMsg_GetMimeTypeFromExtension, OnGetMimeTypeFromExtension) IPC_MESSAGE_HANDLER(ViewHostMsg_GetMimeTypeFromFile, @@ -433,14 +434,19 @@ void ResourceMessageFilter::OnClipboardReadHTML(std::wstring* markup, *src_url = GURL(src_url_str); } -void ResourceMessageFilter::OnGetWindowRect(HWND hwnd_view_container, - gfx::Rect *rect) { +void ResourceMessageFilter::OnGetWindowRect(HWND window, gfx::Rect *rect) { RECT window_rect = {0}; - HWND window = ::GetAncestor(hwnd_view_container, GA_ROOT); GetWindowRect(window, &window_rect); *rect = window_rect; } +void ResourceMessageFilter::OnGetRootWindowRect(HWND window, gfx::Rect *rect) { + RECT window_rect = {0}; + HWND root_window = ::GetAncestor(window, GA_ROOT); + GetWindowRect(root_window, &window_rect); + *rect = window_rect; +} + void ResourceMessageFilter::OnGetMimeTypeFromExtension( const std::wstring& ext, std::string* mime_type) { net::GetMimeTypeFromExtension(ext, mime_type); @@ -707,4 +713,3 @@ void ResourceMessageFilter::OnDnsPrefetch( const std::vector<std::string>& hostnames) { chrome_browser_net::DnsPrefetchList(hostnames); } - diff --git a/chrome/browser/resource_message_filter.h b/chrome/browser/resource_message_filter.h index b1500ae..55b2056 100644 --- a/chrome/browser/resource_message_filter.h +++ b/chrome/browser/resource_message_filter.h @@ -113,6 +113,7 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, void OnClipboardReadAsciiText(std::string* result); void OnClipboardReadHTML(std::wstring* markup, GURL* src_url); void OnGetWindowRect(HWND window, gfx::Rect *rect); + void OnGetRootWindowRect(HWND window, gfx::Rect *rect); void OnGetMimeTypeFromExtension(const std::wstring& ext, std::string* mime_type); void OnGetMimeTypeFromFile(const std::wstring& file_path, @@ -176,5 +177,3 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, }; #endif // CHROME_BROWSER_RENDERER_RESOURCE_MSG_FILTER_H__ - - diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 973c6da..3b6a8f3 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -1014,5 +1014,9 @@ IPC_BEGIN_MESSAGES(ViewHost, 2) IPC_MESSAGE_ROUTED1(ViewHostMsg_UnloadListenerChanged, bool /* has_listener */) -IPC_END_MESSAGES(ViewHost) + // Returns the window location of the window this widget is embeded in. + IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_GetRootWindowRect, + HWND /* window */, + gfx::Rect /* Out: Window location */) +IPC_END_MESSAGES(ViewHost) diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index c25b9be..95b1050 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -639,6 +639,10 @@ void RenderWidget::SetWindowRect(WebWidget* webwidget, const gfx::Rect& pos) { } } +void RenderWidget::GetRootWindowRect(WebWidget* webwidget, gfx::Rect* rect) { + Send(new ViewHostMsg_GetRootWindowRect(routing_id_, host_window_, rect)); +} + void RenderWidget::OnImeSetInputMode(bool is_active) { // A renderer process may move its input focus and the caret position // while a browser process stop receiving IPC messages. @@ -749,4 +753,3 @@ void RenderWidget::DidMove(WebWidget* webwidget, if (i == plugin_window_moves_.size()) plugin_window_moves_.push_back(move); } - diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h index 1d27677..ea1e4f7e 100644 --- a/chrome/renderer/render_widget.h +++ b/chrome/renderer/render_widget.h @@ -67,6 +67,7 @@ class RenderWidget : public IPC::Channel::Listener, virtual void Blur(WebWidget* webwidget); virtual void GetWindowRect(WebWidget* webwidget, gfx::Rect* rect); virtual void SetWindowRect(WebWidget* webwidget, const gfx::Rect& rect); + virtual void GetRootWindowRect(WebWidget* webwidget, gfx::Rect* rect); virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move); virtual void RunModal(WebWidget* webwidget) {} @@ -255,4 +256,3 @@ class RenderWidget : public IPC::Channel::Listener, }; #endif // CHROME_RENDERER_RENDER_WIDGET_H__ - diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc index 99b1882..3711abf 100644 --- a/webkit/glue/chrome_client_impl.cc +++ b/webkit/glue/chrome_client_impl.cc @@ -74,7 +74,7 @@ void ChromeClientImpl::setWindowRect(const WebCore::FloatRect& r) { WebCore::FloatRect ChromeClientImpl::windowRect() { if (webview_->delegate()) { gfx::Rect rect; - webview_->delegate()->GetWindowRect(webview_, &rect); + webview_->delegate()->GetRootWindowRect(webview_, &rect); return WebCore::FloatRect( static_cast<float>(rect.x()), static_cast<float>(rect.y()), diff --git a/webkit/glue/webwidget_delegate.h b/webkit/glue/webwidget_delegate.h index 4c13889..ecc21c5 100644 --- a/webkit/glue/webwidget_delegate.h +++ b/webkit/glue/webwidget_delegate.h @@ -64,11 +64,14 @@ class WebWidgetDelegate { // synchronously? virtual void SetWindowRect(WebWidget* webwidget, const gfx::Rect& rect) = 0; + // Returns the rectangle of the window in which this WebWidget is embeded in. + virtual void GetRootWindowRect(WebWidget* webwidget, gfx::Rect* rect) = 0; + // Keeps track of the necessary window move for a plugin window that resulted // from a scroll operation. That way, all plugin windows can be moved at the // same time as each other and the page. virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move) = 0; - + // Suppress input events to other windows, and do not return until the widget // is closed. This is used to support |window.showModalDialog|. virtual void RunModal(WebWidget* webwidget) = 0; @@ -85,4 +88,3 @@ class WebWidgetDelegate { }; #endif // #ifndef WEBKIT_GLUE_WEBWIDGET_DELEGATE_H__ - diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 21dc169..55f9285 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -741,6 +741,16 @@ void TestWebViewDelegate::SetWindowRect(WebWidget* webwidget, } } +void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget, + gfx::Rect* out_rect) { + if (WebWidgetHost* host = GetHostForWidget(webwidget)) { + RECT rect; + HWND root_window = ::GetAncestor(host->window_handle(), GA_ROOT); + ::GetWindowRect(root_window, &rect); + *out_rect = gfx::Rect(rect); + } +} + void TestWebViewDelegate::DidMove(WebWidget* webwidget, const WebPluginGeometry& move) { WebPluginDelegateImpl::MoveWindow( diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h index a47081b..c42567a 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -194,6 +194,7 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, public const WebCursor& cursor); virtual void GetWindowRect(WebWidget* webwidget, gfx::Rect* rect); virtual void SetWindowRect(WebWidget* webwidget, const gfx::Rect& rect); + virtual void GetRootWindowRect(WebWidget *,gfx::Rect *); virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move); virtual void RunModal(WebWidget* webwidget); virtual void AddRef() { |