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

Unified Diff: ui/views/widget/desktop_aura/desktop_root_window_host_win.cc

Issue 123793002: Fix omnibox height when less than 64 pixels tall. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
index 0a8596d836d1e97a22391e7966aa3e593359284e..ade4d7fdb229409bb35b112a442a19727fb97789 100644
--- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
+++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
@@ -240,11 +240,14 @@ void DesktopWindowTreeHostWin::StackAtTop() {
}
void DesktopWindowTreeHostWin::CenterWindow(const gfx::Size& size) {
+ gfx::Size size_in_pixels = gfx::win::DIPToScreenSize(size);
gfx::Size expanded_size;
- expanded_size = GetExpandedWindowSize(
- message_handler_->window_ex_style(), size);
- gfx::Size size_in_pixels = gfx::win::DIPToScreenSize(expanded_size);
- message_handler_->CenterWindow(size_in_pixels);
+ expanded_size = GetExpandedWindowSize(message_handler_->window_ex_style(),
+ size_in_pixels);
+ window_enlargement_ =
+ gfx::Vector2d(expanded_size.width() - size_in_pixels.width(),
+ expanded_size.height() - size_in_pixels.height());
+ message_handler_->CenterWindow(expanded_size);
}
void DesktopWindowTreeHostWin::GetWindowPlacement(
@@ -453,13 +456,7 @@ void DesktopWindowTreeHostWin::ToggleFullScreen() {
// methods work in DIP.
gfx::Rect DesktopWindowTreeHostWin::GetBounds() const {
- // Match the logic in HWNDMessageHandler::ClientAreaSizeChanged().
- if (IsMinimized())
- return gfx::Rect();
- gfx::Rect bounds(WidgetSizeIsClientSize() ?
- message_handler_->GetClientAreaBoundsInScreen() :
- message_handler_->GetWindowBoundsInScreen());
-
+ gfx::Rect bounds(message_handler_->GetClientAreaBounds());
// If the window bounds were expanded we need to return the original bounds
// To achieve this we do the reverse of the expansion, i.e. add the
// window_expansion_top_left_delta_ to the origin and subtract the
@@ -478,6 +475,9 @@ void DesktopWindowTreeHostWin::SetBounds(const gfx::Rect& bounds) {
// If the window bounds have to be expanded we need to subtract the
// window_expansion_top_left_delta_ from the origin and add the
// window_expansion_bottom_right_delta_ to the width and height
+ gfx::Size old_hwnd_size(message_handler_->GetClientAreaBounds().size());
+ gfx::Size old_content_size = GetBounds().size();
+
gfx::Rect expanded(
bounds.x() - window_expansion_top_left_delta_.x(),
bounds.y() - window_expansion_top_left_delta_.y(),
@@ -492,6 +492,11 @@ void DesktopWindowTreeHostWin::SetBounds(const gfx::Rect& bounds) {
gfx::Vector2d(new_expanded.width() - expanded.width(),
new_expanded.height() - expanded.height());
message_handler_->SetBounds(new_expanded);
+
+ // If actual window size didn't change but the bounds did, then inform the
Ben Goodger (Google) 2014/01/09 23:00:07 Your comment just states what the code does. You
+ // consumer that the size changed.
+ if (old_hwnd_size == new_expanded.size() && old_content_size != bounds.size())
+ HandleClientSizeChanged(new_expanded.size());
}
gfx::Insets DesktopWindowTreeHostWin::GetInsets() const {

Powered by Google App Engine
This is Rietveld 408576698