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

Unified Diff: chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm

Issue 12042002: Alternate NTP: Add search token to omnibox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm b/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm
index 2e5ed55f8f35b32c4a0a960e08fd97240a0fd637..140f7822bfb172e192e5ca827820dae83e282670 100644
--- a/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm
@@ -17,9 +17,6 @@
namespace {
-// How far to inset the hint text area from sides.
-const CGFloat kHintTextYInset = 4.0;
-
// How far to inset the hint image from sides. Lines baseline of text
// in image with baseline of prefix and suffix.
const CGFloat kHintImageYInset = 4.0;
@@ -88,7 +85,8 @@ void KeywordHintDecoration::SetKeyword(const string16& short_name,
hint_suffix_.reset([TrimAndConvert(keyword_hint.substr(split)) retain]);
}
-CGFloat KeywordHintDecoration::GetWidthForSpace(CGFloat width) {
+CGFloat KeywordHintDecoration::GetWidthForSpace(CGFloat width,
+ CGFloat text_width) {
NSImage* image = GetHintImage();
const CGFloat image_width = image ? [image size].width : 0.0;
@@ -120,7 +118,7 @@ void KeywordHintDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
const bool draw_full = NSWidth(frame) > image_width;
if (draw_full) {
- NSRect prefix_rect = NSInsetRect(frame, 0.0, kHintTextYInset);
+ NSRect prefix_rect = NSInsetRect(frame, 0.0, kTextYInset);
const CGFloat prefix_width =
[hint_prefix_ sizeWithAttributes:attributes_].width;
DCHECK_GE(NSWidth(prefix_rect), prefix_width);
@@ -144,7 +142,7 @@ void KeywordHintDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
frame.size.width -= NSWidth(image_rect);
if (draw_full) {
- NSRect suffix_rect = NSInsetRect(frame, 0.0, kHintTextYInset);
+ NSRect suffix_rect = NSInsetRect(frame, 0.0, kTextYInset);
const CGFloat suffix_width =
[hint_suffix_ sizeWithAttributes:attributes_].width;

Powered by Google App Engine
This is Rietveld 408576698