OLD | NEW |
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 <cmath> | 5 #include <cmath> |
6 | 6 |
7 #include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h" | 7 #include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h" |
8 | 8 |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 gfx::Rect AutocompletePopupViewMac::GetTargetBounds() { | 511 gfx::Rect AutocompletePopupViewMac::GetTargetBounds() { |
512 // Flip the coordinate system before returning. | 512 // Flip the coordinate system before returning. |
513 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 513 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
514 NSRect monitorFrame = [screen frame]; | 514 NSRect monitorFrame = [screen frame]; |
515 gfx::Rect bounds(NSRectToCGRect(targetPopupFrame_)); | 515 gfx::Rect bounds(NSRectToCGRect(targetPopupFrame_)); |
516 bounds.set_y(monitorFrame.size.height - bounds.y() - bounds.height()); | 516 bounds.set_y(monitorFrame.size.height - bounds.y() - bounds.height()); |
517 return bounds; | 517 return bounds; |
518 } | 518 } |
519 | 519 |
520 void AutocompletePopupViewMac::SetSelectedLine(size_t line) { | 520 void AutocompletePopupViewMac::SetSelectedLine(size_t line) { |
521 model_->SetSelectedLine(line, false); | 521 model_->SetSelectedLine(line, false, false); |
522 } | 522 } |
523 | 523 |
524 // This is only called by model in SetSelectedLine() after updating | 524 // This is only called by model in SetSelectedLine() after updating |
525 // everything. Popup should already be visible. | 525 // everything. Popup should already be visible. |
526 void AutocompletePopupViewMac::PaintUpdatesNow() { | 526 void AutocompletePopupViewMac::PaintUpdatesNow() { |
527 AutocompleteMatrix* matrix = GetAutocompleteMatrix(); | 527 AutocompleteMatrix* matrix = GetAutocompleteMatrix(); |
528 [matrix selectCellAtRow:model_->selected_line() column:0]; | 528 [matrix selectCellAtRow:model_->selected_line() column:0]; |
529 } | 529 } |
530 | 530 |
531 AutocompletePopupModel* AutocompletePopupViewMac::GetModel() { | 531 AutocompletePopupModel* AutocompletePopupViewMac::GetModel() { |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 bottomRightCornerRadius:kPopupRoundingRadius]; | 826 bottomRightCornerRadius:kPopupRoundingRadius]; |
827 | 827 |
828 // Draw the matrix clipped to our border. | 828 // Draw the matrix clipped to our border. |
829 [NSGraphicsContext saveGraphicsState]; | 829 [NSGraphicsContext saveGraphicsState]; |
830 [path addClip]; | 830 [path addClip]; |
831 [super drawRect:rect]; | 831 [super drawRect:rect]; |
832 [NSGraphicsContext restoreGraphicsState]; | 832 [NSGraphicsContext restoreGraphicsState]; |
833 } | 833 } |
834 | 834 |
835 @end | 835 @end |
OLD | NEW |