| 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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 | 629 |
| 630 - (CGFloat)drawMatchPart:(NSAttributedString*)attributedString | 630 - (CGFloat)drawMatchPart:(NSAttributedString*)attributedString |
| 631 withFrame:(NSRect)cellFrame | 631 withFrame:(NSRect)cellFrame |
| 632 origin:(NSPoint)origin | 632 origin:(NSPoint)origin |
| 633 withMaxWidth:(int)maxWidth | 633 withMaxWidth:(int)maxWidth |
| 634 forDarkTheme:(BOOL)isDarkTheme { | 634 forDarkTheme:(BOOL)isDarkTheme { |
| 635 NSRect renderRect = NSIntersectionRect( | 635 NSRect renderRect = NSIntersectionRect( |
| 636 cellFrame, NSOffsetRect(cellFrame, origin.x, origin.y)); | 636 cellFrame, NSOffsetRect(cellFrame, origin.x, origin.y)); |
| 637 renderRect.size.width = | 637 renderRect.size.width = |
| 638 std::min(NSWidth(renderRect), static_cast<CGFloat>(maxWidth)); | 638 std::min(NSWidth(renderRect), static_cast<CGFloat>(maxWidth)); |
| 639 renderRect.size.height = std::min(NSWidth(renderRect), kDefaultTextHeight); | 639 renderRect.size.height = |
| 640 std::min(NSHeight(renderRect), [attributedString size].height); |
| 640 if (!NSIsEmptyRect(renderRect)) { | 641 if (!NSIsEmptyRect(renderRect)) { |
| 641 [attributedString drawWithRect:FlipIfRTL(renderRect, cellFrame) | 642 [attributedString drawWithRect:FlipIfRTL(renderRect, cellFrame) |
| 642 options:NSStringDrawingUsesLineFragmentOrigin | | 643 options:NSStringDrawingUsesLineFragmentOrigin | |
| 643 NSStringDrawingTruncatesLastVisibleLine]; | 644 NSStringDrawingTruncatesLastVisibleLine]; |
| 644 } | 645 } |
| 645 return NSWidth(renderRect); | 646 return NSWidth(renderRect); |
| 646 } | 647 } |
| 647 | 648 |
| 648 + (CGFloat)computeContentsOffset:(const AutocompleteMatch&)match { | 649 + (CGFloat)computeContentsOffset:(const AutocompleteMatch&)match { |
| 649 const base::string16& inputText = base::UTF8ToUTF16( | 650 const base::string16& inputText = base::UTF8ToUTF16( |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 } | 725 } |
| 725 | 726 |
| 726 + (CGFloat)getContentTextHeightForDoubleLine:(BOOL)isDoubleLine { | 727 + (CGFloat)getContentTextHeightForDoubleLine:(BOOL)isDoubleLine { |
| 727 CGFloat height = kDefaultTextHeight + 2 * GetVerticalMargin(); | 728 CGFloat height = kDefaultTextHeight + 2 * GetVerticalMargin(); |
| 728 if (isDoubleLine) | 729 if (isDoubleLine) |
| 729 height += kDefaultTextHeight + kDefaultVerticalMargin; | 730 height += kDefaultTextHeight + kDefaultVerticalMargin; |
| 730 return height; | 731 return height; |
| 731 } | 732 } |
| 732 | 733 |
| 733 @end | 734 @end |
| OLD | NEW |