diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-28 18:36:37 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-28 18:36:37 +0000 |
commit | d454745055f7ec8c6b5fc158c61f66452d39aabf (patch) | |
tree | 73395f7721bd5a23886a30afcab4ece31d88d866 /chrome | |
parent | 917543feedad73ad36a410413f9a5edc8b2e2c27 (diff) | |
download | chromium_src-d454745055f7ec8c6b5fc158c61f66452d39aabf.zip chromium_src-d454745055f7ec8c6b5fc158c61f66452d39aabf.tar.gz chromium_src-d454745055f7ec8c6b5fc158c61f66452d39aabf.tar.bz2 |
The GetWindowRect must return the rect of the container HWND; not the actual window rect. The usage of GetWindowRect in the ChromeClientImpl::windowRect() function is erroneous, and my modification of GetWindowRect to return the HWND's root ancestor rect broke drop down combo boxes and other embeded controls.
So instead, add a GetRootWindowRect which gets the root anncestor of the HWND's rect and use it in ChromeClientImpl::windowRect().
BUG=1344367,1186573,1334505
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1496 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-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 |
5 files changed, 20 insertions, 9 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__ - |