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

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: 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 PaintRestoredClientEdge(canvas); 390 PaintRestoredClientEdge(canvas);
391 } 391 }
392 392
393 void OpaqueBrowserFrameView::Layout() { 393 void OpaqueBrowserFrameView::Layout() {
394 LayoutWindowControls(); 394 LayoutWindowControls();
395 LayoutTitleBar(); 395 LayoutTitleBar();
396 LayoutAvatar(); 396 LayoutAvatar();
397 client_view_bounds_ = CalculateClientAreaBounds(width(), height()); 397 client_view_bounds_ = CalculateClientAreaBounds(width(), height());
398 } 398 }
399 399
400 bool OpaqueBrowserFrameView::HitTest(const gfx::Point& l) const { 400 bool OpaqueBrowserFrameView::HitTest(const gfx::Rect& r) const {
401 // If the point is outside the bounds of the client area, claim it. 401 // If the point is outside the bounds of the client area, claim it.
402 bool in_nonclient = NonClientFrameView::HitTest(l); 402 bool in_nonclient = NonClientFrameView::HitTest(r);
403 if (in_nonclient) 403 if (in_nonclient)
404 return in_nonclient; 404 return in_nonclient;
405 405
406 // Otherwise claim it only if it's in a non-tab portion of the tabstrip. 406 // Otherwise claim it only if it's in a non-tab portion of the tabstrip.
407 if (!browser_view()->tabstrip()) 407 if (!browser_view()->tabstrip())
408 return false; 408 return false;
409 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); 409 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds());
410 gfx::Point tabstrip_origin(tabstrip_bounds.origin()); 410 gfx::Point tabstrip_origin(tabstrip_bounds.origin());
411 View::ConvertPointToView(frame()->client_view(), this, &tabstrip_origin); 411 View::ConvertPointToView(frame()->client_view(), this, &tabstrip_origin);
412 tabstrip_bounds.set_origin(tabstrip_origin); 412 tabstrip_bounds.set_origin(tabstrip_origin);
413 if (l.y() > tabstrip_bounds.bottom()) 413 if (r.y() > tabstrip_bounds.bottom())
tdanderson 2012/08/07 16:18:28 Should this instead be r.y() + r.height() ?
sky 2012/08/07 20:11:43 Same comments in this file as the ash file.
tdanderson 2012/08/08 23:47:51 Done.
414 return false; 414 return false;
415 415
416 // We convert from our parent's coordinates since we assume we fill its bounds 416 // We convert from our parent's coordinates since we assume we fill its bounds
417 // completely. We need to do this since we're not a parent of the tabstrip, 417 // completely. We need to do this since we're not a parent of the tabstrip,
418 // meaning ConvertPointToView would otherwise return something bogus. 418 // meaning ConvertPointToView would otherwise return something bogus.
419 gfx::Point browser_view_point(l); 419 gfx::Point browser_view_point(gfx::Point(r.x(), r.y()));
tdanderson 2012/08/08 23:47:51 I am also passing through the center point here fo
tdanderson 2012/08/09 16:16:46 Also added a TODO here as well.
420 View::ConvertPointToView(parent(), browser_view(), &browser_view_point); 420 View::ConvertPointToView(parent(), browser_view(), &browser_view_point);
421 return browser_view()->IsPositionInWindowCaption(browser_view_point); 421 return browser_view()->IsPositionInWindowCaption(browser_view_point);
422 } 422 }
423 423
424 void OpaqueBrowserFrameView::GetAccessibleState( 424 void OpaqueBrowserFrameView::GetAccessibleState(
425 ui::AccessibleViewState* state) { 425 ui::AccessibleViewState* state) {
426 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR; 426 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR;
427 } 427 }
428 428
429 /////////////////////////////////////////////////////////////////////////////// 429 ///////////////////////////////////////////////////////////////////////////////
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 1031
1032 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, 1032 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width,
1033 int height) const { 1033 int height) const {
1034 int top_height = NonClientTopBorderHeight(false); 1034 int top_height = NonClientTopBorderHeight(false);
1035 int border_thickness = NonClientBorderThickness(); 1035 int border_thickness = NonClientBorderThickness();
1036 return gfx::Rect(border_thickness, top_height, 1036 return gfx::Rect(border_thickness, top_height,
1037 std::max(0, width - (2 * border_thickness)), 1037 std::max(0, width - (2 * border_thickness)),
1038 std::max(0, height - GetReservedHeight() - 1038 std::max(0, height - GetReservedHeight() -
1039 top_height - border_thickness)); 1039 top_height - border_thickness));
1040 } 1040 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698