Browse Source

Merge pull request #4996 from atom/osx-no-white-flash

Remove the white flash when loading page on OS X
Cheng Zhao 9 years ago
parent
commit
a6f19c4292
3 changed files with 8 additions and 3 deletions
  1. 3 0
      atom/browser/native_window.cc
  2. 4 2
      atom/browser/native_window_mac.mm
  3. 1 1
      script/lib/config.py

+ 3 - 0
atom/browser/native_window.cc

@@ -162,6 +162,9 @@ void NativeWindow::InitFromOptions(const mate::Dictionary& options) {
   std::string color;
   if (options.Get(options::kBackgroundColor, &color)) {
     SetBackgroundColor(color);
+  } else if (has_frame()) {
+    // For window with frame, use white as default background.
+    SetBackgroundColor("#FFFF");
   }
   std::string title("Electron");
   options.Get(options::kTitle, &title);

+ 4 - 2
atom/browser/native_window_mac.mm

@@ -10,6 +10,7 @@
 #include "atom/common/draggable_region.h"
 #include "atom/common/options_switches.h"
 #include "base/mac/mac_util.h"
+#include "base/mac/scoped_cftyperef.h"
 #include "base/strings/sys_string_conversions.h"
 #include "brightray/browser/inspectable_web_contents.h"
 #include "brightray/browser/inspectable_web_contents_view.h"
@@ -806,8 +807,9 @@ bool NativeWindowMac::IsKiosk() {
 }
 
 void NativeWindowMac::SetBackgroundColor(const std::string& color_name) {
-  SkColor color = ParseHexColor(color_name);
-  [window_ setBackgroundColor:skia::SkColorToCalibratedNSColor(color)];
+  base::ScopedCFTypeRef<CGColorRef> color =
+      skia::CGColorCreateFromSkColor(ParseHexColor(color_name));
+  [[[window_ contentView] layer] setBackgroundColor:color];
 }
 
 void NativeWindowMac::SetHasShadow(bool has_shadow) {

+ 1 - 1
script/lib/config.py

@@ -8,7 +8,7 @@ import sys
 
 BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \
     'https://s3.amazonaws.com/github-janky-artifacts/libchromiumcontent'
-LIBCHROMIUMCONTENT_COMMIT = 'd41c1e48f428257d99abcf29fd9f26928e9fc53e'
+LIBCHROMIUMCONTENT_COMMIT = '9229f39b44ca1dde25db9c648547861286b61935'
 
 PLATFORM = {
   'cygwin': 'win32',