| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h" | 5 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 return OmniboxViewMac::GetLargeFont(); | 93 return OmniboxViewMac::GetLargeFont(); |
| 94 } | 94 } |
| 95 NSFont* LargeSuperscriptFont() { | 95 NSFont* LargeSuperscriptFont() { |
| 96 NSFont* font = OmniboxViewMac::GetLargeFont(); | 96 NSFont* font = OmniboxViewMac::GetLargeFont(); |
| 97 // Calculate a slightly smaller font. The ratio here is somewhat arbitrary. | 97 // Calculate a slightly smaller font. The ratio here is somewhat arbitrary. |
| 98 // Proportions from 5/9 to 5/7 all look pretty good. | 98 // Proportions from 5/9 to 5/7 all look pretty good. |
| 99 CGFloat size = [font pointSize] * 5.0 / 9.0; | 99 CGFloat size = [font pointSize] * 5.0 / 9.0; |
| 100 NSFontDescriptor* descriptor = [font fontDescriptor]; | 100 NSFontDescriptor* descriptor = [font fontDescriptor]; |
| 101 return [NSFont fontWithDescriptor:descriptor size:size]; | 101 return [NSFont fontWithDescriptor:descriptor size:size]; |
| 102 } | 102 } |
| 103 NSFont* SmallFont() { | |
| 104 return OmniboxViewMac::GetSmallFont(); | |
| 105 } | |
| 106 | 103 |
| 107 // Sets the writing direction to |direction| for a given |range| of | 104 // Sets the writing direction to |direction| for a given |range| of |
| 108 // |attributedString|. | 105 // |attributedString|. |
| 109 void SetTextDirectionForRange(NSMutableAttributedString* attributedString, | 106 void SetTextDirectionForRange(NSMutableAttributedString* attributedString, |
| 110 NSWritingDirection direction, | 107 NSWritingDirection direction, |
| 111 NSRange range) { | 108 NSRange range) { |
| 112 base::scoped_nsobject<NSMutableParagraphStyle> paragraph_style( | 109 base::scoped_nsobject<NSMutableParagraphStyle> paragraph_style( |
| 113 [[NSMutableParagraphStyle alloc] init]); | 110 [[NSMutableParagraphStyle alloc] init]); |
| 114 [paragraph_style setBaseWritingDirection:direction]; | 111 [paragraph_style setBaseWritingDirection:direction]; |
| 115 [attributedString addAttribute:NSParagraphStyleAttributeName | 112 [attributedString addAttribute:NSParagraphStyleAttributeName |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 base::string16 raw_separator = | 679 base::string16 raw_separator = |
| 683 l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR); | 680 l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR); |
| 684 return CreateAttributedString(raw_separator, DimTextColor(isDarkTheme)); | 681 return CreateAttributedString(raw_separator, DimTextColor(isDarkTheme)); |
| 685 } | 682 } |
| 686 | 683 |
| 687 + (CGFloat)getContentAreaWidth:(NSRect)cellFrame { | 684 + (CGFloat)getContentAreaWidth:(NSRect)cellFrame { |
| 688 return NSWidth(cellFrame) - kMaterialTextStartOffset; | 685 return NSWidth(cellFrame) - kMaterialTextStartOffset; |
| 689 } | 686 } |
| 690 | 687 |
| 691 @end | 688 @end |
| OLD | NEW |