Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(549)

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_win.cc

Issue 6024008: Consider the popup window position when the window shows upward. This patch depends on WebKit patch. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Use SetBounds(). Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // reduce its resource utilization. 360 // reduce its resource utilization.
361 render_widget_host_->WasHidden(); 361 render_widget_host_->WasHidden();
362 362
363 // TODO(darin): what about constrained windows? it doesn't look like they 363 // TODO(darin): what about constrained windows? it doesn't look like they
364 // see a message when their parent is hidden. maybe there is something more 364 // see a message when their parent is hidden. maybe there is something more
365 // generic we can do at the TabContents API level instead of relying on 365 // generic we can do at the TabContents API level instead of relying on
366 // Windows messages. 366 // Windows messages.
367 } 367 }
368 368
369 void RenderWidgetHostViewWin::SetSize(const gfx::Size& size) { 369 void RenderWidgetHostViewWin::SetSize(const gfx::Size& size) {
370 gfx::Rect rect = GetViewBounds();
371 rect.set_size(size);
372 SetBounds(rect);
373 }
374
375 void RenderWidgetHostViewWin::SetBounds(const gfx::Rect& rect) {
370 if (is_hidden_) 376 if (is_hidden_)
371 return; 377 return;
372 378
373 // No SWP_NOREDRAW as autofill popups can resize and the underneath window 379 // No SWP_NOREDRAW as autofill popups can move and the underneath window
374 // should redraw in that case. 380 // should redraw in that case.
375 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | 381 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS |
376 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; 382 SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE;
377 SetWindowPos(NULL, 0, 0, size.width(), size.height(), swp_flags); 383 gfx::Rect org_rect = GetViewBounds();
384 if (rect.origin() == org_rect.orgin())
Peter Kasting 2011/02/16 22:01:25 Nit: I don't think you need this conditional. SWP
385 swp_flags |= SWP_NOMOVE;
386 SetWindowPos(NULL, point.x(), point.y(), window_rect.Width(),
Peter Kasting 2011/02/16 22:01:25 You need to change both |point| and |window_rect|
387 window_rect.Height(), swp_flags);
378 if (compositor_host_window_) { 388 if (compositor_host_window_) {
379 ::SetWindowPos(compositor_host_window_, 389 ::SetWindowPos(compositor_host_window_,
380 NULL, 390 NULL,
381 0, 0, 391 point.x(), point.y(),
382 size.width(), size.height(), 392 rect.Width(), rect.Height(),
383 SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE); 393 SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE);
384 } 394 }
385 render_widget_host_->WasResized(); 395 render_widget_host_->WasResized();
386 EnsureTooltip(); 396 EnsureTooltip();
387 } 397 }
388 398
389 gfx::NativeView RenderWidgetHostViewWin::GetNativeView() { 399 gfx::NativeView RenderWidgetHostViewWin::GetNativeView() {
390 return m_hWnd; 400 return m_hWnd;
391 } 401 }
392 402
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 } 1820 }
1811 1821
1812 // static 1822 // static
1813 RenderWidgetHostView* 1823 RenderWidgetHostView*
1814 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( 1824 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView(
1815 gfx::NativeView native_view) { 1825 gfx::NativeView native_view) {
1816 return ::IsWindow(native_view) ? 1826 return ::IsWindow(native_view) ?
1817 reinterpret_cast<RenderWidgetHostView*>( 1827 reinterpret_cast<RenderWidgetHostView*>(
1818 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; 1828 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL;
1819 } 1829 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698