From b8e64ac40efc0a89fabd0da820a1a8beceaffd16 Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Thu, 14 Apr 2016 22:55:09 +0900 Subject: [PATCH 01/15] :memo: Update Korean docs as upstream [ci skip] --- docs-translations/ko-KR/api/session.md | 3 +++ .../ko-KR/development/coding-style.md | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/docs-translations/ko-KR/api/session.md b/docs-translations/ko-KR/api/session.md index 5bb4867eda0e..36907992a311 100644 --- a/docs-translations/ko-KR/api/session.md +++ b/docs-translations/ko-KR/api/session.md @@ -444,6 +444,9 @@ HTTP 요청을 보내기 전 요청 헤더를 사용할 수 있을 때 `listener * `cancel` Boolean * `responseHeaders` Object (optional) - 이 속성이 제공되면 서버는 이 헤더와 함께 응답합니다. + * `statusLine` String (optional) - `responseHeaders`를 덮어쓸 땐, 헤더의 상태를 + 변경하기 위해 반드시 지정되어야 합니다. 그렇지 않은 경우, 기존의 응답 헤더의 상태가 + 사용됩니다. #### `ses.webRequest.onResponseStarted([filter, ]listener)` diff --git a/docs-translations/ko-KR/development/coding-style.md b/docs-translations/ko-KR/development/coding-style.md index 9c15f677fe29..211eaa4cc0da 100644 --- a/docs-translations/ko-KR/development/coding-style.md +++ b/docs-translations/ko-KR/development/coding-style.md @@ -39,9 +39,19 @@ C++ 코드는 많은 Chromium의 추상화와 타입을 사용합니다. 따라 * [Template literals](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Template_literals) 는 `+`로 문자열을 합치는 대신 사용합니다. -## API 이름 +## 이름 짓기 -새로운 API를 만들 땐 getter, setter스타일 대신 jQuery의 one-function 스타일을 -사용해야 합니다. 예를 들어 `.getText()`와 `.setText(text)`대신에 `.text([text])` -형식으로 설계하면 됩니다. 포럼에 이 문제에 대한 [논의](https://github.com/electron/electron/issues/46)가 +Electron API는 Node.js와 비슷한 명명법을 사용합니다: + +- `BrowserWindow`와 같은 모듈 자체를 뜻하는 이름은, `CamelCase`를 사용합니다. +- `globalShortcut`과 같은 API의 세트일 땐, `mixedCase`를 사용합니다. +- API가 객체의 속성일 경우, 그리고 `win.webContents`와 같이 충분히 복잡하고 분리된 + 부분일 경우, `mixedCase`를 사용합니다. +- 다른 모듈이 아닌 API를 구현할 땐, ` Tag` 또는 `Process Object`와 같이 + 단순하고 자연스러운 제목을 사용합니다. + +새로운 API를 만들 땐 jQuery의 one-function 스타일 대신 getter, setter스타일을 +사용해야 합니다. 예를 들어 `.text([text])` 대신 `.getText()`와 `.setText(text)` +형식으로 함수를 설계하면 됩니다. 포럼에 이 문제에 대한 +[논의](https://github.com/electron/electron/issues/46)가 진행되고 있습니다. From 95a53fc832497a635c0a6f9fad5fbb71901f3c64 Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Thu, 14 Apr 2016 22:56:56 +0900 Subject: [PATCH 02/15] :memo: Small fixes [ci skip] --- docs-translations/ko-KR/development/coding-style.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-translations/ko-KR/development/coding-style.md b/docs-translations/ko-KR/development/coding-style.md index 211eaa4cc0da..ff162575d72c 100644 --- a/docs-translations/ko-KR/development/coding-style.md +++ b/docs-translations/ko-KR/development/coding-style.md @@ -52,6 +52,6 @@ Electron API는 Node.js와 비슷한 명명법을 사용합니다: 새로운 API를 만들 땐 jQuery의 one-function 스타일 대신 getter, setter스타일을 사용해야 합니다. 예를 들어 `.text([text])` 대신 `.getText()`와 `.setText(text)` -형식으로 함수를 설계하면 됩니다. 포럼에 이 문제에 대한 +형식으로 함수를 설계하면 됩니다. 포럼에서 이 문제에 대한 [논의](https://github.com/electron/electron/issues/46)가 진행되고 있습니다. From 4708477f5a733e037c95a7b51b451e708b377f1f Mon Sep 17 00:00:00 2001 From: christoth Date: Thu, 14 Apr 2016 10:29:55 -0400 Subject: [PATCH 03/15] webview: add CSS styling notes Create a new section for CSS and add notes to avoid hiding the webview via hidden or display:none; and provide a recommended approach. --- docs/api/web-view-tag.md | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/docs/api/web-view-tag.md b/docs/api/web-view-tag.md index 8df8d29347c6..cee06dfa35db 100644 --- a/docs/api/web-view-tag.md +++ b/docs/api/web-view-tag.md @@ -20,11 +20,6 @@ control the appearance of the `webview` container: ```html ``` -Please note that the `webview` tag's style uses `display:flex;` internally to -ensure the child `object` element fills the full height and width of its `webview` -container when used with traditional and flexbox layouts (since v0.36.11). Please -do not overwrite the default `display:flex;` CSS property, unless specifying -`display:inline-flex;` for inline layout. If you want to control the guest content in any way, you can write JavaScript that listens for `webview` events and responds to those events using the @@ -50,6 +45,36 @@ and displays a "loading..." message during the load time: ``` +## CSS Styling Notes + +Please note that the `webview` tag's style uses `display:flex;` internally to +ensure the child `object` element fills the full height and width of its `webview` +container when used with traditional and flexbox layouts (since v0.36.11). Please +do not overwrite the default `display:flex;` CSS property, unless specifying +`display:inline-flex;` for inline layout. + +`webview` has issues being hidden using the `hidden` attribute or using `display: none;`. +It can cause unusual rendering behaviour within its child `browserplugin` object +and the web page is reloaded, when the `webview` is un-hidden, as opposed to just +becoming visible again. The recommended approach is to hide the `webview` using +CSS by zeroing the `width` & `height` and allowing the element to shrink to the 0px +dimensions via `flex`. + +```html + +``` + ## Tag Attributes The `webview` tag has the following attributes: From 7b56085a0ac8f2d8190922dfcd2fb951efd66581 Mon Sep 17 00:00:00 2001 From: Daniel Pereira Date: Thu, 14 Apr 2016 10:50:08 -0500 Subject: [PATCH 04/15] Update menu.md There was a missing reference to webContents. --- docs/api/menu.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/menu.md b/docs/api/menu.md index 2c1374fc888c..cb5a0cbe2df8 100644 --- a/docs/api/menu.md +++ b/docs/api/menu.md @@ -109,7 +109,7 @@ var template = [ })(), click: function(item, focusedWindow) { if (focusedWindow) - focusedWindow.toggleDevTools(); + focusedWindow.webContents.toggleDevTools(); } }, ] From a5b93211e6bff7f734564348b229b92d7d6be9a8 Mon Sep 17 00:00:00 2001 From: Felix Rieseberg Date: Tue, 12 Apr 2016 18:09:46 -0700 Subject: [PATCH 05/15] AutoUpdate Windows: Don't spawn if running Previously, the auto updater would run as many squirrel processes as told. This introduces a little change where instead of spawning a second process, we attach to the already running process - or, if different arguments are passed, return and emit an error. This is not failsafe, but it ensures that we don't run into simple race condition crashes. Closes $5097 --- .../api/auto-updater/squirrel-update-win.js | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/lib/browser/api/auto-updater/squirrel-update-win.js b/lib/browser/api/auto-updater/squirrel-update-win.js index da27e02aab65..0910c5f4efbb 100644 --- a/lib/browser/api/auto-updater/squirrel-update-win.js +++ b/lib/browser/api/auto-updater/squirrel-update-win.js @@ -7,17 +7,34 @@ const appFolder = path.dirname(process.execPath) // i.e. my-app/Update.exe const updateExe = path.resolve(appFolder, '..', 'Update.exe') - const exeName = path.basename(process.execPath) +var spawnedArgs = [] +var spawnedProcess + +var isSameArgs = function (args) { + return (args.length === spawnedArgs.length) && args.every(function (e, i) { + return e === spawnedArgs[i] + }) +} // Spawn a command and invoke the callback when it completes with an error // and the output from standard out. var spawnUpdate = function (args, detached, callback) { - var error, errorEmitted, spawnedProcess, stderr, stdout + var error, errorEmitted, stderr, stdout + try { - spawnedProcess = spawn(updateExe, args, { - detached: detached - }) + // Ensure we don't spawn multiple squirrel processes + // Process spawned, same args: Attach events to alread running process + // Process spawned, different args: Return with error + // No process spawned: Spawn new process + if (spawnedProcess && !isSameArgs(args)) { + return callback('AutoUpdater process with arugments ' + args + ' is already running') + } else if (!spawnedProcess) { + spawnedProcess = spawn(updateExe, args, { + detached: detached + }) + spawnedArgs = args || [] + } } catch (error1) { error = error1 @@ -41,6 +58,9 @@ var spawnUpdate = function (args, detached, callback) { return callback(error) }) return spawnedProcess.on('exit', function (code, signal) { + spawnedProcess = undefined + spawnedArgs = [] + // We may have already emitted an error. if (errorEmitted) { return From 1985e1b8e0dafaacc5790a8b14b006edb7ac45dc Mon Sep 17 00:00:00 2001 From: StoneStoneStone Date: Fri, 15 Apr 2016 10:04:01 +0800 Subject: [PATCH 06/15] translation error in browser-window.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 'same-origin policy' means '同源策略' in Chinese --- docs-translations/zh-CN/api/browser-window.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-translations/zh-CN/api/browser-window.md b/docs-translations/zh-CN/api/browser-window.md index 6e486406d63c..aedc5f06a2c9 100644 --- a/docs-translations/zh-CN/api/browser-window.md +++ b/docs-translations/zh-CN/api/browser-window.md @@ -99,7 +99,7 @@ win.show(); * `zoomFactor` Number - 界面默认缩放值, `3.0` 表示 `300%`. 默认 `1.0`. * `javascript` Boolean - 开启javascript支持. 默认为`true`. -* `webSecurity` Boolean - 当设置为 `false`, 它将禁用相同地方的规则 (通常测试服), 并且如果有2个非用户设置的参数,就设置 +* `webSecurity` Boolean - 当设置为 `false`, 它将禁用同源策略 (通常用来测试网站), 并且如果有2个非用户设置的参数,就设置 `allowDisplayingInsecureContent` 和 `allowRunningInsecureContent` 的值为 `true`. 默认为 `true`. * `allowDisplayingInsecureContent` Boolean -允许一个使用 https的界面来展示由 http URLs 传过来的资源. 默认`false`. @@ -758,4 +758,4 @@ windows上句柄类型为 `HWND` ,OS X `NSView*` , Linux `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 \ No newline at end of file +[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 From 38f008884495aeb607b21248fa8950c2a11acd32 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 15 Apr 2016 16:35:51 +0900 Subject: [PATCH 07/15] Update brightray for #4973 --- vendor/brightray | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/brightray b/vendor/brightray index 7b037805e0db..ea38caf127b9 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 7b037805e0dbb5976bdca5808f0ef4c937db1f6e +Subproject commit ea38caf127b9d4e6f22e69ea15d612d15fb1841d From 059ca01767a573cd206e669e96e2ed5ebbd8af57 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 15 Apr 2016 16:47:17 +0900 Subject: [PATCH 08/15] Update brightray for printing fix --- vendor/brightray | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/brightray b/vendor/brightray index ea38caf127b9..79b80e83f4a6 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit ea38caf127b9d4e6f22e69ea15d612d15fb1841d +Subproject commit 79b80e83f4a64790e51ad2fc44b0a56bdb3d7ef3 From aefb67239323da516f6f4b83bbf52fa09ef2404d Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 15 Apr 2016 16:38:16 +0900 Subject: [PATCH 09/15] Bump v0.37.6 --- atom/browser/resources/mac/Info.plist | 4 ++-- atom/browser/resources/win/atom.rc | 8 ++++---- atom/common/atom_version.h | 2 +- electron.gyp | 2 +- package.json | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/atom/browser/resources/mac/Info.plist b/atom/browser/resources/mac/Info.plist index 6cc84e06a902..50522ddda178 100644 --- a/atom/browser/resources/mac/Info.plist +++ b/atom/browser/resources/mac/Info.plist @@ -17,9 +17,9 @@ CFBundleIconFile electron.icns CFBundleVersion - 0.37.5 + 0.37.6 CFBundleShortVersionString - 0.37.5 + 0.37.6 LSApplicationCategoryType public.app-category.developer-tools LSMinimumSystemVersion diff --git a/atom/browser/resources/win/atom.rc b/atom/browser/resources/win/atom.rc index ff4fca047588..473cd151f9ac 100644 --- a/atom/browser/resources/win/atom.rc +++ b/atom/browser/resources/win/atom.rc @@ -56,8 +56,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,37,5,0 - PRODUCTVERSION 0,37,5,0 + FILEVERSION 0,37,6,0 + PRODUCTVERSION 0,37,6,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -74,12 +74,12 @@ BEGIN BEGIN VALUE "CompanyName", "GitHub, Inc." VALUE "FileDescription", "Electron" - VALUE "FileVersion", "0.37.5" + VALUE "FileVersion", "0.37.6" VALUE "InternalName", "electron.exe" VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved." VALUE "OriginalFilename", "electron.exe" VALUE "ProductName", "Electron" - VALUE "ProductVersion", "0.37.5" + VALUE "ProductVersion", "0.37.6" VALUE "SquirrelAwareVersion", "1" END END diff --git a/atom/common/atom_version.h b/atom/common/atom_version.h index 437b97460dca..65921c77581a 100644 --- a/atom/common/atom_version.h +++ b/atom/common/atom_version.h @@ -7,7 +7,7 @@ #define ATOM_MAJOR_VERSION 0 #define ATOM_MINOR_VERSION 37 -#define ATOM_PATCH_VERSION 5 +#define ATOM_PATCH_VERSION 6 #define ATOM_VERSION_IS_RELEASE 1 diff --git a/electron.gyp b/electron.gyp index 94f5e07bfe9e..7a431028f198 100644 --- a/electron.gyp +++ b/electron.gyp @@ -4,7 +4,7 @@ 'product_name%': 'Electron', 'company_name%': 'GitHub, Inc', 'company_abbr%': 'github', - 'version%': '0.37.5', + 'version%': '0.37.6', }, 'includes': [ 'filenames.gypi', diff --git a/package.json b/package.json index 8d9e7564b3d2..d6306b8406ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "0.37.5", + "version": "0.37.6", "devDependencies": { "asar": "^0.11.0", "request": "*", From 132ac20ccf1b121c547d4f4c46f2d243d822cf5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Antonio=20G=C3=B3mez?= Date: Fri, 15 Apr 2016 11:49:08 +0200 Subject: [PATCH 10/15] Correct misspellings Correct misspellings --- .../es/tutorial/application-packaging.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs-translations/es/tutorial/application-packaging.md b/docs-translations/es/tutorial/application-packaging.md index c0cca7ecd916..f8768c49dd02 100644 --- a/docs-translations/es/tutorial/application-packaging.md +++ b/docs-translations/es/tutorial/application-packaging.md @@ -24,8 +24,8 @@ $ asar pack your-app app.asar ## Utilizando los paquetes `asar` -En Electron existen dos tipos de APIs: las APIs de Node, proveídas por Node.js, -y las APIs Web, proveídas por Chromium. Ambas APIs soportan la lecutra de paquetes `asar`. +En Electron existen dos tipos de APIs: las APIs de Node, provistas por Node.js, +y las APIs Web, provistas por Chromium. Ambas APIs soportan la lectura de paquetes `asar`. ### API Node @@ -92,7 +92,7 @@ $.get('file:///path/to/example.asar/file.txt', function(data) { ### Utilizando un paquete `asar` como un archivo normal En algunas situaciones necesitaremos acceder al paquete `asar` como archivo, por ejemplo, -si necesitaramos verificar la integridad del archivo con un checksum. +si necesitáramos verificar la integridad del archivo con un checksum. Para casos así es posible utilizar el módulo `original-fs`, que provee la API `fs` original: ```javascript @@ -127,7 +127,7 @@ Las APIs que requieren el desempaquetamiento adicional son: * `child_process.execFile` * `fs.open` * `fs.openSync` -* `process.dlopen` - Utilizado po `require` en los módulos nativos +* `process.dlopen` - Utilizado por `require` en los módulos nativos ### Información falsa en `fs.stat` @@ -143,8 +143,8 @@ Como se menciona arriba, algunas APIs de Node desempaquetarán archivos cuando e que los referencie, además de los problemas de rendimiento que esto podría ocasionar, también podría accionar alertas falsas en software antivirus. -Para lidiar con esto, puedes desempaquetar algunos archivos utilizando la opción `--unpack`, -a continuación un ejemplo que excluye las librerías compartidas de los módulos nativos: +Para lidiar con esto, puedes desempaquetar algunos archivos utilizando la opción `--unpack`. +A continuación, un ejemplo que excluye las librerías compartidas de los módulos nativos: ```bash $ asar pack app app.asar --unpack *.node From d5124210844a9a85faefc9563c992ddbc2beb7fb Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Sat, 16 Apr 2016 19:58:03 +0200 Subject: [PATCH 11/15] Fix documentation --- docs/api/web-view-tag.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/api/web-view-tag.md b/docs/api/web-view-tag.md index cee06dfa35db..c77d3c690b85 100644 --- a/docs/api/web-view-tag.md +++ b/docs/api/web-view-tag.md @@ -504,6 +504,7 @@ Returns: * `errorCode` Integer * `errorDescription` String * `validatedURL` String +* `isMainFrame` Boolean This event is like `did-finish-load`, but fired when the load failed or was cancelled, e.g. `window.stop()` is invoked. @@ -762,6 +763,10 @@ Emitted when media is paused or done playing. ### Event: 'did-change-theme-color' +Returns: + +* `themeColor` String + Emitted when a page's theme color changes. This is usually due to encountering a meta tag: ```html From 0bf1e561561d87fb1ba9a4af418a1f74306e353a Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 18 Apr 2016 13:59:15 +0900 Subject: [PATCH 12/15] Update brightray for electron/brightray#212 --- atom/browser/api/atom_api_session.cc | 26 +++++++++----------------- atom/browser/api/atom_api_session.h | 3 +++ vendor/brightray | 2 +- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/atom/browser/api/atom_api_session.cc b/atom/browser/api/atom_api_session.cc index 0f104c760724..2b352e52f7c5 100644 --- a/atom/browser/api/atom_api_session.cc +++ b/atom/browser/api/atom_api_session.cc @@ -23,12 +23,13 @@ #include "atom/common/native_mate_converters/net_converter.h" #include "atom/common/node_includes.h" #include "base/files/file_path.h" +#include "base/guid.h" #include "base/prefs/pref_service.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/thread_task_runner_handle.h" #include "brightray/browser/net/devtools_network_conditions.h" -#include "brightray/browser/net/devtools_network_controller.h" +#include "brightray/browser/net/devtools_network_controller_handle.h" #include "chrome/common/pref_names.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/storage_partition.h" @@ -288,7 +289,8 @@ void ClearHostResolverCacheInIO( } // namespace Session::Session(AtomBrowserContext* browser_context) - : browser_context_(browser_context) { + : devtools_network_emulation_client_id_(base::GenerateGUID()), + browser_context_(browser_context) { AttachAsUserData(browser_context); // Observe DownloadManger to get download notifications. @@ -381,25 +383,15 @@ void Session::EnableNetworkEmulation(const mate::Dictionary& options) { download_throughput, upload_throughput)); } - auto controller = browser_context_->GetDevToolsNetworkController(); - BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, - base::Bind(&brightray::DevToolsNetworkController::SetNetworkState, - base::Unretained(controller), - std::string(), - base::Passed(&conditions))); + browser_context_->network_controller_handle()->SetNetworkState( + devtools_network_emulation_client_id_, std::move(conditions)); } void Session::DisableNetworkEmulation() { - scoped_ptr conditions( - new brightray::DevToolsNetworkConditions(false)); - auto controller = browser_context_->GetDevToolsNetworkController(); - - BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, - base::Bind(&brightray::DevToolsNetworkController::SetNetworkState, - base::Unretained(controller), - std::string(), - base::Passed(&conditions))); + scoped_ptr conditions; + browser_context_->network_controller_handle()->SetNetworkState( + devtools_network_emulation_client_id_, std::move(conditions)); } void Session::SetCertVerifyProc(v8::Local val, diff --git a/atom/browser/api/atom_api_session.h b/atom/browser/api/atom_api_session.h index 02d8ba5cdec0..7da01acdaaa6 100644 --- a/atom/browser/api/atom_api_session.h +++ b/atom/browser/api/atom_api_session.h @@ -86,6 +86,9 @@ class Session: public mate::TrackableObject, v8::Global cookies_; v8::Global web_request_; + // The X-DevTools-Emulate-Network-Conditions-Client-Id. + std::string devtools_network_emulation_client_id_; + scoped_refptr browser_context_; DISALLOW_COPY_AND_ASSIGN(Session); diff --git a/vendor/brightray b/vendor/brightray index 79b80e83f4a6..bc9c496a6185 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 79b80e83f4a64790e51ad2fc44b0a56bdb3d7ef3 +Subproject commit bc9c496a6185e37e792c10bfc5b49ea779b27cd3 From 34319abf4a87ed9979bf1de0d868ca1b76a3c257 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 18 Apr 2016 14:52:03 +0900 Subject: [PATCH 13/15] Initialize the embedder_ member data Otherwise it is going to be some random value and bite us. --- atom/browser/api/atom_api_web_contents.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index abad4add4fb0..64a76d57e652 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -217,6 +217,7 @@ content::ServiceWorkerContext* GetServiceWorkerContext( WebContents::WebContents(content::WebContents* web_contents) : content::WebContentsObserver(web_contents), + embedder_(nullptr), type_(REMOTE), request_id_(0), background_throttling_(true) { From 12483486c06ef72a0286f0088b49b80112a805a0 Mon Sep 17 00:00:00 2001 From: Andrew Dassonville Date: Sun, 17 Apr 2016 23:04:02 -0700 Subject: [PATCH 14/15] Update link to setFeatureEnabledFromString --- docs/api/browser-window.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 877a6d0f7457..b1b6cf130f7a 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -912,4 +912,4 @@ Returns whether the window is visible on all workspaces. 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 +[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=576 From 142300aeb9a6939591093bf489b845e6425df1b9 Mon Sep 17 00:00:00 2001 From: StoneStoneStone Date: Mon, 18 Apr 2016 22:38:15 +0800 Subject: [PATCH 15/15] Create frameless-window.md Translate `frameless-window.md` to Chinese. And I'm not sure that the `non-client frame`'s translation is accurate. --- .../zh-CN/api/frameless-window.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 docs-translations/zh-CN/api/frameless-window.md diff --git a/docs-translations/zh-CN/api/frameless-window.md b/docs-translations/zh-CN/api/frameless-window.md new file mode 100644 index 000000000000..1916c6a929bc --- /dev/null +++ b/docs-translations/zh-CN/api/frameless-window.md @@ -0,0 +1,87 @@ +# 无边框窗口 + +无边框窗口指的是不包含除页面本身以外任何其它可视部分的窗口([chrome](https://developer.mozilla.org/en-US/docs/Glossary/Chrome))。 +像工具栏,是窗口的一部分,但并不属于页面。这些是[`BrowserWindow`](browser-window.md) 类的选项。 + +## 创建无边框窗口 + +为了创建一个无边框窗口,你需要设置[BrowserWindow](browser-window.md)的`frame`为`false`: + + + +```javascript +const BrowserWindow = require('electron').BrowserWindow; +var win = new BrowserWindow({ width: 800, height: 600, frame: false }); +``` + +### OS X上的替代方案 + +在Mac OS X 10.10 Yosemite或者更新的版本中,有一个替代方案去生成一个无边框窗口。 +不同于设置`frame`为`false`会隐藏标题栏以及失去对窗口的控制,你可能想隐藏标题栏使你的页面内容显示在整个窗口上 +,同时又想保持对窗口的控制("traffic lights")。你可以通过指定`titleBarStyle`这一新选项达到目标: + +```javascript +var win = new BrowserWindow({ 'titleBarStyle': 'hidden' }); +``` + +## 透明窗口 + +通过设置`transparent` 选项为 `true`,你能使无边框窗口透明: + +```javascript +var win = new BrowserWindow({ transparent: true, frame: false }); +``` + +### 限制 + +* 你无法点击透明的区域。我们正在采用一个新的API去设置窗口的外形以解决这个问题, + 详见[our issue](https://github.com/electron/electron/issues/1335)。 +* 透明窗口是不可调整大小的。在某些平台上,设置`resizable`为`true`也许会造成这个透明窗口停止工作。 +* `blur`滤光器器只适用于网页,所以没法将模糊效果用于窗口之下(i.e. 其它在用户的系统中打开的应用)。 +* 在Windows系统中,当DWM被禁用时透明窗口不会工作。 +* Linux用户需要在命令行中输入`--enable-transparent-visuals --disable-gpu` + 去禁用GPU以及允许ARGB去渲染透明窗口,这是由于一个Linux上的上游bug[alpha channel doesn't work on some + NVidia drivers](https://code.google.com/p/chromium/issues/detail?id=369209)造成的 +* 在Mac上,透明窗口的阴影不会显示出来. + +## 可拖动区域 + +默认情况下,无边框窗口是不可拖动的。应用在CSS中设置`-webkit-app-region: drag` +告诉Electron哪个区域是可拖动的(比如系统标准的标题栏),应用也可以设置`-webkit-app-region: no-drag` +在可拖动区域中排除不可拖动的区域。需要注意的是,目前只支持矩形区域。 + +为了让整个窗口可拖动,你可以在`body`的样式中添加`-webkit-app-region: drag`: + +```html + + +``` + +另外需要注意的是,如果你设置了整个窗口可拖动,你必须标记按钮为不可拖动的(non-draggable), +否则用户不能点击它们: + +```css +button { + -webkit-app-region: no-drag; +} +``` + +如果你设置一个自定义的标题栏可拖动,你同样需要设置标题栏中所有的按钮为不可拖动(non-draggable)。 + +## 文本选择 + +在一个无边框窗口中,拖动动作会与文本选择发生冲突。比如,当你拖动标题栏,偶尔会选中标题栏上的文本。 +为了防止这种情况发生,你需要向下面这样在一个可拖动区域中禁用文本选择: + +```css +.titlebar { + -webkit-user-select: none; + -webkit-app-region: drag; +} +``` + +## 上下文菜单 + +在一些平台上,可拖动区域会被认为是非客户端框架(non-client frame),所有当你点击右键时,一个系统菜单会弹出。 +为了保证上下文菜单在所有平台下正确的显示,你不应该在可拖动区域使用自定义上下文菜单。 +