| Index: content/browser/renderer_host/render_widget_host_view_win.cc
|
| diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc
|
| index 87866b23d3de8c63d0420f311d5423be091ffee7..f6f40287d71450a72d980b57a5eb250d2c85b396 100644
|
| --- a/content/browser/renderer_host/render_widget_host_view_win.cc
|
| +++ b/content/browser/renderer_host/render_widget_host_view_win.cc
|
| @@ -682,6 +682,8 @@ void RenderWidgetHostViewWin::UpdateCursor(const WebCursor& cursor) {
|
| }
|
|
|
| void RenderWidgetHostViewWin::UpdateCursorIfOverSelf() {
|
| + static HCURSOR kCursorResizeRight = LoadCursor(NULL, IDC_SIZENWSE);
|
| + static HCURSOR kCursorResizeLeft = LoadCursor(NULL, IDC_SIZENESW);
|
| static HCURSOR kCursorArrow = LoadCursor(NULL, IDC_ARROW);
|
| static HCURSOR kCursorAppStarting = LoadCursor(NULL, IDC_APPSTARTING);
|
| static HINSTANCE module_handle = GetModuleHandle(
|
| @@ -691,19 +693,25 @@ void RenderWidgetHostViewWin::UpdateCursorIfOverSelf() {
|
| CPoint pt;
|
| GetCursorPos(&pt);
|
| if (WindowFromPoint(pt) == m_hWnd) {
|
| - // We cannot pass in NULL as the module handle as this would only work for
|
| - // standard win32 cursors. We can also receive cursor types which are
|
| - // defined as webkit resources. We need to specify the module handle of
|
| - // chrome.dll while loading these cursors.
|
| - HCURSOR display_cursor = current_cursor_.GetCursor(module_handle);
|
| + BOOL result = ::ScreenToClient(m_hWnd, &pt);
|
| + DCHECK(result);
|
| + if (render_widget_host_->GetRootWindowResizerRect().Contains(pt.x, pt.y)) {
|
| + SetCursor(base::i18n::IsRTL() ? kCursorResizeLeft : kCursorResizeRight);
|
| + } else {
|
| + // We cannot pass in NULL as the module handle as this would only work for
|
| + // standard win32 cursors. We can also receive cursor types which are
|
| + // defined as webkit resources. We need to specify the module handle of
|
| + // chrome.dll while loading these cursors.
|
| + HCURSOR display_cursor = current_cursor_.GetCursor(module_handle);
|
|
|
| - // If a page is in the loading state, we want to show the Arrow+Hourglass
|
| - // cursor only when the current cursor is the ARROW cursor. In all other
|
| - // cases we should continue to display the current cursor.
|
| - if (is_loading_ && display_cursor == kCursorArrow)
|
| - display_cursor = kCursorAppStarting;
|
| + // If a page is in the loading state, we want to show the Arrow+Hourglass
|
| + // cursor only when the current cursor is the ARROW cursor. In all other
|
| + // cases we should continue to display the current cursor.
|
| + if (is_loading_ && display_cursor == kCursorArrow)
|
| + display_cursor = kCursorAppStarting;
|
|
|
| - SetCursor(display_cursor);
|
| + SetCursor(display_cursor);
|
| + }
|
| }
|
| }
|
|
|
| @@ -794,6 +802,31 @@ void RenderWidgetHostViewWin::Redraw() {
|
| EnumChildWindows(m_hWnd, EnumChildProc, lparam);
|
| }
|
|
|
| +void RenderWidgetHostViewWin::DrawResizeCorner(const gfx::Rect& paint_rect,
|
| + HDC dc) {
|
| + gfx::Rect resize_corner_rect =
|
| + render_widget_host_->GetRootWindowResizerRect();
|
| + if (!paint_rect.Intersect(resize_corner_rect).IsEmpty()) {
|
| + SkBitmap* bitmap = ResourceBundle::GetSharedInstance().
|
| + GetBitmapNamed(IDR_TEXTAREA_RESIZER);
|
| + gfx::CanvasSkia canvas(bitmap->width(), bitmap->height(), false);
|
| + canvas.getDevice()->accessBitmap(true).eraseARGB(0, 0, 0, 0);
|
| + int x = resize_corner_rect.x() + resize_corner_rect.width() -
|
| + bitmap->width();
|
| + canvas.save();
|
| + if (base::i18n::IsRTL()) {
|
| + canvas.TranslateInt(bitmap->width(), 0);
|
| + canvas.ScaleInt(-1, 1);
|
| + x = 0;
|
| + }
|
| + canvas.DrawBitmapInt(*bitmap, 0, 0);
|
| + canvas.getTopPlatformDevice().drawToHDC(dc, x,
|
| + resize_corner_rect.y() + resize_corner_rect.height() -
|
| + bitmap->height(), NULL);
|
| + canvas.restore();
|
| + }
|
| +}
|
| +
|
| void RenderWidgetHostViewWin::DidUpdateBackingStore(
|
| const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy,
|
| const std::vector<gfx::Rect>& copy_rects) {
|
| @@ -1032,6 +1065,7 @@ void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) {
|
| for (DWORD i = 0; i < region_data->rdh.nCount; ++i) {
|
| gfx::Rect paint_rect = bitmap_rect.Intersect(gfx::Rect(region_rects[i]));
|
| if (!paint_rect.IsEmpty()) {
|
| + DrawResizeCorner(paint_rect, backing_store->hdc());
|
| BitBlt(paint_dc.m_hDC,
|
| paint_rect.x(),
|
| paint_rect.y(),
|
| @@ -1425,6 +1459,21 @@ LRESULT RenderWidgetHostViewWin::OnMouseEvent(UINT message, WPARAM wparam,
|
|
|
| // Don't forward if the container is a popup or fullscreen widget.
|
| if (!is_fullscreen_ && !close_on_deactivate_) {
|
| + if (message == WM_LBUTTONDOWN) {
|
| + // If we get clicked on, where the resize corner is drawn, we delegate the
|
| + // message to the root window, with the proper HTBOTTOMXXX wparam so that
|
| + // Windows can take care of the resizing for us.
|
| + if (render_widget_host_ &&
|
| + render_widget_host_->GetRootWindowResizerRect().
|
| + Contains(GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam))) {
|
| + WPARAM wparam = HTBOTTOMRIGHT;
|
| + if (base::i18n::IsRTL())
|
| + wparam = HTBOTTOMLEFT;
|
| + HWND root_hwnd = ::GetAncestor(m_hWnd, GA_ROOT);
|
| + if (SendMessage(root_hwnd, WM_NCLBUTTONDOWN, wparam, lparam) == 0)
|
| + return 0;
|
| + }
|
| + }
|
| switch (message) {
|
| case WM_LBUTTONDOWN:
|
| case WM_MBUTTONDOWN:
|
|
|