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

Side by Side Diff: chrome/browser/views/frame/browser_view.cc

Issue 3137019: Fix numerous alignment problems, both horizontal and vertical, in drawing the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/views/frame/browser_view.h" 5 #include "chrome/browser/views/frame/browser_view.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 SkRect rect; 260 SkRect rect;
261 double roundness = 0; 261 double roundness = 0;
262 DetachableToolbarView::CalculateContentArea(current_state, h_padding, 262 DetachableToolbarView::CalculateContentArea(current_state, h_padding,
263 v_padding, &rect, &roundness, host_view_); 263 v_padding, &rect, &roundness, host_view_);
264 DetachableToolbarView::PaintContentAreaBackground(canvas, tp, rect, 264 DetachableToolbarView::PaintContentAreaBackground(canvas, tp, rect,
265 roundness); 265 roundness);
266 DetachableToolbarView::PaintContentAreaBorder(canvas, tp, rect, roundness); 266 DetachableToolbarView::PaintContentAreaBorder(canvas, tp, rect, roundness);
267 if (!toolbar_overlap) 267 if (!toolbar_overlap)
268 DetachableToolbarView::PaintHorizontalBorder(canvas, host_view_); 268 DetachableToolbarView::PaintHorizontalBorder(canvas, host_view_);
269 } else { 269 } else {
270 DetachableToolbarView::PaintBackgroundAttachedMode(canvas, host_view_); 270 DetachableToolbarView::PaintBackgroundAttachedMode(canvas, host_view_,
271 browser_view_->OffsetPointForToolbarBackgroundImage(
272 gfx::Point(host_view_->MirroredX(), host_view_->y())));
271 if (host_view_->height() >= toolbar_overlap) 273 if (host_view_->height() >= toolbar_overlap)
272 DetachableToolbarView::PaintHorizontalBorder(canvas, host_view_); 274 DetachableToolbarView::PaintHorizontalBorder(canvas, host_view_);
273 } 275 }
274 } 276 }
275 277
276 /////////////////////////////////////////////////////////////////////////////// 278 ///////////////////////////////////////////////////////////////////////////////
277 // ResizeCorner, private: 279 // ResizeCorner, private:
278 280
279 class ResizeCorner : public views::View { 281 class ResizeCorner : public views::View {
280 public: 282 public:
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 toolbar_->location_bar()->location_entry()->ClosePopup(); 578 toolbar_->location_bar()->location_entry()->ClosePopup();
577 } 579 }
578 580
579 void BrowserView::WindowMoveOrResizeStarted() { 581 void BrowserView::WindowMoveOrResizeStarted() {
580 TabContents* tab_contents = GetSelectedTabContents(); 582 TabContents* tab_contents = GetSelectedTabContents();
581 if (tab_contents) 583 if (tab_contents)
582 tab_contents->WindowMoveOrResizeStarted(); 584 tab_contents->WindowMoveOrResizeStarted();
583 } 585 }
584 586
585 gfx::Rect BrowserView::GetToolbarBounds() const { 587 gfx::Rect BrowserView::GetToolbarBounds() const {
586 return toolbar_->bounds(); 588 gfx::Rect toolbar_bounds(toolbar_->bounds());
589 if (toolbar_bounds.IsEmpty())
590 return toolbar_bounds;
591 // When using vertical tabs, the toolbar appears to extend behind the tab
592 // column.
593 if (UseVerticalTabs())
594 toolbar_bounds.Inset(tabstrip_->x() - toolbar_bounds.x(), 0, 0, 0);
595 // The apparent toolbar edges are outside the "real" toolbar edges.
596 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0);
597 return toolbar_bounds;
587 } 598 }
588 599
589 gfx::Rect BrowserView::GetClientAreaBounds() const { 600 gfx::Rect BrowserView::GetClientAreaBounds() const {
590 gfx::Rect container_bounds = contents_->bounds(); 601 gfx::Rect container_bounds = contents_->bounds();
591 gfx::Point container_origin = container_bounds.origin(); 602 gfx::Point container_origin = container_bounds.origin();
592 ConvertPointToView(this, GetParent(), &container_origin); 603 ConvertPointToView(this, GetParent(), &container_origin);
593 container_bounds.set_origin(container_origin); 604 container_bounds.set_origin(container_origin);
594 return container_bounds; 605 return container_bounds;
595 } 606 }
596 607
597 bool BrowserView::ShouldFindBarBlendWithBookmarksBar() const { 608 bool BrowserView::ShouldFindBarBlendWithBookmarksBar() const {
598 if (bookmark_bar_view_.get()) 609 if (bookmark_bar_view_.get())
599 return bookmark_bar_view_->IsAlwaysShown(); 610 return bookmark_bar_view_->IsAlwaysShown();
600 return false; 611 return false;
601 } 612 }
602 613
603 gfx::Rect BrowserView::GetFindBarBoundingBox() const { 614 gfx::Rect BrowserView::GetFindBarBoundingBox() const {
604 return GetBrowserViewLayout()->GetFindBarBoundingBox(); 615 return GetBrowserViewLayout()->GetFindBarBoundingBox();
605 } 616 }
606 617
607 int BrowserView::GetTabStripHeight() const { 618 int BrowserView::GetTabStripHeight() const {
608 // We want to return tabstrip_->height(), but we might be called in the midst 619 // We want to return tabstrip_->height(), but we might be called in the midst
609 // of layout, when that hasn't yet been updated to reflect the current state. 620 // of layout, when that hasn't yet been updated to reflect the current state.
610 // So return what the tabstrip height _ought_ to be right now. 621 // So return what the tabstrip height _ought_ to be right now.
611 return IsTabStripVisible() ? tabstrip_->GetPreferredSize().height() : 0; 622 return IsTabStripVisible() ? tabstrip_->GetPreferredSize().height() : 0;
612 } 623 }
613 624
614 gfx::Rect BrowserView::GetTabStripBounds() const { 625 gfx::Point BrowserView::OffsetPointForToolbarBackgroundImage(
615 return frame_->GetBoundsForTabStrip(tabstrip_); 626 const gfx::Point& point) const {
627 // The background image starts tiling horizontally at the window left edge and
628 // vertically at the top edge of the horizontal tab strip (or where it would
629 // be). We expect our parent's origin to be the window origin.
630 gfx::Point window_point(point.Add(gfx::Point(MirroredX(), y())));
631 window_point.Offset(0, -frame_->GetHorizontalTabStripVerticalOffset(false));
632 return window_point;
616 } 633 }
617 634
618 bool BrowserView::IsTabStripVisible() const { 635 bool BrowserView::IsTabStripVisible() const {
619 return browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP); 636 return browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP);
620 } 637 }
621 638
622 bool BrowserView::UseVerticalTabs() const { 639 bool BrowserView::UseVerticalTabs() const {
623 return browser_->tabstrip_model()->delegate()->UseVerticalTabs(); 640 return browser_->tabstrip_model()->delegate()->UseVerticalTabs();
624 } 641 }
625 642
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 void BrowserView::Layout() { 1755 void BrowserView::Layout() {
1739 if (ignore_layout_) 1756 if (ignore_layout_)
1740 return; 1757 return;
1741 if (GetLayoutManager()) { 1758 if (GetLayoutManager()) {
1742 GetLayoutManager()->Layout(this); 1759 GetLayoutManager()->Layout(this);
1743 SchedulePaint(); 1760 SchedulePaint();
1744 #if defined(OS_WIN) 1761 #if defined(OS_WIN)
1745 // Send the margins of the "user-perceived content area" of this 1762 // Send the margins of the "user-perceived content area" of this
1746 // browser window so AeroPeekManager can render a background-tab image in 1763 // browser window so AeroPeekManager can render a background-tab image in
1747 // the area. 1764 // the area.
1765 // TODO(pkasting) correct content inset??
1748 if (aeropeek_manager_.get()) { 1766 if (aeropeek_manager_.get()) {
1749 gfx::Insets insets(GetFindBarBoundingBox().y() + 1, 1767 gfx::Insets insets(GetFindBarBoundingBox().y() + 1,
1750 GetTabStripBounds().x(), 1768 0,
1751 GetTabStripBounds().x(), 1769 0,
1752 GetTabStripBounds().x()); 1770 0);
1753 aeropeek_manager_->SetContentInsets(insets); 1771 aeropeek_manager_->SetContentInsets(insets);
1754 } 1772 }
1755 #endif 1773 #endif
1756 } 1774 }
1757 } 1775 }
1758 1776
1759 void BrowserView::ViewHierarchyChanged(bool is_add, 1777 void BrowserView::ViewHierarchyChanged(bool is_add,
1760 views::View* parent, 1778 views::View* parent,
1761 views::View* child) { 1779 views::View* child) {
1762 if (is_add && child == this && GetWidget() && !initialized_) { 1780 if (is_add && child == this && GetWidget() && !initialized_) {
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
2376 SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME)); 2394 SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME));
2377 2395
2378 return view; 2396 return view;
2379 } 2397 }
2380 #endif 2398 #endif
2381 2399
2382 // static 2400 // static
2383 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { 2401 FindBar* BrowserWindow::CreateFindBar(Browser* browser) {
2384 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); 2402 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window()));
2385 } 2403 }
OLDNEW
« no previous file with comments | « chrome/browser/views/frame/browser_view.h ('k') | chrome/browser/views/frame/browser_view_layout.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698