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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.mm

Issue 17733005: [Autofill] (Mostly) fix Autofill popup positioning on multiple monitors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h" 7 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" 10 #include "chrome/browser/ui/autofill/autofill_popup_controller.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 void AutofillPopupViewBridge::InvalidateRow(size_t row) { 86 void AutofillPopupViewBridge::InvalidateRow(size_t row) {
87 NSRect dirty_rect = 87 NSRect dirty_rect =
88 NSRectFromCGRect(controller_->GetRowBounds(row).ToCGRect()); 88 NSRectFromCGRect(controller_->GetRowBounds(row).ToCGRect());
89 [view_ setNeedsDisplayInRect:dirty_rect]; 89 [view_ setNeedsDisplayInRect:dirty_rect];
90 } 90 }
91 91
92 void AutofillPopupViewBridge::UpdateBoundsAndRedrawPopup() { 92 void AutofillPopupViewBridge::UpdateBoundsAndRedrawPopup() {
93 NSRect frame = NSRectFromCGRect(controller_->popup_bounds().ToCGRect()); 93 NSRect frame = NSRectFromCGRect(controller_->popup_bounds().ToCGRect());
94 94
95 // Flip coordinates back into Cocoa-land. 95 // Flip coordinates back into Cocoa-land.
Scott Hess - ex-Googler 2013/06/27 21:55:58 OK, per offline discussion, I think I see what you
Ilya Sherman 2013/06/28 00:51:16 Done.
96 // TODO(isherman): Does this agree with the controller's idea of handling 96 NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
97 // multi-monitor setups correctly?
98 NSScreen* screen = [[controller_->container_view() window] screen];
99 frame.origin.y = NSHeight([screen frame]) - NSMaxY(frame); 97 frame.origin.y = NSHeight([screen frame]) - NSMaxY(frame);
100 98
101 // Leave room for the border. 99 // Leave room for the border.
102 frame = NSInsetRect(frame, -kBorderWidth, -kBorderWidth); 100 frame = NSInsetRect(frame, -kBorderWidth, -kBorderWidth);
103 if (controller_->popup_bounds().y() > controller_->element_bounds().y()) { 101 if (controller_->popup_bounds().y() > controller_->element_bounds().y()) {
104 // Popup is below the element which initiated it. 102 // Popup is below the element which initiated it.
105 frame.origin.y -= kBorderWidth; 103 frame.origin.y -= kBorderWidth;
106 } else { 104 } else {
107 // Popup is above the element which initiated it. 105 // Popup is above the element which initiated it.
108 frame.origin.y += kBorderWidth; 106 frame.origin.y += kBorderWidth;
(...skipping 10 matching lines...) Expand all
119 // big to fit on the screen. 117 // big to fit on the screen.
120 [window_ setFrame:frame display:YES]; 118 [window_ setFrame:frame display:YES];
121 } 119 }
122 120
123 AutofillPopupView* AutofillPopupView::Create( 121 AutofillPopupView* AutofillPopupView::Create(
124 AutofillPopupController* controller) { 122 AutofillPopupController* controller) {
125 return new AutofillPopupViewBridge(controller); 123 return new AutofillPopupViewBridge(controller);
126 } 124 }
127 125
128 } // namespace autofill 126 } // namespace autofill
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