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

Unified Diff: ui/views/bubble/bubble_frame_view.cc

Issue 15894025: Fix Views new dialog style hit-testing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add Aura context, simplify and make test more flexible. Created 7 years, 7 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
« no previous file with comments | « no previous file | ui/views/bubble/bubble_frame_view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/bubble/bubble_frame_view.cc
diff --git a/ui/views/bubble/bubble_frame_view.cc b/ui/views/bubble/bubble_frame_view.cc
index 050a408f5900179b6b0629519926696f2c530067..4d95d18c04c6a1c1de4779a219a14013eecc4d6c 100644
--- a/ui/views/bubble/bubble_frame_view.cc
+++ b/ui/views/bubble/bubble_frame_view.cc
@@ -94,14 +94,24 @@ int BubbleFrameView::NonClientHitTest(const gfx::Point& point) {
return HTNOWHERE;
if (close_->visible() && close_->GetMirroredBounds().Contains(point))
return HTCLOSE;
- if (!GetWidget()->widget_delegate()->CanResize())
- return GetWidget()->client_view()->NonClientHitTest(point);
-
- const int size = bubble_border_->GetBorderThickness() + 4;
- const int hit = GetHTComponentForFrame(point, size, size, size, size, true);
- if (hit == HTNOWHERE && point.y() < title_->bounds().bottom())
- return HTCAPTION;
- return hit;
+
+ // Allow dialogs to be resized, dragged, and to show the system menu.
+ if (GetWidget()->widget_delegate()->AsDialogDelegate()) {
+ const int size = bubble_border_->GetBorderThickness() + 4;
+ int sizes = GetHTComponentForFrame(point, size, size, size, size, true);
+ if (GetWidget()->widget_delegate()->CanResize() && sizes != HTNOWHERE)
+ return sizes;
+ gfx::Rect sys_rect(0, 0, title_->x(), title_->y());
+ sys_rect.set_origin(gfx::Point(GetMirroredXForRect(sys_rect), 0));
+ if (sys_rect.Contains(point))
+ return HTSYSMENU;
+ const int move = std::max(title_->bounds().bottom(), size + 4);
+ int moves = GetHTComponentForFrame(point, move, move, move, move, true);
+ if (moves != HTNOWHERE)
+ return HTCAPTION;
+ }
+
+ return GetWidget()->client_view()->NonClientHitTest(point);
}
void BubbleFrameView::GetWindowMask(const gfx::Size& size,
« no previous file with comments | « no previous file | ui/views/bubble/bubble_frame_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698