Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Side by Side Diff: chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm

Issue 2924303002: Omnibox UI: Fix Cocoa suggestion lines for short lines (again). (Closed)
Patch Set: Fix answers in suggest case Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698