| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/cocoa/autofill/simple_grid_layout.h" | 5 #include "chrome/browser/ui/cocoa/autofill/simple_grid_layout.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 void SimpleGridLayout::Layout(NSView* superView) { | 288 void SimpleGridLayout::Layout(NSView* superView) { |
| 289 SizeRowsAndColumns(NSWidth([superView bounds])); | 289 SizeRowsAndColumns(NSWidth([superView bounds])); |
| 290 for (std::vector<ViewState*>::iterator i = view_states_.begin(); | 290 for (std::vector<ViewState*>::iterator i = view_states_.begin(); |
| 291 i != view_states_.end(); ++i) { | 291 i != view_states_.end(); ++i) { |
| 292 ViewState* view_state = *i; | 292 ViewState* view_state = *i; |
| 293 NSView* view = view_state->view(); | 293 NSView* view = view_state->view(); |
| 294 NSRect frame = NSMakeRect(view_state->GetColumn()->Location(), | 294 NSRect frame = NSMakeRect(view_state->GetColumn()->Location(), |
| 295 rows_[view_state->row_index()]->Location(), | 295 rows_[view_state->row_index()]->Location(), |
| 296 view_state->GetColumn()->Size(), | 296 view_state->GetColumn()->Size(), |
| 297 rows_[view_state->row_index()]->Size()); | 297 rows_[view_state->row_index()]->Size()); |
| 298 [view setFrame:frame]; | 298 [view setFrame:NSIntegralRect(frame)]; |
| 299 } | 299 } |
| 300 } | 300 } |
| 301 | 301 |
| 302 void SimpleGridLayout::SizeRowsAndColumns(float width) { | 302 void SimpleGridLayout::SizeRowsAndColumns(float width) { |
| 303 // Size all columns first. | 303 // Size all columns first. |
| 304 for (ScopedVector<ColumnSet>::iterator i = column_sets_.begin(); | 304 for (ScopedVector<ColumnSet>::iterator i = column_sets_.begin(); |
| 305 i != column_sets_.end(); ++i) { | 305 i != column_sets_.end(); ++i) { |
| 306 (*i)->CalculateSize(width); | 306 (*i)->CalculateSize(width); |
| 307 (*i)->ResetColumnXCoordinates(); | 307 (*i)->ResetColumnXCoordinates(); |
| 308 } | 308 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 372 |
| 373 SizeRowsAndColumns(width); | 373 SizeRowsAndColumns(width); |
| 374 return rows_.back()->Location() + rows_.back()->Size(); | 374 return rows_.back()->Location() + rows_.back()->Size(); |
| 375 } | 375 } |
| 376 | 376 |
| 377 void SimpleGridLayout::AddRow(Row* row) { | 377 void SimpleGridLayout::AddRow(Row* row) { |
| 378 next_column_ = 0; | 378 next_column_ = 0; |
| 379 rows_.push_back(row); | 379 rows_.push_back(row); |
| 380 } | 380 } |
| 381 | 381 |
| OLD | NEW |