]> khamidou — GitHub mirrors - electron.git/commitdiff
osx: Fix converting size for frameless window
authorCheng Zhao <zcbenz@gmail.com>
Mon, 5 Oct 2015 11:32:23 +0000 (19:32 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 5 Oct 2015 12:07:20 +0000 (20:07 +0800)
atom/browser/native_window_mac.mm

index 76f9b0d0de07cd876a5b9fa182b183aea473a4d3..70c3cfc0cc7be50bd4647efd15b27b74d3d096a6 100644 (file)
@@ -789,12 +789,18 @@ void NativeWindowMac::HandleKeyboardEvent(
 }
 
 gfx::Size NativeWindowMac::ContentSizeToWindowSize(const gfx::Size& size) {
+  if (!has_frame())
+    return size;
+
   NSRect content = NSMakeRect(0, 0, size.width(), size.height());
   NSRect frame = [window_ frameRectForContentRect:content];
   return gfx::Size(frame.size);
 }
 
 gfx::Size NativeWindowMac::WindowSizeToContentSize(const gfx::Size& size) {
+  if (!has_frame())
+    return size;
+
   NSRect frame = NSMakeRect(0, 0, size.width(), size.height());
   NSRect content = [window_ contentRectForFrameRect:frame];
   return gfx::Size(content.size);