]> khamidou — GitHub mirrors - electron.git/commitdiff
views: Use the quicker way of return content size
authorCheng Zhao <zcbenz@gmail.com>
Mon, 5 Oct 2015 12:03:43 +0000 (20:03 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 5 Oct 2015 12:07:20 +0000 (20:07 +0800)
Converting content size to window size on high DPI systems will lose
percise and have 1px offset sometimes.

atom/browser/native_window_views.cc
atom/browser/native_window_views.h

index fdcbe42205bf9bbcb945343d54a4ba3785263fe9..0264ac59e1a7f974b70465f6942d459e600b28e1 100644 (file)
@@ -442,6 +442,10 @@ gfx::Rect NativeWindowViews::GetBounds() {
   return window_->GetWindowBoundsInScreen();
 }
 
+gfx::Size NativeWindowViews::GetContentSize() {
+  return web_view_->size();
+}
+
 void NativeWindowViews::SetResizable(bool resizable) {
 #if defined(OS_WIN)
   // WS_MAXIMIZEBOX => Maximize button
index 0e74410868e1d1eba0c23482f74954bd96e33a0d..1ba02e89a3af827b47aa0f4bede5f25921abc496 100644 (file)
@@ -63,6 +63,7 @@ class NativeWindowViews : public NativeWindow,
   bool IsFullscreen() const override;
   void SetBounds(const gfx::Rect& bounds) override;
   gfx::Rect GetBounds() override;
+  gfx::Size GetContentSize() override;
   void SetResizable(bool resizable) override;
   bool IsResizable() override;
   void SetAlwaysOnTop(bool top) override;