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 16 matching lines...) Expand all Loading... |
27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
28 #include "ui/base/material_design/material_design_controller.h" | 28 #include "ui/base/material_design/material_design_controller.h" |
29 #include "ui/gfx/color_palette.h" | 29 #include "ui/gfx/color_palette.h" |
30 #include "ui/gfx/font.h" | 30 #include "ui/gfx/font.h" |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 // How far to offset text. | 34 // How far to offset text. |
35 const CGFloat kVerticalTextPadding = 3.0; | 35 const CGFloat kVerticalTextPadding = 3.0; |
36 | 36 |
37 const CGFloat kVerticalImagePadding = 3.0; | |
38 const CGFloat kMaterialVerticalImagePadding = 5.0; | 37 const CGFloat kMaterialVerticalImagePadding = 5.0; |
39 | 38 |
40 const CGFloat kTextStartOffset = 28.0; | |
41 const CGFloat kMaterialTextStartOffset = 27.0; | 39 const CGFloat kMaterialTextStartOffset = 27.0; |
42 | 40 |
43 // Rounding radius of selection and hover background on popup items. | 41 const CGFloat kMaterialImageXOffset = 6.0; |
44 const CGFloat kCellRoundingRadius = 2.0; | |
45 | |
46 // How far to offset the image. | |
47 CGFloat VerticalImagePadding() { | |
48 if (!ui::MaterialDesignController::IsModeMaterial()) { | |
49 return kVerticalImagePadding; | |
50 } | |
51 return kMaterialVerticalImagePadding; | |
52 } | |
53 | |
54 // How far to offset the image column from the left. | |
55 CGFloat ImageXOffset() { | |
56 const CGFloat kImageXOffset = 5.0; | |
57 const CGFloat kMaterialImageXOffset = 6.0; | |
58 if (!ui::MaterialDesignController::IsModeMaterial()) { | |
59 return kImageXOffset; | |
60 } | |
61 return kMaterialImageXOffset; | |
62 } | |
63 | |
64 // How far to offset the text column from the left. | |
65 CGFloat TextStartOffset() { | |
66 if (!ui::MaterialDesignController::IsModeMaterial()) { | |
67 return kTextStartOffset; | |
68 } | |
69 return kMaterialTextStartOffset; | |
70 } | |
71 | 42 |
72 // Flips the given |rect| in context of the given |frame|. | 43 // Flips the given |rect| in context of the given |frame|. |
73 NSRect FlipIfRTL(NSRect rect, NSRect frame) { | 44 NSRect FlipIfRTL(NSRect rect, NSRect frame) { |
74 DCHECK_LE(NSMinX(frame), NSMinX(rect)); | 45 DCHECK_LE(NSMinX(frame), NSMinX(rect)); |
75 DCHECK_GE(NSMaxX(frame), NSMaxX(rect)); | 46 DCHECK_GE(NSMaxX(frame), NSMaxX(rect)); |
76 if (base::i18n::IsRTL()) { | 47 if (base::i18n::IsRTL()) { |
77 NSRect result = rect; | 48 NSRect result = rect; |
78 result.origin.x = NSMinX(frame) + (NSMaxX(frame) - NSMaxX(rect)); | 49 result.origin.x = NSMinX(frame) + (NSMaxX(frame) - NSMaxX(rect)); |
79 return result; | 50 return result; |
80 } | 51 } |
81 return rect; | 52 return rect; |
82 } | 53 } |
83 | 54 |
84 NSColor* SelectedBackgroundColor(BOOL is_dark_theme) { | 55 NSColor* SelectedBackgroundColor(BOOL is_dark_theme) { |
85 if (!ui::MaterialDesignController::IsModeMaterial()) { | |
86 return [NSColor selectedControlColor]; | |
87 } | |
88 return is_dark_theme | 56 return is_dark_theme |
89 ? skia::SkColorToSRGBNSColor(SkColorSetA(SK_ColorWHITE, 0x14)) | 57 ? skia::SkColorToSRGBNSColor(SkColorSetA(SK_ColorWHITE, 0x14)) |
90 : skia::SkColorToSRGBNSColor(SkColorSetA(SK_ColorBLACK, 0x14)); | 58 : skia::SkColorToSRGBNSColor(SkColorSetA(SK_ColorBLACK, 0x14)); |
91 } | 59 } |
92 | 60 |
93 NSColor* HoveredBackgroundColor(BOOL is_dark_theme) { | 61 NSColor* HoveredBackgroundColor(BOOL is_dark_theme) { |
94 if (is_dark_theme) { | 62 return is_dark_theme |
95 return skia::SkColorToSRGBNSColor(SkColorSetA(SK_ColorWHITE, 0x0D)); | 63 ? skia::SkColorToSRGBNSColor(SkColorSetA(SK_ColorWHITE, 0x0D)) |
96 } | 64 : [NSColor controlHighlightColor]; |
97 return [NSColor controlHighlightColor]; | |
98 } | 65 } |
99 | 66 |
100 NSColor* ContentTextColor(BOOL is_dark_theme) { | 67 NSColor* ContentTextColor(BOOL is_dark_theme) { |
101 if (ui::MaterialDesignController::IsModeMaterial() && is_dark_theme) { | 68 return is_dark_theme ? [NSColor whiteColor] : [NSColor blackColor]; |
102 return [NSColor whiteColor]; | |
103 } | |
104 return [NSColor blackColor]; | |
105 } | 69 } |
106 NSColor* DimTextColor(BOOL is_dark_theme) { | 70 NSColor* DimTextColor(BOOL is_dark_theme) { |
107 if (!ui::MaterialDesignController::IsModeMaterial()) { | 71 return is_dark_theme |
108 return [NSColor darkGrayColor]; | 72 ? skia::SkColorToSRGBNSColor(SkColorSetA(SK_ColorWHITE, 0x7F)) |
109 } | 73 : skia::SkColorToSRGBNSColor(SkColorSetRGB(0x64, 0x64, 0x64)); |
110 if (is_dark_theme) { | |
111 return skia::SkColorToSRGBNSColor(SkColorSetA(SK_ColorWHITE, 0x7F)); | |
112 } | |
113 return skia::SkColorToSRGBNSColor(SkColorSetRGB(0x64, 0x64, 0x64)); | |
114 } | 74 } |
115 NSColor* PositiveTextColor() { | 75 NSColor* PositiveTextColor() { |
116 if (!ui::MaterialDesignController::IsModeMaterial()) { | |
117 return skia::SkColorToCalibratedNSColor(SkColorSetRGB(0x3d, 0x94, 0x00)); | |
118 } | |
119 return skia::SkColorToSRGBNSColor(SkColorSetRGB(0x3d, 0x94, 0x00)); | 76 return skia::SkColorToSRGBNSColor(SkColorSetRGB(0x3d, 0x94, 0x00)); |
120 } | 77 } |
121 NSColor* NegativeTextColor() { | 78 NSColor* NegativeTextColor() { |
122 if (!ui::MaterialDesignController::IsModeMaterial()) { | |
123 return skia::SkColorToCalibratedNSColor(SkColorSetRGB(0xdd, 0x4b, 0x39)); | |
124 } | |
125 return skia::SkColorToSRGBNSColor(SkColorSetRGB(0xdd, 0x4b, 0x39)); | 79 return skia::SkColorToSRGBNSColor(SkColorSetRGB(0xdd, 0x4b, 0x39)); |
126 } | 80 } |
127 NSColor* URLTextColor(BOOL is_dark_theme) { | 81 NSColor* URLTextColor(BOOL is_dark_theme) { |
128 if (!ui::MaterialDesignController::IsModeMaterial()) { | |
129 return [NSColor colorWithCalibratedRed:0.0 green:0.55 blue:0.0 alpha:1.0]; | |
130 } | |
131 return is_dark_theme ? skia::SkColorToSRGBNSColor(gfx::kGoogleBlue300) | 82 return is_dark_theme ? skia::SkColorToSRGBNSColor(gfx::kGoogleBlue300) |
132 : skia::SkColorToSRGBNSColor(gfx::kGoogleBlue700); | 83 : skia::SkColorToSRGBNSColor(gfx::kGoogleBlue700); |
133 } | 84 } |
134 | 85 |
135 NSFont* FieldFont() { | 86 NSFont* FieldFont() { |
136 return OmniboxViewMac::GetNormalFieldFont(); | 87 return OmniboxViewMac::GetNormalFieldFont(); |
137 } | 88 } |
138 NSFont* BoldFieldFont() { | 89 NSFont* BoldFieldFont() { |
139 return OmniboxViewMac::GetBoldFieldFont(); | 90 return OmniboxViewMac::GetBoldFieldFont(); |
140 } | 91 } |
(...skipping 24 matching lines...) Expand all Loading... |
165 value:paragraph_style | 116 value:paragraph_style |
166 range:range]; | 117 range:range]; |
167 } | 118 } |
168 | 119 |
169 NSAttributedString* CreateAnswerStringHelper(const base::string16& text, | 120 NSAttributedString* CreateAnswerStringHelper(const base::string16& text, |
170 NSInteger style_type, | 121 NSInteger style_type, |
171 bool is_bold, | 122 bool is_bold, |
172 BOOL is_dark_theme) { | 123 BOOL is_dark_theme) { |
173 NSDictionary* answer_style = nil; | 124 NSDictionary* answer_style = nil; |
174 NSFont* answer_font = nil; | 125 NSFont* answer_font = nil; |
175 bool is_mode_material = ui::MaterialDesignController::IsModeMaterial(); | |
176 switch (style_type) { | 126 switch (style_type) { |
177 case SuggestionAnswer::TOP_ALIGNED: | 127 case SuggestionAnswer::TOP_ALIGNED: |
178 answer_style = @{ | 128 answer_style = @{ |
179 NSForegroundColorAttributeName : DimTextColor(is_dark_theme), | 129 NSForegroundColorAttributeName : DimTextColor(is_dark_theme), |
180 NSFontAttributeName : LargeSuperscriptFont(), | 130 NSFontAttributeName : LargeSuperscriptFont(), |
181 NSSuperscriptAttributeName : @1 | 131 NSSuperscriptAttributeName : @1 |
182 }; | 132 }; |
183 break; | 133 break; |
184 case SuggestionAnswer::DESCRIPTION_NEGATIVE: | 134 case SuggestionAnswer::DESCRIPTION_NEGATIVE: |
185 answer_style = @{ | 135 answer_style = @{ |
(...skipping 19 matching lines...) Expand all Loading... |
205 NSFontAttributeName : FieldFont() | 155 NSFontAttributeName : FieldFont() |
206 }; | 156 }; |
207 break; | 157 break; |
208 case SuggestionAnswer::ANSWER_TEXT_LARGE: | 158 case SuggestionAnswer::ANSWER_TEXT_LARGE: |
209 answer_style = @{ | 159 answer_style = @{ |
210 NSForegroundColorAttributeName : ContentTextColor(is_dark_theme), | 160 NSForegroundColorAttributeName : ContentTextColor(is_dark_theme), |
211 NSFontAttributeName : LargeFont() | 161 NSFontAttributeName : LargeFont() |
212 }; | 162 }; |
213 break; | 163 break; |
214 case SuggestionAnswer::SUGGESTION_SECONDARY_TEXT_SMALL: | 164 case SuggestionAnswer::SUGGESTION_SECONDARY_TEXT_SMALL: |
215 answer_font = is_mode_material ? FieldFont() : SmallFont(); | 165 answer_font = FieldFont(); |
216 answer_style = @{ | 166 answer_style = @{ |
217 NSForegroundColorAttributeName : DimTextColor(is_dark_theme), | 167 NSForegroundColorAttributeName : DimTextColor(is_dark_theme), |
218 NSFontAttributeName : answer_font | 168 NSFontAttributeName : answer_font |
219 }; | 169 }; |
220 break; | 170 break; |
221 case SuggestionAnswer::SUGGESTION_SECONDARY_TEXT_MEDIUM: | 171 case SuggestionAnswer::SUGGESTION_SECONDARY_TEXT_MEDIUM: |
222 answer_font = is_mode_material ? LargeSuperscriptFont() : FieldFont(); | 172 answer_font = LargeSuperscriptFont(); |
223 answer_style = @{ | 173 answer_style = @{ |
224 NSForegroundColorAttributeName : DimTextColor(is_dark_theme), | 174 NSForegroundColorAttributeName : DimTextColor(is_dark_theme), |
225 NSFontAttributeName : answer_font | 175 NSFontAttributeName : answer_font |
226 }; | 176 }; |
227 break; | 177 break; |
228 case SuggestionAnswer::SUGGESTION: // Fall through. | 178 case SuggestionAnswer::SUGGESTION: // Fall through. |
229 default: | 179 default: |
230 answer_style = @{ | 180 answer_style = @{ |
231 NSForegroundColorAttributeName : ContentTextColor(is_dark_theme), | 181 NSForegroundColorAttributeName : ContentTextColor(is_dark_theme), |
232 NSFontAttributeName : FieldFont() | 182 NSFontAttributeName : FieldFont() |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 OmniboxPopupMatrix* matrix = | 443 OmniboxPopupMatrix* matrix = |
494 base::mac::ObjCCastStrict<OmniboxPopupMatrix>(controlView); | 444 base::mac::ObjCCastStrict<OmniboxPopupMatrix>(controlView); |
495 BOOL isDarkTheme = [matrix hasDarkTheme]; | 445 BOOL isDarkTheme = [matrix hasDarkTheme]; |
496 | 446 |
497 if ([self state] == NSOnState || [self isHighlighted]) { | 447 if ([self state] == NSOnState || [self isHighlighted]) { |
498 if ([self state] == NSOnState) { | 448 if ([self state] == NSOnState) { |
499 [SelectedBackgroundColor(isDarkTheme) set]; | 449 [SelectedBackgroundColor(isDarkTheme) set]; |
500 } else { | 450 } else { |
501 [HoveredBackgroundColor(isDarkTheme) set]; | 451 [HoveredBackgroundColor(isDarkTheme) set]; |
502 } | 452 } |
503 if (ui::MaterialDesignController::IsModeMaterial()) { | 453 NSRectFillUsingOperation(cellFrame, NSCompositeSourceOver); |
504 NSRectFillUsingOperation(cellFrame, NSCompositeSourceOver); | |
505 } else { | |
506 NSBezierPath* path = | |
507 [NSBezierPath bezierPathWithRoundedRect:cellFrame | |
508 xRadius:kCellRoundingRadius | |
509 yRadius:kCellRoundingRadius]; | |
510 [path fill]; | |
511 } | |
512 } | 454 } |
513 | 455 |
514 [self drawMatchWithFrame:cellFrame inView:controlView]; | 456 [self drawMatchWithFrame:cellFrame inView:controlView]; |
515 } | 457 } |
516 | 458 |
517 - (void)drawMatchWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { | 459 - (void)drawMatchWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { |
518 OmniboxPopupCellData* cellData = | 460 OmniboxPopupCellData* cellData = |
519 base::mac::ObjCCastStrict<OmniboxPopupCellData>([self objectValue]); | 461 base::mac::ObjCCastStrict<OmniboxPopupCellData>([self objectValue]); |
520 OmniboxPopupMatrix* tableView = | 462 OmniboxPopupMatrix* tableView = |
521 base::mac::ObjCCastStrict<OmniboxPopupMatrix>(controlView); | 463 base::mac::ObjCCastStrict<OmniboxPopupMatrix>(controlView); |
(...skipping 11 matching lines...) Expand all Loading... |
533 !AutocompleteMatch::IsSearchType([cellData matchType]), | 475 !AutocompleteMatch::IsSearchType([cellData matchType]), |
534 &contentsMaxWidth, | 476 &contentsMaxWidth, |
535 &descriptionMaxWidth); | 477 &descriptionMaxWidth); |
536 | 478 |
537 NSWindow* parentWindow = [[controlView window] parentWindow]; | 479 NSWindow* parentWindow = [[controlView window] parentWindow]; |
538 BOOL isDarkTheme = [parentWindow hasDarkTheme]; | 480 BOOL isDarkTheme = [parentWindow hasDarkTheme]; |
539 NSRect imageRect = cellFrame; | 481 NSRect imageRect = cellFrame; |
540 NSImage* theImage = | 482 NSImage* theImage = |
541 isDarkTheme ? [cellData incognitoImage] : [cellData image]; | 483 isDarkTheme ? [cellData incognitoImage] : [cellData image]; |
542 imageRect.size = [theImage size]; | 484 imageRect.size = [theImage size]; |
543 imageRect.origin.x += ImageXOffset() + [tableView contentLeftPadding]; | 485 imageRect.origin.x += kMaterialImageXOffset + [tableView contentLeftPadding]; |
544 imageRect.origin.y += VerticalImagePadding(); | 486 imageRect.origin.y += kMaterialVerticalImagePadding; |
545 [theImage drawInRect:FlipIfRTL(imageRect, cellFrame) | 487 [theImage drawInRect:FlipIfRTL(imageRect, cellFrame) |
546 fromRect:NSZeroRect | 488 fromRect:NSZeroRect |
547 operation:NSCompositeSourceOver | 489 operation:NSCompositeSourceOver |
548 fraction:1.0 | 490 fraction:1.0 |
549 respectFlipped:YES | 491 respectFlipped:YES |
550 hints:nil]; | 492 hints:nil]; |
551 | 493 |
552 NSPoint origin = NSMakePoint( | 494 NSPoint origin = |
553 TextStartOffset() + [tableView contentLeftPadding], kVerticalTextPadding); | 495 NSMakePoint(kMaterialTextStartOffset + [tableView contentLeftPadding], |
| 496 kVerticalTextPadding); |
554 if ([cellData matchType] == AutocompleteMatchType::SEARCH_SUGGEST_TAIL) { | 497 if ([cellData matchType] == AutocompleteMatchType::SEARCH_SUGGEST_TAIL) { |
555 // Infinite suggestions are rendered with a prefix (usually ellipsis), which | 498 // Infinite suggestions are rendered with a prefix (usually ellipsis), which |
556 // appear vertically stacked. | 499 // appear vertically stacked. |
557 origin.x += [self drawMatchPrefixWithFrame:cellFrame | 500 origin.x += [self drawMatchPrefixWithFrame:cellFrame |
558 tableView:tableView | 501 tableView:tableView |
559 withContentsMaxWidth:&contentsMaxWidth | 502 withContentsMaxWidth:&contentsMaxWidth |
560 forDarkTheme:isDarkTheme]; | 503 forDarkTheme:isDarkTheme]; |
561 } | 504 } |
562 origin.x += [self drawMatchPart:[cellData contents] | 505 origin.x += [self drawMatchPart:[cellData contents] |
563 withFrame:cellFrame | 506 withFrame:cellFrame |
564 origin:origin | 507 origin:origin |
565 withMaxWidth:contentsMaxWidth | 508 withMaxWidth:contentsMaxWidth |
566 forDarkTheme:isDarkTheme]; | 509 forDarkTheme:isDarkTheme]; |
567 | 510 |
568 if (descriptionMaxWidth > 0) { | 511 if (descriptionMaxWidth > 0) { |
569 if ([cellData isAnswer]) { | 512 if ([cellData isAnswer]) { |
570 origin = NSMakePoint(TextStartOffset() + [tableView contentLeftPadding], | 513 origin = |
571 kContentLineHeight - kVerticalTextPadding); | 514 NSMakePoint(kMaterialTextStartOffset + [tableView contentLeftPadding], |
| 515 kContentLineHeight - kVerticalTextPadding); |
572 CGFloat imageSize = [tableView answerLineHeight]; | 516 CGFloat imageSize = [tableView answerLineHeight]; |
573 NSRect imageRect = | 517 NSRect imageRect = |
574 NSMakeRect(NSMinX(cellFrame) + origin.x, NSMinY(cellFrame) + origin.y, | 518 NSMakeRect(NSMinX(cellFrame) + origin.x, NSMinY(cellFrame) + origin.y, |
575 imageSize, imageSize); | 519 imageSize, imageSize); |
576 [[cellData answerImage] drawInRect:FlipIfRTL(imageRect, cellFrame) | 520 [[cellData answerImage] drawInRect:FlipIfRTL(imageRect, cellFrame) |
577 fromRect:NSZeroRect | 521 fromRect:NSZeroRect |
578 operation:NSCompositeSourceOver | 522 operation:NSCompositeSourceOver |
579 fraction:1.0 | 523 fraction:1.0 |
580 respectFlipped:YES | 524 respectFlipped:YES |
581 hints:nil]; | 525 hints:nil]; |
582 if ([cellData answerImage]) { | 526 if ([cellData answerImage]) { |
583 origin.x += imageSize + VerticalImagePadding(); | 527 origin.x += imageSize + kMaterialVerticalImagePadding; |
584 | 528 |
585 // Have to nudge the baseline down 1pt in Material Design for the text | 529 // Have to nudge the baseline down 1pt in Material Design for the text |
586 // that follows, so that it's the same as the bottom of the image. | 530 // that follows, so that it's the same as the bottom of the image. |
587 if (ui::MaterialDesignController::IsModeMaterial()) { | 531 origin.y += 1; |
588 origin.y += 1; | |
589 } | |
590 } | 532 } |
591 } else { | 533 } else { |
592 origin.x += [self drawMatchPart:[tableView separator] | 534 origin.x += [self drawMatchPart:[tableView separator] |
593 withFrame:cellFrame | 535 withFrame:cellFrame |
594 origin:origin | 536 origin:origin |
595 withMaxWidth:separatorWidth | 537 withMaxWidth:separatorWidth |
596 forDarkTheme:isDarkTheme]; | 538 forDarkTheme:isDarkTheme]; |
597 } | 539 } |
598 origin.x += [self drawMatchPart:[cellData description] | 540 origin.x += [self drawMatchPart:[cellData description] |
599 withFrame:cellFrame | 541 withFrame:cellFrame |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 // We have to render the prefix, so offset has to be at least |prefixWidth|. | 576 // We have to render the prefix, so offset has to be at least |prefixWidth|. |
635 offset = | 577 offset = |
636 std::max(prefixWidth, | 578 std::max(prefixWidth, |
637 std::min(remainingWidth - [tableView maxMatchContentsWidth], | 579 std::min(remainingWidth - [tableView maxMatchContentsWidth], |
638 [cellData contentsOffset])); | 580 [cellData contentsOffset])); |
639 prefixOffset = offset - prefixWidth; | 581 prefixOffset = offset - prefixWidth; |
640 } | 582 } |
641 *contentsMaxWidth = std::min((int)ceilf(remainingWidth - prefixWidth), | 583 *contentsMaxWidth = std::min((int)ceilf(remainingWidth - prefixWidth), |
642 *contentsMaxWidth); | 584 *contentsMaxWidth); |
643 NSPoint origin = NSMakePoint( | 585 NSPoint origin = NSMakePoint( |
644 prefixOffset + TextStartOffset() + [tableView contentLeftPadding], 0); | 586 prefixOffset + kMaterialTextStartOffset + [tableView contentLeftPadding], |
| 587 0); |
645 [self drawMatchPart:[cellData prefix] | 588 [self drawMatchPart:[cellData prefix] |
646 withFrame:cellFrame | 589 withFrame:cellFrame |
647 origin:origin | 590 origin:origin |
648 withMaxWidth:prefixWidth | 591 withMaxWidth:prefixWidth |
649 forDarkTheme:isDarkTheme]; | 592 forDarkTheme:isDarkTheme]; |
650 return offset; | 593 return offset; |
651 } | 594 } |
652 | 595 |
653 - (CGFloat)drawMatchPart:(NSAttributedString*)attributedString | 596 - (CGFloat)drawMatchPart:(NSAttributedString*)attributedString |
654 withFrame:(NSRect)cellFrame | 597 withFrame:(NSRect)cellFrame |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 return base::i18n::IsRTL() ? (inputWidth - glyphOffset) : glyphOffset; | 678 return base::i18n::IsRTL() ? (inputWidth - glyphOffset) : glyphOffset; |
736 } | 679 } |
737 | 680 |
738 + (NSAttributedString*)createSeparatorStringForDarkTheme:(BOOL)isDarkTheme { | 681 + (NSAttributedString*)createSeparatorStringForDarkTheme:(BOOL)isDarkTheme { |
739 base::string16 raw_separator = | 682 base::string16 raw_separator = |
740 l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR); | 683 l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR); |
741 return CreateAttributedString(raw_separator, DimTextColor(isDarkTheme)); | 684 return CreateAttributedString(raw_separator, DimTextColor(isDarkTheme)); |
742 } | 685 } |
743 | 686 |
744 + (CGFloat)getContentAreaWidth:(NSRect)cellFrame { | 687 + (CGFloat)getContentAreaWidth:(NSRect)cellFrame { |
745 return NSWidth(cellFrame) - TextStartOffset(); | 688 return NSWidth(cellFrame) - kMaterialTextStartOffset; |
746 } | 689 } |
747 | 690 |
748 @end | 691 @end |
OLD | NEW |