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

Side by Side Diff: views/controls/menu/menu_scroll_view_container.cc

Issue 8405002: ui/gfx: Convert Canvas::FillRectInt() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: save some vertical space, interactive_ui_tests are fixed by Peter's fix Created 9 years, 1 month 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
« no previous file with comments | « views/border.cc ('k') | views/controls/menu/submenu_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/menu/menu_scroll_view_container.h" 5 #include "views/controls/menu/menu_scroll_view_container.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <uxtheme.h> 9 #include <uxtheme.h>
10 #include <Vssym32.h> 10 #include <Vssym32.h>
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 // Then the arrow. 93 // Then the arrow.
94 int x = width() / 2; 94 int x = width() / 2;
95 int y = (height() - config.scroll_arrow_height) / 2; 95 int y = (height() - config.scroll_arrow_height) / 2;
96 int delta_y = 1; 96 int delta_y = 1;
97 if (!is_up_) { 97 if (!is_up_) {
98 delta_y = -1; 98 delta_y = -1;
99 y += config.scroll_arrow_height; 99 y += config.scroll_arrow_height;
100 } 100 }
101 for (int i = 0; i < config.scroll_arrow_height; ++i, --x, y += delta_y) 101 for (int i = 0; i < config.scroll_arrow_height; ++i, --x, y += delta_y)
102 canvas->FillRectInt(arrow_color, x, y, (i * 2) + 1, 1); 102 canvas->FillRect(arrow_color, gfx::Rect(x, y, (i * 2) + 1, 1));
103 } 103 }
104 104
105 private: 105 private:
106 // SubmenuView we were created for. 106 // SubmenuView we were created for.
107 SubmenuView* host_; 107 SubmenuView* host_;
108 108
109 // Direction of the button. 109 // Direction of the button.
110 bool is_up_; 110 bool is_up_;
111 111
112 // Preferred height. 112 // Preferred height.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 void MenuScrollViewContainer::OnBoundsChanged( 239 void MenuScrollViewContainer::OnBoundsChanged(
240 const gfx::Rect& previous_bounds) { 240 const gfx::Rect& previous_bounds) {
241 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); 241 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize();
242 scroll_up_button_->SetVisible(content_pref.height() > height()); 242 scroll_up_button_->SetVisible(content_pref.height() > height());
243 scroll_down_button_->SetVisible(content_pref.height() > height()); 243 scroll_down_button_->SetVisible(content_pref.height() > height());
244 Layout(); 244 Layout();
245 } 245 }
246 246
247 } // namespace views 247 } // namespace views
OLDNEW
« no previous file with comments | « views/border.cc ('k') | views/controls/menu/submenu_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698