Windows/Linux: Fix positioning of select popups and dismissal on window move/resize by calling new CefBrowserHost::NotifyMoveOrResizeStarted() method from client applications (issue #1208).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1901 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2014-10-29 18:14:47 +00:00
parent 0cbadc6e07
commit 470518a52e
15 changed files with 181 additions and 29 deletions

View File

@@ -31,10 +31,13 @@
#include "grit/ui_unscaled_resources.h"
#include "net/base/mime_util.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/win/shell.h"
#include "ui/gfx/win/hwnd_util.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h"
#include "ui/views/widget/widget.h"
#include "ui/views/win/hwnd_message_handler_delegate.h"
#include "ui/views/win/hwnd_util.h"
#pragma comment(lib, "dwmapi.lib")
@@ -601,6 +604,12 @@ LRESULT CALLBACK CefBrowserHostImpl::WndProc(HWND hwnd, UINT message,
}
return 0;
case WM_MOVING:
case WM_MOVE:
if (browser)
browser->NotifyMoveOrResizeStarted();
return 0;
case WM_SETFOCUS:
if (browser)
browser->SetFocus(true);
@@ -942,3 +951,24 @@ void CefBrowserHostImpl::PlatformTranslateMouseEvent(
// timestamp
result.timeStampSeconds = GetMessageTime() / 1000.0;
}
void CefBrowserHostImpl::PlatformNotifyMoveOrResizeStarted() {
if (IsWindowless())
return;
if (!window_widget_)
return;
// Notify DesktopWindowTreeHostWin of move events so that screen rectangle
// information is communicated to the renderer process and popups are
// displayed in the correct location.
views::DesktopWindowTreeHostWin* tree_host =
static_cast<views::DesktopWindowTreeHostWin*>(
aura::WindowTreeHost::GetForAcceleratedWidget(
HWNDForWidget(window_widget_)));
DCHECK(tree_host);
if (tree_host) {
// Cast to HWNDMessageHandlerDelegate so we can access HandleMove().
static_cast<views::HWNDMessageHandlerDelegate*>(tree_host)->HandleMove();
}
}