OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/panels/panel_frame_view.h" | 5 #include "chrome/browser/ui/views/panels/panel_frame_view.h" |
6 | 6 |
7 #include "chrome/browser/ui/panels/panel.h" | 7 #include "chrome/browser/ui/panels/panel.h" |
8 #include "chrome/browser/ui/panels/panel_constants.h" | 8 #include "chrome/browser/ui/panels/panel_constants.h" |
9 #include "chrome/browser/ui/views/panels/panel_view.h" | 9 #include "chrome/browser/ui/views/panels/panel_view.h" |
10 #include "chrome/browser/ui/views/tab_icon_view.h" | 10 #include "chrome/browser/ui/views/tab_icon_view.h" |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
348 | 348 |
349 #if defined(OS_WIN) | 349 #if defined(OS_WIN) |
350 // Changing the window region is going to force a paint. Only change the | 350 // Changing the window region is going to force a paint. Only change the |
351 // window region if the region really differs. | 351 // window region if the region really differs. |
352 HWND native_window = views::HWNDForWidget(panel_view_->window()); | 352 HWND native_window = views::HWNDForWidget(panel_view_->window()); |
353 base::win::ScopedRegion current_region(::CreateRectRgn(0, 0, 0, 0)); | 353 base::win::ScopedRegion current_region(::CreateRectRgn(0, 0, 0, 0)); |
354 int current_region_result = ::GetWindowRgn(native_window, current_region); | 354 int current_region_result = ::GetWindowRgn(native_window, current_region); |
355 | 355 |
356 gfx::Path window_mask; | 356 gfx::Path window_mask; |
357 GetWindowMask(size(), &window_mask); | 357 GetWindowMask(size(), &window_mask); |
358 base::win::ScopedRegion new_region(gfx::CreateHRGNFromSkPath(window_mask)); | 358 base::win::ScopedRegion new_region( |
359 !window_mask.isEmpty() ? | |
360 gfx::CreateHRGNFromSkPath(window_mask) : | |
361 NULL); | |
Wez
2014/10/27 20:28:39
base::win::ScopedRegion new_region;
if (!window_ma
alex-ac
2014/10/28 10:38:35
Done.
| |
359 | 362 |
360 if (current_region_result == ERROR || | 363 if (current_region_result == ERROR || |
361 !::EqualRgn(current_region, new_region)) { | 364 !::EqualRgn(current_region, new_region)) { |
Wez
2014/10/27 20:28:39
Does EqualRgn actually return true for (NULL, NULL
alex-ac
2014/10/28 10:38:35
EqualRgn will return ERROR if one of handles is in
| |
362 // SetWindowRgn takes ownership of the new_region. | 365 // SetWindowRgn takes ownership of the new_region. |
363 ::SetWindowRgn(native_window, new_region.release(), TRUE); | 366 ::SetWindowRgn(native_window, new_region.release(), TRUE); |
364 } | 367 } |
365 #endif | 368 #endif |
366 } | 369 } |
367 | 370 |
368 gfx::Rect PanelFrameView::GetBoundsForClientView() const { | 371 gfx::Rect PanelFrameView::GetBoundsForClientView() const { |
369 // The origin of client-area bounds starts after left border and titlebar and | 372 // The origin of client-area bounds starts after left border and titlebar and |
370 // spans until hitting the right and bottom borders. | 373 // spans until hitting the right and bottom borders. |
371 // +------------------------------+ | 374 // +------------------------------+ |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
770 #endif | 773 #endif |
771 } | 774 } |
772 | 775 |
773 bool PanelFrameView::IsWithinResizingArea( | 776 bool PanelFrameView::IsWithinResizingArea( |
774 const gfx::Point& mouse_location) const { | 777 const gfx::Point& mouse_location) const { |
775 panel::Resizability resizability = panel_view_->panel()->CanResizeByMouse(); | 778 panel::Resizability resizability = panel_view_->panel()->CanResizeByMouse(); |
776 int edge_hittest = GetFrameEdgeHitTest( | 779 int edge_hittest = GetFrameEdgeHitTest( |
777 mouse_location, size(), PanelView::kResizeInsideBoundsSize, resizability); | 780 mouse_location, size(), PanelView::kResizeInsideBoundsSize, resizability); |
778 return edge_hittest != HTNOWHERE; | 781 return edge_hittest != HTNOWHERE; |
779 } | 782 } |
OLD | NEW |