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

Side by Side Diff: chrome/browser/ui/views/toolbar_view.cc

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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/toolbar_view.h" 5 #include "chrome/browser/ui/views/toolbar_view.h"
6 6
7 #include "base/i18n/number_formatting.h" 7 #include "base/i18n/number_formatting.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/command_updater.h" 10 #include "chrome/browser/command_updater.h"
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 location_bar_container_->SetInToolbar(false); 425 location_bar_container_->SetInToolbar(false);
426 location_container_bounds.set_height( 426 location_container_bounds.set_height(
427 location_bar_container_->GetPreferredSize().height()); 427 location_bar_container_->GetPreferredSize().height());
428 428
429 // If bounds of |location_bar_container_| is not contained within its 429 // If bounds of |location_bar_container_| is not contained within its
430 // parent's, adjust the former's to within the latter's. This will clip its 430 // parent's, adjust the former's to within the latter's. This will clip its
431 // child |location_bar_view_| within its bounds without resizing it. 431 // child |location_bar_view_| within its bounds without resizing it.
432 // Note that parent of |location_bar_container_| i.e. BrowserView can't clip 432 // Note that parent of |location_bar_container_| i.e. BrowserView can't clip
433 // its children, else it loses the 3D shadows. 433 // its children, else it loses the 3D shadows.
434 gfx::Rect parent_rect = location_bar_container_->parent()->GetLocalBounds(); 434 gfx::Rect parent_rect = location_bar_container_->parent()->GetLocalBounds();
435 gfx::Rect intersect_rect = parent_rect.Intersect(location_container_bounds); 435 gfx::Rect intersect_rect = parent_rect;
436 intersect_rect.Intersect(location_container_bounds);
436 // If the two bounds don't intersect, set bounds of |location_bar_container_| 437 // If the two bounds don't intersect, set bounds of |location_bar_container_|
437 // to 0. 438 // to 0.
438 location_bar_container_->SetBoundsRect(intersect_rect); 439 location_bar_container_->SetBoundsRect(intersect_rect);
439 #endif 440 #endif
440 } 441 }
441 442
442 //////////////////////////////////////////////////////////////////////////////// 443 ////////////////////////////////////////////////////////////////////////////////
443 // ToolbarView, AccessiblePaneView overrides: 444 // ToolbarView, AccessiblePaneView overrides:
444 445
445 bool ToolbarView::SetPaneFocus(views::View* initial_focus) { 446 bool ToolbarView::SetPaneFocus(views::View* initial_focus) {
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 // LocationBarContainer is not a child of the ToolbarView. 1029 // LocationBarContainer is not a child of the ToolbarView.
1029 gfx::Point origin(bounds.origin()); 1030 gfx::Point origin(bounds.origin());
1030 views::View::ConvertPointToTarget(this, location_bar_container_->parent(), 1031 views::View::ConvertPointToTarget(this, location_bar_container_->parent(),
1031 &origin); 1032 &origin);
1032 gfx::Rect target_bounds(origin, bounds.size()); 1033 gfx::Rect target_bounds(origin, bounds.size());
1033 if (location_bar_container_->GetTargetBounds() != target_bounds) { 1034 if (location_bar_container_->GetTargetBounds() != target_bounds) {
1034 location_bar_container_->SetInToolbar(true); 1035 location_bar_container_->SetInToolbar(true);
1035 location_bar_container_->SetBoundsRect(target_bounds); 1036 location_bar_container_->SetBoundsRect(target_bounds);
1036 } 1037 }
1037 } 1038 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698