| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/toolbar_controller.h" | 5 #import "chrome/browser/cocoa/toolbar_controller.h" |
| 6 | 6 |
| 7 #include "base/mac_util.h" | 7 #include "base/mac_util.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "base/gfx/rect.h" | 9 #include "base/gfx/rect.h" |
| 10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 | 439 |
| 440 - (NSRect)starButtonInWindowCoordinates { | 440 - (NSRect)starButtonInWindowCoordinates { |
| 441 return [[[starButton_ window] contentView] convertRect:[starButton_ bounds] | 441 return [[[starButton_ window] contentView] convertRect:[starButton_ bounds] |
| 442 fromView:starButton_]; | 442 fromView:starButton_]; |
| 443 } | 443 } |
| 444 | 444 |
| 445 - (gfx::Rect)autocompletePopupPosition { | 445 - (gfx::Rect)autocompletePopupPosition { |
| 446 // The popup should span from the left edge of the star button to the right | 446 // The popup should span from the left edge of the star button to the right |
| 447 // edge of the go button. The returned height is ignored. | 447 // edge of the go button. The returned height is ignored. |
| 448 NSRect locationFrame = [locationBar_ frame]; | 448 NSRect locationFrame = [locationBar_ frame]; |
| 449 int minX = NSMinX([starButton_ frame]); | 449 // TODO(shess): The buttons have an extra 2 pixels between the edge |
| 450 int maxX = NSMaxX([goButton_ frame]); | 450 // of the visual button and the edge of the logical button. This |
| 451 // seems wrong. |
| 452 int minX = NSMinX([starButton_ frame]) + 2.0; |
| 453 int maxX = NSMaxX([goButton_ frame]) - 2.0; |
| 451 DCHECK(minX < NSMinX(locationFrame)); | 454 DCHECK(minX < NSMinX(locationFrame)); |
| 452 DCHECK(maxX > NSMaxX(locationFrame)); | 455 DCHECK(maxX > NSMaxX(locationFrame)); |
| 453 | 456 |
| 454 // TODO(shess): The + 1.0 is because the field's visual boundary | 457 NSRect r = NSMakeRect(minX, NSMinY(locationFrame), maxX - minX, 0); |
| 455 // differs from its on-screen boundary. | |
| 456 NSRect r = NSMakeRect(minX, NSMinY(locationFrame) + 1.0, maxX - minX, 0); | |
| 457 return gfx::Rect(NSRectToCGRect([[self view] convertRect:r toView:nil])); | 458 return gfx::Rect(NSRectToCGRect([[self view] convertRect:r toView:nil])); |
| 458 } | 459 } |
| 459 @end | 460 @end |
| OLD | NEW |