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

Side by Side Diff: views/controls/tabbed_pane/native_tabbed_pane_win.cc

Issue 6462022: It turns out I had the sense of the GetLocalBounds bool wrong everywhere, so ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/controls/tabbed_pane/native_tabbed_pane_win.h" 5 #include "views/controls/tabbed_pane/native_tabbed_pane_win.h"
6 6
7 #include <vssym32.h> 7 #include <vssym32.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 class TabLayout : public LayoutManager { 50 class TabLayout : public LayoutManager {
51 public: 51 public:
52 TabLayout() {} 52 TabLayout() {}
53 53
54 // Switches to the tab page identified by the given index. 54 // Switches to the tab page identified by the given index.
55 void SwitchToPage(View* host, View* page) { 55 void SwitchToPage(View* host, View* page) {
56 for (int i = 0; i < host->GetChildViewCount(); ++i) { 56 for (int i = 0; i < host->GetChildViewCount(); ++i) {
57 View* child = host->GetChildViewAt(i); 57 View* child = host->GetChildViewAt(i);
58 // The child might not have been laid out yet. 58 // The child might not have been laid out yet.
59 if (child == page) 59 if (child == page)
60 child->SetBoundsRect(host->GetLocalBounds()); 60 child->SetBoundsRect(host->GetContentsBounds());
61 child->SetVisible(child == page); 61 child->SetVisible(child == page);
62 } 62 }
63 63
64 FocusManager* focus_manager = page->GetFocusManager(); 64 FocusManager* focus_manager = page->GetFocusManager();
65 DCHECK(focus_manager); 65 DCHECK(focus_manager);
66 View* focused_view = focus_manager->GetFocusedView(); 66 View* focused_view = focus_manager->GetFocusedView();
67 if (focused_view && host->IsParentOf(focused_view) && 67 if (focused_view && host->IsParentOf(focused_view) &&
68 !page->IsParentOf(focused_view)) 68 !page->IsParentOf(focused_view))
69 focus_manager->SetFocusedView(page); 69 focus_manager->SetFocusedView(page);
70 } 70 }
71 71
72 private: 72 private:
73 // LayoutManager overrides: 73 // LayoutManager overrides:
74 virtual void Layout(View* host) { 74 virtual void Layout(View* host) {
75 gfx::Rect bounds(host->GetLocalBounds()); 75 gfx::Rect bounds(host->GetContentsBounds());
76 for (int i = 0; i < host->GetChildViewCount(); ++i) { 76 for (int i = 0; i < host->GetChildViewCount(); ++i) {
77 View* child = host->GetChildViewAt(i); 77 View* child = host->GetChildViewAt(i);
78 // We only layout visible children, since it may be expensive. 78 // We only layout visible children, since it may be expensive.
79 if (child->IsVisible() && child->bounds() != bounds) 79 if (child->IsVisible() && child->bounds() != bounds)
80 child->SetBoundsRect(bounds); 80 child->SetBoundsRect(bounds);
81 } 81 }
82 } 82 }
83 83
84 virtual gfx::Size GetPreferredSize(View* host) { 84 virtual gfx::Size GetPreferredSize(View* host) {
85 // First, query the preferred sizes to determine a good width. 85 // First, query the preferred sizes to determine a good width.
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 //////////////////////////////////////////////////////////////////////////////// 393 ////////////////////////////////////////////////////////////////////////////////
394 // NativeTabbedPaneWrapper, public: 394 // NativeTabbedPaneWrapper, public:
395 395
396 // static 396 // static
397 NativeTabbedPaneWrapper* NativeTabbedPaneWrapper::CreateNativeWrapper( 397 NativeTabbedPaneWrapper* NativeTabbedPaneWrapper::CreateNativeWrapper(
398 TabbedPane* tabbed_pane) { 398 TabbedPane* tabbed_pane) {
399 return new NativeTabbedPaneWin(tabbed_pane); 399 return new NativeTabbedPaneWin(tabbed_pane);
400 } 400 }
401 401
402 } // namespace views 402 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698