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

Side by Side Diff: chrome/browser/ui/views/frame/opaque_browser_frame_view.cc

Issue 10827198: Change View::HitTest to View::HitTestRect (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed errors reported by trybots Created 8 years, 4 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
OLDNEW
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/frame/opaque_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 PaintRestoredClientEdge(canvas); 394 PaintRestoredClientEdge(canvas);
395 } 395 }
396 396
397 void OpaqueBrowserFrameView::Layout() { 397 void OpaqueBrowserFrameView::Layout() {
398 LayoutWindowControls(); 398 LayoutWindowControls();
399 LayoutTitleBar(); 399 LayoutTitleBar();
400 LayoutAvatar(); 400 LayoutAvatar();
401 client_view_bounds_ = CalculateClientAreaBounds(width(), height()); 401 client_view_bounds_ = CalculateClientAreaBounds(width(), height());
402 } 402 }
403 403
404 bool OpaqueBrowserFrameView::HitTest(const gfx::Point& l) const { 404 bool OpaqueBrowserFrameView::HitTestRect(const gfx::Rect& rect) const {
405 // If the point is outside the bounds of the client area, claim it. 405 // If |rect| does not intersect the bounds of the client area, claim it.
406 bool in_nonclient = NonClientFrameView::HitTest(l); 406 bool in_nonclient = NonClientFrameView::HitTestRect(rect);
407 if (in_nonclient) 407 if (in_nonclient)
408 return in_nonclient; 408 return in_nonclient;
409 409
410 // Otherwise claim it only if it's in a non-tab portion of the tabstrip. 410 // Otherwise claim it only if it's in a non-tab portion of the tabstrip.
411 if (!browser_view()->tabstrip()) 411 if (!browser_view()->tabstrip())
412 return false; 412 return false;
413 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); 413 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds());
414 gfx::Point tabstrip_origin(tabstrip_bounds.origin()); 414 gfx::Point tabstrip_origin(tabstrip_bounds.origin());
415 View::ConvertPointToView(frame()->client_view(), this, &tabstrip_origin); 415 View::ConvertPointToView(frame()->client_view(), this, &tabstrip_origin);
416 tabstrip_bounds.set_origin(tabstrip_origin); 416 tabstrip_bounds.set_origin(tabstrip_origin);
417 if (l.y() > tabstrip_bounds.bottom()) 417 if (rect.bottom() > tabstrip_bounds.bottom())
418 return false; 418 return false;
419 419
420 // We convert from our parent's coordinates since we assume we fill its bounds 420 // We convert from our parent's coordinates since we assume we fill its bounds
421 // completely. We need to do this since we're not a parent of the tabstrip, 421 // completely. We need to do this since we're not a parent of the tabstrip,
422 // meaning ConvertPointToView would otherwise return something bogus. 422 // meaning ConvertPointToView would otherwise return something bogus.
423 gfx::Point browser_view_point(l); 423 // TODO(tdanderson): Initialize |browser_view_point| using |rect| instead of
424 // its center point once GetEventHandlerForRect() is implemented.
425 gfx::Point browser_view_point(rect.CenterPoint());
424 View::ConvertPointToView(parent(), browser_view(), &browser_view_point); 426 View::ConvertPointToView(parent(), browser_view(), &browser_view_point);
425 return browser_view()->IsPositionInWindowCaption(browser_view_point); 427 return browser_view()->IsPositionInWindowCaption(browser_view_point);
426 } 428 }
427 429
428 void OpaqueBrowserFrameView::GetAccessibleState( 430 void OpaqueBrowserFrameView::GetAccessibleState(
429 ui::AccessibleViewState* state) { 431 ui::AccessibleViewState* state) {
430 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR; 432 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR;
431 } 433 }
432 434
433 /////////////////////////////////////////////////////////////////////////////// 435 ///////////////////////////////////////////////////////////////////////////////
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 1038
1037 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, 1039 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width,
1038 int height) const { 1040 int height) const {
1039 int top_height = NonClientTopBorderHeight(false); 1041 int top_height = NonClientTopBorderHeight(false);
1040 int border_thickness = NonClientBorderThickness(); 1042 int border_thickness = NonClientBorderThickness();
1041 return gfx::Rect(border_thickness, top_height, 1043 return gfx::Rect(border_thickness, top_height,
1042 std::max(0, width - (2 * border_thickness)), 1044 std::max(0, width - (2 * border_thickness)),
1043 std::max(0, height - GetReservedHeight() - 1045 std::max(0, height - GetReservedHeight() -
1044 top_height - border_thickness)); 1046 top_height - border_thickness));
1045 } 1047 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/opaque_browser_frame_view.h ('k') | chrome/browser/ui/views/fullscreen_exit_bubble_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698