| OLD | NEW |
| 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 "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" | 5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 targetPopupFrame_ = NSZeroRect; | 446 targetPopupFrame_ = NSZeroRect; |
| 447 | 447 |
| 448 return; | 448 return; |
| 449 } | 449 } |
| 450 | 450 |
| 451 CreatePopupIfNeeded(); | 451 CreatePopupIfNeeded(); |
| 452 | 452 |
| 453 // The popup's font is a slightly smaller version of the field's. | 453 // The popup's font is a slightly smaller version of the field's. |
| 454 NSFont* fieldFont = OmniboxViewMac::GetFieldFont(); | 454 NSFont* fieldFont = OmniboxViewMac::GetFieldFont(); |
| 455 const CGFloat resultFontSize = [fieldFont pointSize] + kEditFontAdjust; | 455 const CGFloat resultFontSize = [fieldFont pointSize] + kEditFontAdjust; |
| 456 gfx::Font resultFont(base::SysNSStringToUTF16([fieldFont fontName]), | 456 gfx::Font resultFont(base::SysNSStringToUTF8([fieldFont fontName]), |
| 457 static_cast<int>(resultFontSize)); | 457 static_cast<int>(resultFontSize)); |
| 458 | 458 |
| 459 AutocompleteMatrix* matrix = GetAutocompleteMatrix(); | 459 AutocompleteMatrix* matrix = GetAutocompleteMatrix(); |
| 460 | 460 |
| 461 // Calculate the width of the matrix based on backing out the | 461 // Calculate the width of the matrix based on backing out the |
| 462 // popup's border from the width of the field. Would prefer to use | 462 // popup's border from the width of the field. Would prefer to use |
| 463 // [matrix convertSize:fromView:] for converting from screen size, | 463 // [matrix convertSize:fromView:] for converting from screen size, |
| 464 // but that doesn't work until the popup is on-screen (bug?). | 464 // but that doesn't work until the popup is on-screen (bug?). |
| 465 const NSRect fieldRectBase = [field_ convertRect:[field_ bounds] toView:nil]; | 465 const NSRect fieldRectBase = [field_ convertRect:[field_ bounds] toView:nil]; |
| 466 const CGFloat popupWidth = NSWidth(fieldRectBase) - 2 * kWindowBorderWidth; | 466 const CGFloat popupWidth = NSWidth(fieldRectBase) - 2 * kWindowBorderWidth; |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 bottomLeftCornerRadius:kPopupRoundingRadius | 824 bottomLeftCornerRadius:kPopupRoundingRadius |
| 825 bottomRightCornerRadius:kPopupRoundingRadius]; | 825 bottomRightCornerRadius:kPopupRoundingRadius]; |
| 826 | 826 |
| 827 // Draw the matrix clipped to our border. | 827 // Draw the matrix clipped to our border. |
| 828 gfx::ScopedNSGraphicsContextSaveGState scopedGState; | 828 gfx::ScopedNSGraphicsContextSaveGState scopedGState; |
| 829 [path addClip]; | 829 [path addClip]; |
| 830 [super drawRect:rect]; | 830 [super drawRect:rect]; |
| 831 } | 831 } |
| 832 | 832 |
| 833 @end | 833 @end |
| OLD | NEW |