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

Unified Diff: chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm

Issue 10928222: mac: Fix omnibox size after r156836 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm
diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm
index c98779e2c8222c48f5cf7292f0c48b0be2089043..a38f728b9af2026ab7f9f7188585a9f3c815c5a5 100644
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm
@@ -22,15 +22,6 @@
#include "ui/gfx/rect.h"
#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
-
-#if !defined(MAC_OS_X_VERSION_10_7) || \
- MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
-@interface NSWindow (LionAPI)
-- (CGFloat)backingScaleFactor;
-@end
-#endif // 10.7
-
-
// The size delta between the font used for the edit and the result
// rows.
const int kEditFontAdjust = -1;
@@ -99,12 +90,6 @@ NSColor* URLTextColor() {
return [NSColor colorWithCalibratedRed:0.0 green:0.55 blue:0.0 alpha:1.0];
}
-CGFloat ScaleFactor(NSWindow* window) {
- if ([window respondsToSelector:@selector(backingScaleFactor)])
- return [window backingScaleFactor];
- return [window userSpaceScaleFactor];
-}
-
} // namespace
// Helper for MatchText() to allow sharing code between the contents
@@ -357,17 +342,15 @@ void OmniboxPopupViewMac::PositionPopup(const CGFloat matrixHeight) {
popupFrame.origin = [[field_ window] convertBaseToScreen:popupFrame.origin];
// Size to fit the matrix, and shift down by the size plus the top
- // window border. Would prefer -convertSize:fromView: to
- // -userSpaceScaleFactor for the scale conversion, but until the
- // window is on-screen that doesn't work right (bug?).
- popupFrame.size.height = matrixHeight * ScaleFactor(popup_);
+ // window border.
+ popupFrame.size.height = matrixHeight;
popupFrame.origin.y -= NSHeight(popupFrame) + kWindowBorderWidth;
// Inset to account for the horizontal border drawn by the window.
popupFrame = NSInsetRect(popupFrame, kWindowBorderWidth, 0.0);
// Leave a gap between the popup and the field.
- popupFrame.origin.y -= kPopupFieldGap * ScaleFactor(popup_);
+ popupFrame.origin.y -= kPopupFieldGap;
// Do nothing if the popup is already animating to the given |frame|.
if (NSEqualRects(popupFrame, targetPopupFrame_))
@@ -454,13 +437,11 @@ void OmniboxPopupViewMac::UpdatePopupAppearance() {
AutocompleteMatrix* matrix = [popup_ contentView];
// Calculate the width of the matrix based on backing out the
- // popup's border from the width of the field. Would prefer to use
- // [matrix convertSize:fromView:] for converting from screen size,
- // but that doesn't work until the popup is on-screen (bug?).
+ // popup's border from the width of the field.
const NSRect fieldRectBase = [field_ convertRect:[field_ bounds] toView:nil];
const CGFloat popupWidth = NSWidth(fieldRectBase) - 2 * kWindowBorderWidth;
DCHECK_GT(popupWidth, 0.0);
- const CGFloat matrixWidth = popupWidth / ScaleFactor(popup_);
+ const CGFloat matrixWidth = popupWidth;
// Load the results into the popup's matrix.
const size_t rows = model_->result().size();
« 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