| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/wm/header_painter.h" | 5 #include "ash/wm/header_painter.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/wm/caption_buttons/frame_caption_button_container_view.h" | 9 #include "ash/wm/caption_buttons/frame_caption_button_container_view.h" |
| 10 #include "base/logging.h" // DCHECK | 10 #include "base/logging.h" // DCHECK |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 client_bounds.Inset(0, header_height, 0, 0); | 178 client_bounds.Inset(0, header_height, 0, 0); |
| 179 return client_bounds; | 179 return client_bounds; |
| 180 } | 180 } |
| 181 | 181 |
| 182 // static | 182 // static |
| 183 gfx::Rect HeaderPainter::GetWindowBoundsForClientBounds( | 183 gfx::Rect HeaderPainter::GetWindowBoundsForClientBounds( |
| 184 int header_height, | 184 int header_height, |
| 185 const gfx::Rect& client_bounds) { | 185 const gfx::Rect& client_bounds) { |
| 186 gfx::Rect window_bounds(client_bounds); | 186 gfx::Rect window_bounds(client_bounds); |
| 187 window_bounds.Inset(0, -header_height, 0, 0); | 187 window_bounds.Inset(0, -header_height, 0, 0); |
| 188 if (window_bounds.y() < 0) | |
| 189 window_bounds.set_y(0); | |
| 190 return window_bounds; | 188 return window_bounds; |
| 191 } | 189 } |
| 192 | 190 |
| 193 int HeaderPainter::NonClientHitTest(const gfx::Point& point) const { | 191 int HeaderPainter::NonClientHitTest(const gfx::Point& point) const { |
| 194 gfx::Point point_in_header_view(point); | 192 gfx::Point point_in_header_view(point); |
| 195 views::View::ConvertPointFromWidget(header_view_, &point_in_header_view); | 193 views::View::ConvertPointFromWidget(header_view_, &point_in_header_view); |
| 196 if (!GetHeaderLocalBounds().Contains(point_in_header_view)) | 194 if (!GetHeaderLocalBounds().Contains(point_in_header_view)) |
| 197 return HTNOWHERE; | 195 return HTNOWHERE; |
| 198 if (caption_button_container_->visible()) { | 196 if (caption_button_container_->visible()) { |
| 199 gfx::Point point_in_caption_button_container(point); | 197 gfx::Point point_in_caption_button_container(point); |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 int title_y = | 616 int title_y = |
| 619 GetCaptionButtonContainerCenterY() - title_font_list.GetHeight() / 2; | 617 GetCaptionButtonContainerCenterY() - title_font_list.GetHeight() / 2; |
| 620 return gfx::Rect( | 618 return gfx::Rect( |
| 621 title_x, | 619 title_x, |
| 622 std::max(0, title_y), | 620 std::max(0, title_y), |
| 623 std::max(0, caption_button_container_->x() - kTitleLogoSpacing - title_x), | 621 std::max(0, caption_button_container_->x() - kTitleLogoSpacing - title_x), |
| 624 title_font_list.GetHeight()); | 622 title_font_list.GetHeight()); |
| 625 } | 623 } |
| 626 | 624 |
| 627 } // namespace ash | 625 } // namespace ash |
| OLD | NEW |