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

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

Issue 2915283003: Omnibox UI: Confine Cocoa suggestion lines to a single-line. (Closed)
Patch Set: revert an erroneous change 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 if (!NSIsEmptyRect(renderRect)) { 640 if (!NSIsEmptyRect(renderRect)) {
640 [attributedString drawWithRect:FlipIfRTL(renderRect, cellFrame) 641 [attributedString drawWithRect:FlipIfRTL(renderRect, cellFrame)
641 options:NSStringDrawingUsesLineFragmentOrigin | 642 options:NSStringDrawingUsesLineFragmentOrigin |
642 NSStringDrawingTruncatesLastVisibleLine]; 643 NSStringDrawingTruncatesLastVisibleLine];
643 } 644 }
644 return NSWidth(renderRect); 645 return NSWidth(renderRect);
645 } 646 }
646 647
647 + (CGFloat)computeContentsOffset:(const AutocompleteMatch&)match { 648 + (CGFloat)computeContentsOffset:(const AutocompleteMatch&)match {
648 const base::string16& inputText = base::UTF8ToUTF16( 649 const base::string16& inputText = base::UTF8ToUTF16(
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 } 724 }
724 725
725 + (CGFloat)getContentTextHeightForDoubleLine:(BOOL)isDoubleLine { 726 + (CGFloat)getContentTextHeightForDoubleLine:(BOOL)isDoubleLine {
726 CGFloat height = kDefaultTextHeight + 2 * GetVerticalMargin(); 727 CGFloat height = kDefaultTextHeight + 2 * GetVerticalMargin();
727 if (isDoubleLine) 728 if (isDoubleLine)
728 height += kDefaultTextHeight + kDefaultVerticalMargin; 729 height += kDefaultTextHeight + kDefaultVerticalMargin;
729 return height; 730 return height;
730 } 731 }
731 732
732 @end 733 @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