From: Cheng Zhao Date: Thu, 7 Jan 2016 06:10:18 +0000 (+0800) Subject: Add blinkFeatures option X-Git-Tag: v0.36.3~9^2~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=3f2b26ddb77685785e54fca77387009b44373645;p=electron.git Add blinkFeatures option --- diff --git a/atom/browser/web_contents_preferences.cc b/atom/browser/web_contents_preferences.cc index 03003a56..c75b0daa 100644 --- a/atom/browser/web_contents_preferences.cc +++ b/atom/browser/web_contents_preferences.cc @@ -116,6 +116,12 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches( if (web_preferences.GetInteger(options::kOpenerID, &opener_id)) command_line->AppendSwitchASCII(switches::kOpenerID, base::IntToString(opener_id)); + + // Enable blink features. + std::string blink_features; + if (web_preferences.GetString(options::kBlinkFeatures, &blink_features)) + command_line->AppendSwitchASCII(::switches::kEnableBlinkFeatures, + blink_features); } // static diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index a62af41e..6c4e8477 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -88,13 +88,16 @@ const char kGuestInstanceID[] = "guestInstanceId"; // Enable DirectWrite on Windows. const char kDirectWrite[] = "directWrite"; -// Opener window's ID. -const char kOpenerID[] = "openerId"; - // Web runtime features. const char kExperimentalFeatures[] = "experimentalFeatures"; const char kExperimentalCanvasFeatures[] = "experimentalCanvasFeatures"; +// Opener window's ID. +const char kOpenerID[] = "openerId"; + +// Enable blink features. +const char kBlinkFeatures[] = "blinkFeatures"; + } // namespace options namespace switches { diff --git a/atom/common/options_switches.h b/atom/common/options_switches.h index ef860b6a..f0385216 100644 --- a/atom/common/options_switches.h +++ b/atom/common/options_switches.h @@ -50,6 +50,7 @@ extern const char kGuestInstanceID[]; extern const char kExperimentalFeatures[]; extern const char kExperimentalCanvasFeatures[]; extern const char kOpenerID[]; +extern const char kBlinkFeatures[]; } // namespace options diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 6dc52576..8511ca7a 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -138,6 +138,10 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. canvas features. Default is `false`. * `directWrite` Boolean - Enables DirectWrite font rendering system on Windows. Default is `true`. + * `blinkFeatures` String - A list of feature strings separated by `,`, like + `CSSVariables,KeyboardEventKey`. The full list of supported feature strings + can be found in the [setFeatureEnabledFromString][blink-feature-string] + function. ## Events @@ -750,3 +754,5 @@ Returns whether the window is visible on all workspaces. * `ignore` Boolean Ignore all moused events that happened in the window. + +[blink-feature-string]: https://code.google.com/p/chromium/codesearch#chromium/src/out/Debug/gen/blink/platform/RuntimeEnabledFeatures.cpp&sq=package:chromium&type=cs&l=527