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

Unified Diff: ui/views/cocoa/bridged_native_widget.mm

Issue 987733002: MacViews: Fix WidgetTest.WidgetDeleted_InOnMousePressed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | ui/views/test/event_generator_delegate_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/cocoa/bridged_native_widget.mm
diff --git a/ui/views/cocoa/bridged_native_widget.mm b/ui/views/cocoa/bridged_native_widget.mm
index 4c7a28cdd1f8a9d35456e7f9b08eec96109253b9..71e7290cb2d8a89cb1d6a1daf0c356c41a4e35e8 100644
--- a/ui/views/cocoa/bridged_native_widget.mm
+++ b/ui/views/cocoa/bridged_native_widget.mm
@@ -134,6 +134,15 @@ void BridgedNativeWidget::Init(base::scoped_nsobject<NSWindow> window,
// would appear there, which might be unexpected.
DCHECK(params.bounds.origin().IsOrigin())
<< "Zero-sized windows not supported on Mac.";
+
+ // Otherwise, bounds is all zeroes. Cocoa will currently have the window at
+ // the bottom left of the screen. To support a client calling SetSize() only
+ // (and for consistency across platforms) put it at the top-left instead.
+ // Read back the current frame: it will be a 1x1 context rect but the frame
+ // size also depends on the window style.
+ NSRect frame_rect = [window_ frame];
+ SetBounds(gfx::Rect(gfx::Point(),
+ gfx::Size(NSWidth(frame_rect), NSHeight(frame_rect))));
}
// Widgets for UI controls (usually layered above web contents) start visible.
« no previous file with comments | « no previous file | ui/views/test/event_generator_delegate_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698