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

Side by Side Diff: chrome/browser/cocoa/autocomplete_text_field_cell.mm

Issue 1605002: [Mac] Fix DCHECK() on page actions in preview. (Closed)
Patch Set: Um, test should really match comment, no? Created 10 years, 8 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/cocoa/autocomplete_text_field_cell.h" 5 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "gfx/font.h" 9 #include "gfx/font.h"
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 CGFloat WidthForHint(NSAttributedString* hintString) { 51 CGFloat WidthForHint(NSAttributedString* hintString) {
52 return kHintXOffset + ceil([hintString size].width); 52 return kHintXOffset + ceil([hintString size].width);
53 } 53 }
54 CGFloat WidthForKeyword(NSAttributedString* keywordString) { 54 CGFloat WidthForKeyword(NSAttributedString* keywordString) {
55 return kKeywordXOffset + ceil([keywordString size].width) + 55 return kKeywordXOffset + ceil([keywordString size].width) +
56 2 * kKeywordTokenInset; 56 2 * kKeywordTokenInset;
57 } 57 }
58 58
59 // Convenience to draw |image| in the |rect| portion of |view|. 59 // Convenience to draw |image| in the |rect| portion of |view|.
60 void DrawImageInRect(NSImage* image, NSView* view, const NSRect& rect) { 60 void DrawImageInRect(NSImage* image, NSView* view, const NSRect& rect) {
61 DCHECK(NSEqualSizes([image size], rect.size)); 61 // If there is an image, make sure we calculated the target size
62 // correctly.
63 DCHECK(!image || NSEqualSizes([image size], rect.size));
62 [image setFlipped:[view isFlipped]]; 64 [image setFlipped:[view isFlipped]];
63 [image drawInRect:rect 65 [image drawInRect:rect
64 fromRect:NSZeroRect // Entire image 66 fromRect:NSZeroRect // Entire image
65 operation:NSCompositeSourceOver 67 operation:NSCompositeSourceOver
66 fraction:1.0]; 68 fraction:1.0];
67 } 69 }
68 70
69 } // namespace 71 } // namespace
70 72
71 @implementation AutocompleteTextFieldIcon 73 @implementation AutocompleteTextFieldIcon
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 icon = [self iconForEvent:theEvent inRect:cellFrame ofView:controlView]; 522 icon = [self iconForEvent:theEvent inRect:cellFrame ofView:controlView];
521 if (icon) { 523 if (icon) {
522 [icon view]->OnMousePressed([icon rect]); 524 [icon view]->OnMousePressed([icon rect]);
523 return YES; 525 return YES;
524 } 526 }
525 527
526 return NO; 528 return NO;
527 } 529 }
528 530
529 @end 531 @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