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

Remove the white flash when loading page on OS X
This commit is contained in:
Cheng Zhao 2016-04-03 13:44:43 +09:00
commit a6f19c4292
3 changed files with 8 additions and 3 deletions

View file

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

View file

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

View file

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