mirror of
https://github.com/electron/electron.git
synced 2026-02-26 03:01:17 -05:00
Compare commits
48 Commits
v11.0.0-be
...
v11.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
101a2282ab | ||
|
|
429400040e | ||
|
|
ca7528a2d0 | ||
|
|
d58812b517 | ||
|
|
5942c84288 | ||
|
|
f920463b47 | ||
|
|
296cba563e | ||
|
|
90a96c0b73 | ||
|
|
2c325cd654 | ||
|
|
c26b78bbc0 | ||
|
|
6951c09b61 | ||
|
|
fe21892974 | ||
|
|
0fd6a8ca83 | ||
|
|
de12232df5 | ||
|
|
d12674f9f1 | ||
|
|
75cdd02697 | ||
|
|
08b7f5a569 | ||
|
|
a5077e2586 | ||
|
|
4fa9122151 | ||
|
|
56fa037a46 | ||
|
|
13a9e15a27 | ||
|
|
badc01c2d8 | ||
|
|
b0862a6e63 | ||
|
|
18cde2ef04 | ||
|
|
e6c94854a0 | ||
|
|
94d8b7d4c1 | ||
|
|
c0769d77e5 | ||
|
|
2a6c3bb7d1 | ||
|
|
d892fde98b | ||
|
|
edb6723157 | ||
|
|
9dda9a894a | ||
|
|
90ab868b50 | ||
|
|
4dc98f1347 | ||
|
|
2189ddb14e | ||
|
|
680569e404 | ||
|
|
e119699ae2 | ||
|
|
63e6f08768 | ||
|
|
b14c57e30c | ||
|
|
8a68a304e0 | ||
|
|
60cef385d5 | ||
|
|
4f281e3d31 | ||
|
|
eb2710e483 | ||
|
|
7a15dca09c | ||
|
|
387a15f582 | ||
|
|
38fab63863 | ||
|
|
1b156c53fd | ||
|
|
e4f3f9e1db | ||
|
|
612acc04b0 |
@@ -311,10 +311,10 @@ step-setup-goma-for-build: &step-setup-goma-for-build
|
||||
name: Setup Goma
|
||||
command: |
|
||||
echo 'export USE_GOMA=true' >> $BASH_ENV
|
||||
if [ "`uname`" == "Linux" ]; then
|
||||
echo 'export NUMBER_OF_NINJA_PROCESSES=300' >> $BASH_ENV
|
||||
else
|
||||
echo 'export NUMBER_OF_NINJA_PROCESSES=25' >> $BASH_ENV
|
||||
echo 'export NUMBER_OF_NINJA_PROCESSES=300' >> $BASH_ENV
|
||||
if [ "`uname`" == "Darwin" ]; then
|
||||
echo 'ulimit -n 10000' >> $BASH_ENV
|
||||
echo 'sudo launchctl limit maxfiles 65536 200000' >> $BASH_ENV
|
||||
fi
|
||||
if [ ! -z "$RAW_GOMA_AUTH" ]; then
|
||||
echo $RAW_GOMA_AUTH > ~/.goma_oauth2_config
|
||||
@@ -323,7 +323,7 @@ step-setup-goma-for-build: &step-setup-goma-for-build
|
||||
cd build-tools
|
||||
npm install
|
||||
mkdir third_party
|
||||
node -e "require('./src/utils/goma.js').downloadAndPrepare()"
|
||||
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
|
||||
node -e "require('./src/utils/goma.js').ensure()"
|
||||
echo 'export GN_GOMA_FILE='`node -e "console.log(require('./src/utils/goma.js').gnFilePath)"` >> $BASH_ENV
|
||||
echo 'export LOCAL_GOMA_DIR='`node -e "console.log(require('./src/utils/goma.js').dir)"` >> $BASH_ENV
|
||||
|
||||
2
DEPS
2
DEPS
@@ -14,7 +14,7 @@ gclient_gn_args = [
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'87.0.4280.47',
|
||||
'87.0.4280.88',
|
||||
'node_version':
|
||||
'v12.18.3',
|
||||
'nan_version':
|
||||
|
||||
@@ -1 +1 @@
|
||||
11.0.0-beta.23
|
||||
11.1.0
|
||||
@@ -143,7 +143,7 @@ build_script:
|
||||
cd build-tools
|
||||
npm install
|
||||
mkdir third_party
|
||||
node -e "require('./src/utils/goma.js').downloadAndPrepare()"
|
||||
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
|
||||
$env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
|
||||
$env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
|
||||
cd ..
|
||||
|
||||
@@ -277,13 +277,15 @@ static_library("chrome") {
|
||||
}
|
||||
}
|
||||
|
||||
sources += [ "//chrome/browser/hang_monitor/hang_crash_dump.h" ]
|
||||
if (is_mac) {
|
||||
sources += [ "//chrome/browser/hang_monitor/hang_crash_dump_mac.cc" ]
|
||||
} else if (is_win) {
|
||||
sources += [ "//chrome/browser/hang_monitor/hang_crash_dump_win.cc" ]
|
||||
} else {
|
||||
sources += [ "//chrome/browser/hang_monitor/hang_crash_dump.cc" ]
|
||||
if (!is_mas_build) {
|
||||
sources += [ "//chrome/browser/hang_monitor/hang_crash_dump.h" ]
|
||||
if (is_mac) {
|
||||
sources += [ "//chrome/browser/hang_monitor/hang_crash_dump_mac.cc" ]
|
||||
} else if (is_win) {
|
||||
sources += [ "//chrome/browser/hang_monitor/hang_crash_dump_win.cc" ]
|
||||
} else {
|
||||
sources += [ "//chrome/browser/hang_monitor/hang_crash_dump.cc" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ const { app, contentTracing } = require('electron')
|
||||
app.whenReady().then(() => {
|
||||
(async () => {
|
||||
await contentTracing.startRecording({
|
||||
include_categories: ['*']
|
||||
included_categories: ['*']
|
||||
})
|
||||
console.log('Tracing started')
|
||||
await new Promise(resolve => setTimeout(resolve, 5000))
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# IpcMainEvent Object extends `Event`
|
||||
|
||||
* `processId` Integer - The internal ID of the renderer process that sent this message
|
||||
* `frameId` Integer - The ID of the renderer frame that sent this message
|
||||
* `returnValue` any - Set this to the value to be returned in a synchronous message
|
||||
* `sender` WebContents - Returns the `webContents` that sent the message
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# IpcMainInvokeEvent Object extends `Event`
|
||||
|
||||
* `processId` Integer - The internal ID of the renderer process that sent this message
|
||||
* `frameId` Integer - The ID of the renderer frame that sent this message
|
||||
* `sender` WebContents - Returns the `webContents` that sent the message
|
||||
|
||||
@@ -42,7 +42,8 @@ returns `null`.
|
||||
|
||||
* `id` Integer
|
||||
|
||||
Returns `WebContents` - A WebContents instance with the given ID.
|
||||
Returns `WebContents` | undefined - A WebContents instance with the given ID, or
|
||||
`undefined` if there is no WebContents associated with the given ID.
|
||||
|
||||
## Class: WebContents
|
||||
|
||||
@@ -1621,7 +1622,7 @@ app.whenReady().then(() => {
|
||||
|
||||
#### `contents.sendToFrame(frameId, channel, ...args)`
|
||||
|
||||
* `frameId` Integer
|
||||
* `frameId` Integer | [number, number]
|
||||
* `channel` String
|
||||
* `...args` any[]
|
||||
|
||||
|
||||
@@ -195,6 +195,45 @@ you should plan to update your native modules to be context aware.
|
||||
|
||||
For more detailed information see [#18397](https://github.com/electron/electron/issues/18397).
|
||||
|
||||
### Deprecated: `BrowserWindow` extension APIs
|
||||
|
||||
The following extension APIs have been deprecated:
|
||||
* `BrowserWindow.addExtension(path)`
|
||||
* `BrowserWindow.addDevToolsExtension(path)`
|
||||
* `BrowserWindow.removeExtension(name)`
|
||||
* `BrowserWindow.removeDevToolsExtension(name)`
|
||||
* `BrowserWindow.getExtensions()`
|
||||
* `BrowserWindow.getDevToolsExtensions()`
|
||||
|
||||
Use the session APIs instead:
|
||||
* `ses.loadExtension(path)`
|
||||
* `ses.removeExtension(extension_id)`
|
||||
* `ses.getAllExtensions()`
|
||||
|
||||
```js
|
||||
// Deprecated in Electron 9
|
||||
BrowserWindow.addExtension(path)
|
||||
BrowserWindow.addDevToolsExtension(path)
|
||||
// Replace with
|
||||
session.defaultSession.loadExtension(path)
|
||||
```
|
||||
|
||||
```js
|
||||
// Deprecated in Electron 9
|
||||
BrowserWindow.removeExtension(name)
|
||||
BrowserWindow.removeDevToolsExtension(name)
|
||||
// Replace with
|
||||
session.defaultSession.removeExtension(extension_id)
|
||||
```
|
||||
|
||||
```js
|
||||
// Deprecated in Electron 9
|
||||
BrowserWindow.getExtensions()
|
||||
BrowserWindow.getDevToolsExtensions()
|
||||
// Replace with
|
||||
session.defaultSession.getAllExtensions()
|
||||
```
|
||||
|
||||
### Removed: `<webview>.getWebContents()`
|
||||
|
||||
This API, which was deprecated in Electron 8.0, is now removed.
|
||||
@@ -338,6 +377,52 @@ in Electron 8.x, and cease to exist in Electron 9.x. The layout zoom level
|
||||
limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined
|
||||
[here](https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11).
|
||||
|
||||
### Deprecated events in `systemPreferences`
|
||||
|
||||
The following `systemPreferences` events have been deprecated:
|
||||
* `inverted-color-scheme-changed`
|
||||
* `high-contrast-color-scheme-changed`
|
||||
|
||||
Use the new `updated` event on the `nativeTheme` module instead.
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
systemPreferences.on('inverted-color-scheme-changed', () => { /* ... */ })
|
||||
systemPreferences.on('high-contrast-color-scheme-changed', () => { /* ... */ })
|
||||
|
||||
// Replace with
|
||||
nativeTheme.on('updated', () => { /* ... */ })
|
||||
```
|
||||
|
||||
### Deprecated: methods in `systemPreferences`
|
||||
|
||||
The following `systemPreferences` methods have been deprecated:
|
||||
* `systemPreferences.isDarkMode()`
|
||||
* `systemPreferences.isInvertedColorScheme()`
|
||||
* `systemPreferences.isHighContrastColorScheme()`
|
||||
|
||||
Use the following `nativeTheme` properties instead:
|
||||
* `nativeTheme.shouldUseDarkColors`
|
||||
* `nativeTheme.shouldUseInvertedColorScheme`
|
||||
* `nativeTheme.shouldUseHighContrastColors`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
systemPreferences.isDarkMode()
|
||||
// Replace with
|
||||
nativeTheme.shouldUseDarkColors
|
||||
|
||||
// Deprecated
|
||||
systemPreferences.isInvertedColorScheme()
|
||||
// Replace with
|
||||
nativeTheme.shouldUseInvertedColorScheme
|
||||
|
||||
// Deprecated
|
||||
systemPreferences.isHighContrastColorScheme()
|
||||
// Replace with
|
||||
nativeTheme.shouldUseHighContrastColors
|
||||
```
|
||||
|
||||
## Planned Breaking API Changes (7.0)
|
||||
|
||||
### Deprecated: Atom.io Node Headers URL
|
||||
|
||||
18
docs/fiddles/features/drag-and-drop/index.html
Normal file
18
docs/fiddles/features/drag-and-drop/index.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<p>
|
||||
We are using node <script>document.write(process.versions.node)</script>,
|
||||
Chrome <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
</p>
|
||||
<a href="#" id="drag">Drag me</a>
|
||||
<script src="renderer.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
41
docs/fiddles/features/drag-and-drop/main.js
Normal file
41
docs/fiddles/features/drag-and-drop/main.js
Normal file
@@ -0,0 +1,41 @@
|
||||
const { app, BrowserWindow, ipcMain, nativeImage, NativeImage } = require('electron')
|
||||
const fs = require('fs');
|
||||
const http = require('http');
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
nodeIntegration: true
|
||||
}
|
||||
})
|
||||
|
||||
win.loadFile('index.html')
|
||||
}
|
||||
const iconName = 'iconForDragAndDrop.png';
|
||||
const icon = fs.createWriteStream(`${process.cwd()}/${iconName}`);
|
||||
http.get('http://img.icons8.com/ios/452/drag-and-drop.png', (response) => {
|
||||
response.pipe(icon);
|
||||
});
|
||||
|
||||
app.whenReady().then(createWindow)
|
||||
|
||||
ipcMain.on('ondragstart', (event, filePath) => {
|
||||
event.sender.startDrag({
|
||||
file: filePath,
|
||||
icon: `${process.cwd()}/${iconName}`
|
||||
})
|
||||
})
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
9
docs/fiddles/features/drag-and-drop/renderer.js
Normal file
9
docs/fiddles/features/drag-and-drop/renderer.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const { ipcRenderer } = require('electron')
|
||||
const fs = require('fs')
|
||||
|
||||
document.getElementById('drag').ondragstart = (event) => {
|
||||
const fileName = 'drag-and-drop.md'
|
||||
fs.writeFileSync(fileName, '# Test drag and drop');
|
||||
event.preventDefault()
|
||||
ipcRenderer.send('ondragstart', process.cwd() + `/${fileName}`)
|
||||
}
|
||||
16
docs/fiddles/features/keyboard-shortcuts/global/index.html
Normal file
16
docs/fiddles/features/keyboard-shortcuts/global/index.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<p>
|
||||
We are using node <script>document.write(process.versions.node)</script>,
|
||||
Chrome <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
31
docs/fiddles/features/keyboard-shortcuts/global/main.js
Normal file
31
docs/fiddles/features/keyboard-shortcuts/global/main.js
Normal file
@@ -0,0 +1,31 @@
|
||||
const { app, BrowserWindow, globalShortcut } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
nodeIntegration: true
|
||||
}
|
||||
})
|
||||
|
||||
win.loadFile('index.html')
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
globalShortcut.register('Alt+CommandOrControl+I', () => {
|
||||
console.log('Electron loves global shortcuts!')
|
||||
})
|
||||
}).then(createWindow)
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
We are using node <script>document.write(process.versions.node)</script>,
|
||||
Chrome <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,13 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
const win = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true } })
|
||||
|
||||
win.loadFile('index.html')
|
||||
win.webContents.on('before-input-event', (event, input) => {
|
||||
if (input.control && input.key.toLowerCase() === 'i') {
|
||||
console.log('Pressed Control+I')
|
||||
event.preventDefault()
|
||||
}
|
||||
})
|
||||
})
|
||||
16
docs/fiddles/features/keyboard-shortcuts/local/index.html
Normal file
16
docs/fiddles/features/keyboard-shortcuts/local/index.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<p>
|
||||
We are using node <script>document.write(process.versions.node)</script>,
|
||||
Chrome <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
39
docs/fiddles/features/keyboard-shortcuts/local/main.js
Normal file
39
docs/fiddles/features/keyboard-shortcuts/local/main.js
Normal file
@@ -0,0 +1,39 @@
|
||||
const { app, BrowserWindow, Menu, MenuItem } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
nodeIntegration: true
|
||||
}
|
||||
})
|
||||
|
||||
win.loadFile('index.html')
|
||||
}
|
||||
|
||||
const menu = new Menu()
|
||||
menu.append(new MenuItem({
|
||||
label: 'Electron',
|
||||
submenu: [{
|
||||
role: 'help',
|
||||
accelerator: process.platform === 'darwin' ? 'Alt+Cmd+I' : 'Alt+Shift+I',
|
||||
click: () => { console.log('Electron rocks!') }
|
||||
}]
|
||||
}))
|
||||
|
||||
Menu.setApplicationMenu(menu)
|
||||
|
||||
app.whenReady().then(createWindow)
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
19
docs/fiddles/features/macos-dark-mode/index.html
Normal file
19
docs/fiddles/features/macos-dark-mode/index.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
<link rel="stylesheet" type="text/css" href="./styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<p>Current theme source: <strong id="theme-source">System</strong></p>
|
||||
|
||||
<button id="toggle-dark-mode">Toggle Dark Mode</button>
|
||||
<button id="reset-to-system">Reset to System Theme</button>
|
||||
|
||||
<script src="renderer.js"></script>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
40
docs/fiddles/features/macos-dark-mode/main.js
Normal file
40
docs/fiddles/features/macos-dark-mode/main.js
Normal file
@@ -0,0 +1,40 @@
|
||||
const { app, BrowserWindow, ipcMain, nativeTheme } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
nodeIntegration: true
|
||||
}
|
||||
})
|
||||
|
||||
win.loadFile('index.html')
|
||||
|
||||
ipcMain.handle('dark-mode:toggle', () => {
|
||||
if (nativeTheme.shouldUseDarkColors) {
|
||||
nativeTheme.themeSource = 'light'
|
||||
} else {
|
||||
nativeTheme.themeSource = 'dark'
|
||||
}
|
||||
return nativeTheme.shouldUseDarkColors
|
||||
})
|
||||
|
||||
ipcMain.handle('dark-mode:system', () => {
|
||||
nativeTheme.themeSouce = 'system'
|
||||
})
|
||||
}
|
||||
|
||||
app.whenReady().then(createWindow)
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
11
docs/fiddles/features/macos-dark-mode/renderer.js
Normal file
11
docs/fiddles/features/macos-dark-mode/renderer.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const { ipcRenderer } = require('electron')
|
||||
|
||||
document.getElementById('toggle-dark-mode').addEventListener('click', async () => {
|
||||
const isDarkMode = await ipcRenderer.invoke('dark-mode:toggle')
|
||||
document.getElementById('theme-source').innerHTML = isDarkMode ? 'Dark' : 'Light'
|
||||
})
|
||||
|
||||
document.getElementById('reset-to-system').addEventListener('click', async () => {
|
||||
await ipcRenderer.invoke('dark-mode:system')
|
||||
document.getElementById('theme-source').innerHTML = 'System'
|
||||
})
|
||||
7
docs/fiddles/features/macos-dark-mode/styles.css
Normal file
7
docs/fiddles/features/macos-dark-mode/styles.css
Normal file
@@ -0,0 +1,7 @@
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body { background: #333; color: white; }
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
body { background: #ddd; color: black; }
|
||||
}
|
||||
16
docs/fiddles/features/macos-dock-menu/index.html
Normal file
16
docs/fiddles/features/macos-dock-menu/index.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<p>
|
||||
We are using node <script>document.write(process.versions.node)</script>,
|
||||
Chrome <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
43
docs/fiddles/features/macos-dock-menu/main.js
Normal file
43
docs/fiddles/features/macos-dock-menu/main.js
Normal file
@@ -0,0 +1,43 @@
|
||||
const { app, BrowserWindow, Menu } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
nodeIntegration: true
|
||||
}
|
||||
})
|
||||
|
||||
win.loadFile('index.html')
|
||||
}
|
||||
|
||||
const dockMenu = Menu.buildFromTemplate([
|
||||
{
|
||||
label: 'New Window',
|
||||
click () { console.log('New Window') }
|
||||
}, {
|
||||
label: 'New Window with Settings',
|
||||
submenu: [
|
||||
{ label: 'Basic' },
|
||||
{ label: 'Pro' }
|
||||
]
|
||||
},
|
||||
{ label: 'New Command...' }
|
||||
])
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.dock.setMenu(dockMenu)
|
||||
}).then(createWindow)
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
16
docs/fiddles/features/notifications/main/index.html
Normal file
16
docs/fiddles/features/notifications/main/index.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<p>
|
||||
We are using node <script>document.write(process.versions.node)</script>,
|
||||
Chrome <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
35
docs/fiddles/features/notifications/main/main.js
Normal file
35
docs/fiddles/features/notifications/main/main.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const { app, BrowserWindow, Notification } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
nodeIntegration: true
|
||||
}
|
||||
})
|
||||
|
||||
win.loadFile('index.html')
|
||||
}
|
||||
|
||||
function showNotification () {
|
||||
const notification = {
|
||||
title: 'Basic Notification',
|
||||
body: 'Notification from the Main process'
|
||||
}
|
||||
new Notification(notification).show()
|
||||
}
|
||||
|
||||
app.whenReady().then(createWindow).then(showNotification)
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
17
docs/fiddles/features/notifications/renderer/index.html
Normal file
17
docs/fiddles/features/notifications/renderer/index.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<p>
|
||||
We are using node <script>document.write(process.versions.node)</script>,
|
||||
Chrome <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
</p>
|
||||
<script src="renderer.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
27
docs/fiddles/features/notifications/renderer/main.js
Normal file
27
docs/fiddles/features/notifications/renderer/main.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
nodeIntegration: true
|
||||
}
|
||||
})
|
||||
|
||||
win.loadFile('index.html')
|
||||
}
|
||||
|
||||
app.whenReady().then(createWindow)
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
7
docs/fiddles/features/notifications/renderer/renderer.js
Normal file
7
docs/fiddles/features/notifications/renderer/renderer.js
Normal file
@@ -0,0 +1,7 @@
|
||||
const myNotification = new Notification('Title', {
|
||||
body: 'Notification from the Renderer process'
|
||||
})
|
||||
|
||||
myNotification.onclick = () => {
|
||||
console.log('Notification clicked')
|
||||
}
|
||||
15
docs/fiddles/features/offscreen-rendering/index.html
Normal file
15
docs/fiddles/features/offscreen-rendering/index.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<p>
|
||||
We are using node <script>document.write(process.versions.node)</script>,
|
||||
Chrome <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
28
docs/fiddles/features/offscreen-rendering/main.js
Normal file
28
docs/fiddles/features/offscreen-rendering/main.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
const fs = require('fs')
|
||||
|
||||
app.disableHardwareAcceleration()
|
||||
|
||||
let win
|
||||
|
||||
app.whenReady().then(() => {
|
||||
win = new BrowserWindow({ webPreferences: { offscreen: true } })
|
||||
win.loadURL('https://github.com')
|
||||
win.webContents.on('paint', (event, dirty, image) => {
|
||||
fs.writeFileSync('ex.png', image.toPNG())
|
||||
})
|
||||
win.webContents.setFrameRate(60)
|
||||
console.log(`The screenshot has been successfully saved to ${process.cwd()}/ex.png`)
|
||||
})
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
17
docs/fiddles/features/online-detection/main/index.html
Normal file
17
docs/fiddles/features/online-detection/main/index.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<p>
|
||||
We are using node <script>document.write(process.versions.node)</script>,
|
||||
Chrome <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
</p>
|
||||
<script src="renderer.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
24
docs/fiddles/features/online-detection/main/main.js
Normal file
24
docs/fiddles/features/online-detection/main/main.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const { app, BrowserWindow, ipcMain } = require('electron')
|
||||
|
||||
let onlineStatusWindow
|
||||
|
||||
app.whenReady().then(() => {
|
||||
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false, webPreferences: { nodeIntegration: true } })
|
||||
onlineStatusWindow.loadURL(`file://${__dirname}/index.html`)
|
||||
})
|
||||
|
||||
ipcMain.on('online-status-changed', (event, status) => {
|
||||
console.log(status)
|
||||
})
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
7
docs/fiddles/features/online-detection/main/renderer.js
Normal file
7
docs/fiddles/features/online-detection/main/renderer.js
Normal file
@@ -0,0 +1,7 @@
|
||||
const { ipcRenderer } = require('electron')
|
||||
const updateOnlineStatus = () => { ipcRenderer.send('online-status-changed', navigator.onLine ? 'online' : 'offline') }
|
||||
|
||||
window.addEventListener('online', updateOnlineStatus)
|
||||
window.addEventListener('offline', updateOnlineStatus)
|
||||
|
||||
updateOnlineStatus()
|
||||
17
docs/fiddles/features/online-detection/renderer/index.html
Normal file
17
docs/fiddles/features/online-detection/renderer/index.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<p>
|
||||
We are using node <script>document.write(process.versions.node)</script>,
|
||||
Chrome <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
</p>
|
||||
<script src="renderer.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
20
docs/fiddles/features/online-detection/renderer/main.js
Normal file
20
docs/fiddles/features/online-detection/renderer/main.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
let onlineStatusWindow
|
||||
|
||||
app.whenReady().then(() => {
|
||||
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false })
|
||||
onlineStatusWindow.loadURL(`file://${__dirname}/index.html`)
|
||||
})
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
const alertOnlineStatus = () => { window.alert(navigator.onLine ? 'online' : 'offline') }
|
||||
|
||||
window.addEventListener('online', alertOnlineStatus)
|
||||
window.addEventListener('offline', alertOnlineStatus)
|
||||
|
||||
alertOnlineStatus()
|
||||
16
docs/fiddles/features/progress-bar/index.html
Normal file
16
docs/fiddles/features/progress-bar/index.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<p>
|
||||
We are using node <script>document.write(process.versions.node)</script>,
|
||||
Chrome <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
30
docs/fiddles/features/progress-bar/main.js
Normal file
30
docs/fiddles/features/progress-bar/main.js
Normal file
@@ -0,0 +1,30 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
nodeIntegration: true
|
||||
}
|
||||
})
|
||||
|
||||
win.loadFile('index.html')
|
||||
win.setProgressBar(0.5)
|
||||
}
|
||||
|
||||
|
||||
app.whenReady().then(createWindow)
|
||||
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
16
docs/fiddles/features/recent-documents/index.html
Normal file
16
docs/fiddles/features/recent-documents/index.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<p>
|
||||
We are using node <script>document.write(process.versions.node)</script>,
|
||||
Chrome <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
34
docs/fiddles/features/recent-documents/main.js
Normal file
34
docs/fiddles/features/recent-documents/main.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
nodeIntegration: true
|
||||
}
|
||||
})
|
||||
|
||||
win.loadFile('index.html')
|
||||
}
|
||||
const fileName = 'recently-used.md'
|
||||
fs.writeFile(fileName, 'Lorem Ipsum', () => {
|
||||
app.addRecentDocument(path.join(process.cwd(), `${fileName}`))
|
||||
})
|
||||
|
||||
app.whenReady().then(createWindow)
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
app.clearRecentDocuments()
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
16
docs/fiddles/features/represented-file/index.html
Normal file
16
docs/fiddles/features/represented-file/index.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<p>
|
||||
We are using node <script>document.write(process.versions.node)</script>,
|
||||
Chrome <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
33
docs/fiddles/features/represented-file/main.js
Normal file
33
docs/fiddles/features/represented-file/main.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
const os = require('os');
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
nodeIntegration: true
|
||||
}
|
||||
})
|
||||
|
||||
win.loadFile('index.html')
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
const win = new BrowserWindow()
|
||||
|
||||
win.setRepresentedFilename(os.homedir())
|
||||
win.setDocumentEdited(true)
|
||||
})
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
16
docs/fiddles/quick-start/index.html
Normal file
16
docs/fiddles/quick-start/index.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<p>
|
||||
We are using node <script>document.write(process.versions.node)</script>,
|
||||
Chrome <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
27
docs/fiddles/quick-start/main.js
Normal file
27
docs/fiddles/quick-start/main.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
nodeIntegration: true
|
||||
}
|
||||
})
|
||||
|
||||
win.loadFile('index.html')
|
||||
}
|
||||
|
||||
app.whenReady().then(createWindow)
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
@@ -686,7 +686,8 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
if (info.size === 0) return ['', false];
|
||||
if (info.unpacked) {
|
||||
const realPath = archive.copyFileOut(filePath);
|
||||
return fs.readFileSync(realPath, { encoding: 'utf8' });
|
||||
const str = fs.readFileSync(realPath, { encoding: 'utf8' });
|
||||
return [str, str.length > 0];
|
||||
}
|
||||
|
||||
logASARAccess(asarPath, filePath, info.offset);
|
||||
|
||||
@@ -2,19 +2,39 @@ const { createScreen } = process._linkedBinding('electron_common_screen');
|
||||
|
||||
let _screen: Electron.Screen;
|
||||
|
||||
const createScreenIfNeeded = () => {
|
||||
if (_screen === undefined) {
|
||||
_screen = createScreen();
|
||||
}
|
||||
};
|
||||
|
||||
// We can't call createScreen until after app.on('ready'), but this module
|
||||
// exposes an instance created by createScreen. In order to avoid
|
||||
// side-effecting and calling createScreen upon import of this module, instead
|
||||
// we export a proxy which lazily calls createScreen on first access.
|
||||
export default new Proxy({}, {
|
||||
get: (target, prop) => {
|
||||
if (_screen === undefined) {
|
||||
_screen = createScreen();
|
||||
get: (target, property: keyof Electron.Screen) => {
|
||||
createScreenIfNeeded();
|
||||
const value = _screen[property];
|
||||
if (typeof value === 'function') {
|
||||
return value.bind(_screen);
|
||||
}
|
||||
const v = (_screen as any)[prop];
|
||||
if (typeof v === 'function') {
|
||||
return v.bind(_screen);
|
||||
}
|
||||
return v;
|
||||
return value;
|
||||
},
|
||||
set: (target, property: string, value: unknown) => {
|
||||
createScreenIfNeeded();
|
||||
return Reflect.set(_screen, property, value);
|
||||
},
|
||||
ownKeys: () => {
|
||||
createScreenIfNeeded();
|
||||
return Reflect.ownKeys(_screen);
|
||||
},
|
||||
has: (target, property: string) => {
|
||||
createScreenIfNeeded();
|
||||
return property in _screen;
|
||||
},
|
||||
getOwnPropertyDescriptor: (target, property: string) => {
|
||||
createScreenIfNeeded();
|
||||
return Reflect.getOwnPropertyDescriptor(_screen, property);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ if ('getAppLevelAppearance' in systemPreferences) {
|
||||
}
|
||||
|
||||
if ('getEffectiveAppearance' in systemPreferences) {
|
||||
const nativeEAGetter = systemPreferences.getAppLevelAppearance;
|
||||
const nativeEAGetter = systemPreferences.getEffectiveAppearance;
|
||||
Object.defineProperty(systemPreferences, 'effectiveAppearance', {
|
||||
get: () => nativeEAGetter.call(systemPreferences)
|
||||
});
|
||||
|
||||
@@ -161,29 +161,29 @@ WebContents.prototype._sendInternalToAll = function (channel, ...args) {
|
||||
|
||||
return this._send(internal, sendToAll, channel, args);
|
||||
};
|
||||
WebContents.prototype.sendToFrame = function (frameId, channel, ...args) {
|
||||
WebContents.prototype.sendToFrame = function (frame, channel, ...args) {
|
||||
if (typeof channel !== 'string') {
|
||||
throw new Error('Missing required channel argument');
|
||||
} else if (typeof frameId !== 'number') {
|
||||
throw new Error('Missing required frameId argument');
|
||||
} else if (!(typeof frame === 'number' || Array.isArray(frame))) {
|
||||
throw new Error('Missing required frame argument (must be number or array)');
|
||||
}
|
||||
|
||||
const internal = false;
|
||||
const sendToAll = false;
|
||||
|
||||
return this._sendToFrame(internal, sendToAll, frameId, channel, args);
|
||||
return this._sendToFrame(internal, sendToAll, frame, channel, args);
|
||||
};
|
||||
WebContents.prototype._sendToFrameInternal = function (frameId, channel, ...args) {
|
||||
WebContents.prototype._sendToFrameInternal = function (frame, channel, ...args) {
|
||||
if (typeof channel !== 'string') {
|
||||
throw new Error('Missing required channel argument');
|
||||
} else if (typeof frameId !== 'number') {
|
||||
throw new Error('Missing required frameId argument');
|
||||
} else if (!(typeof frame === 'number' || Array.isArray(frame))) {
|
||||
throw new Error('Missing required frame argument (must be number or array)');
|
||||
}
|
||||
|
||||
const internal = true;
|
||||
const sendToAll = false;
|
||||
|
||||
return this._sendToFrame(internal, sendToAll, frameId, channel, args);
|
||||
return this._sendToFrame(internal, sendToAll, frame, channel, args);
|
||||
};
|
||||
|
||||
// Following methods are mapped to webFrame.
|
||||
@@ -439,8 +439,9 @@ WebContents.prototype.loadFile = function (filePath, options = {}) {
|
||||
};
|
||||
|
||||
const addReplyToEvent = (event: any) => {
|
||||
const { processId, frameId } = event;
|
||||
event.reply = (...args: any[]) => {
|
||||
event.sender.sendToFrame(event.frameId, ...args);
|
||||
event.sender.sendToFrame([processId, frameId], ...args);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ const FUNCTION_PROPERTIES = [
|
||||
];
|
||||
|
||||
type RendererFunctionId = [string, number] // [contextId, funcId]
|
||||
type FinalizerInfo = { id: RendererFunctionId, webContents: electron.WebContents, frameId: number };
|
||||
type FinalizerInfo = { id: RendererFunctionId, webContents: electron.WebContents, frameId: [number, number] };
|
||||
type WeakRef<T> = { deref(): T | undefined }
|
||||
type CallIntoRenderer = (...args: any[]) => void
|
||||
|
||||
@@ -31,7 +31,7 @@ const finalizationRegistry = new (globalThis as any).FinalizationRegistry((fi: F
|
||||
const ref = rendererFunctionCache.get(mapKey);
|
||||
if (ref !== undefined && ref.deref() === undefined) {
|
||||
rendererFunctionCache.delete(mapKey);
|
||||
if (!fi.webContents.isDestroyed()) { fi.webContents.sendToFrame(fi.frameId, 'ELECTRON_RENDERER_RELEASE_CALLBACK', fi.id[0], fi.id[1]); }
|
||||
if (!fi.webContents.isDestroyed()) { fi.webContents._sendToFrameInternal(fi.frameId, 'ELECTRON_RENDERER_RELEASE_CALLBACK', fi.id[0], fi.id[1]); }
|
||||
}
|
||||
});
|
||||
|
||||
@@ -43,7 +43,7 @@ function getCachedRendererFunction (id: RendererFunctionId): CallIntoRenderer |
|
||||
if (deref !== undefined) return deref;
|
||||
}
|
||||
}
|
||||
function setCachedRendererFunction (id: RendererFunctionId, wc: electron.WebContents, frameId: number, value: CallIntoRenderer) {
|
||||
function setCachedRendererFunction (id: RendererFunctionId, wc: electron.WebContents, frameId: [number, number], value: CallIntoRenderer) {
|
||||
// eslint-disable-next-line no-undef
|
||||
const wr = new (globalThis as any).WeakRef(value) as WeakRef<CallIntoRenderer>;
|
||||
const mapKey = id[0] + '~' + id[1];
|
||||
@@ -218,7 +218,7 @@ const fakeConstructor = (constructor: Function, name: string) =>
|
||||
});
|
||||
|
||||
// Convert array of meta data from renderer into array of real values.
|
||||
const unwrapArgs = function (sender: electron.WebContents, frameId: number, contextId: string, args: any[]) {
|
||||
const unwrapArgs = function (sender: electron.WebContents, frameId: [number, number], contextId: string, args: any[]) {
|
||||
const metaToValue = function (meta: MetaTypeFromRenderer): any {
|
||||
switch (meta.type) {
|
||||
case 'nativeimage':
|
||||
@@ -263,7 +263,7 @@ const unwrapArgs = function (sender: electron.WebContents, frameId: number, cont
|
||||
const callIntoRenderer = function (this: any, ...args: any[]) {
|
||||
let succeed = false;
|
||||
if (!sender.isDestroyed()) {
|
||||
succeed = (sender as any)._sendToFrameInternal(frameId, 'ELECTRON_RENDERER_CALLBACK', contextId, meta.id, valueToMeta(sender, contextId, args));
|
||||
succeed = sender._sendToFrameInternal(frameId, 'ELECTRON_RENDERER_CALLBACK', contextId, meta.id, valueToMeta(sender, contextId, args));
|
||||
}
|
||||
if (!succeed) {
|
||||
removeRemoteListenersAndLogWarning(this, callIntoRenderer);
|
||||
@@ -421,7 +421,7 @@ handleRemoteCommand('ELECTRON_BROWSER_CURRENT_WEB_CONTENTS', function (event, co
|
||||
});
|
||||
|
||||
handleRemoteCommand('ELECTRON_BROWSER_CONSTRUCTOR', function (event, contextId, id, args) {
|
||||
args = unwrapArgs(event.sender, event.frameId, contextId, args);
|
||||
args = unwrapArgs(event.sender, [event.processId, event.frameId], contextId, args);
|
||||
const constructor = objectsRegistry.get(id);
|
||||
|
||||
if (constructor == null) {
|
||||
@@ -432,7 +432,7 @@ handleRemoteCommand('ELECTRON_BROWSER_CONSTRUCTOR', function (event, contextId,
|
||||
});
|
||||
|
||||
handleRemoteCommand('ELECTRON_BROWSER_FUNCTION_CALL', function (event, contextId, id, args) {
|
||||
args = unwrapArgs(event.sender, event.frameId, contextId, args);
|
||||
args = unwrapArgs(event.sender, [event.processId, event.frameId], contextId, args);
|
||||
const func = objectsRegistry.get(id);
|
||||
|
||||
if (func == null) {
|
||||
@@ -449,7 +449,7 @@ handleRemoteCommand('ELECTRON_BROWSER_FUNCTION_CALL', function (event, contextId
|
||||
});
|
||||
|
||||
handleRemoteCommand('ELECTRON_BROWSER_MEMBER_CONSTRUCTOR', function (event, contextId, id, method, args) {
|
||||
args = unwrapArgs(event.sender, event.frameId, contextId, args);
|
||||
args = unwrapArgs(event.sender, [event.processId, event.frameId], contextId, args);
|
||||
const object = objectsRegistry.get(id);
|
||||
|
||||
if (object == null) {
|
||||
@@ -460,7 +460,7 @@ handleRemoteCommand('ELECTRON_BROWSER_MEMBER_CONSTRUCTOR', function (event, cont
|
||||
});
|
||||
|
||||
handleRemoteCommand('ELECTRON_BROWSER_MEMBER_CALL', function (event, contextId, id, method, args) {
|
||||
args = unwrapArgs(event.sender, event.frameId, contextId, args);
|
||||
args = unwrapArgs(event.sender, [event.processId, event.frameId], contextId, args);
|
||||
const object = objectsRegistry.get(id);
|
||||
|
||||
if (object == null) {
|
||||
@@ -477,7 +477,7 @@ handleRemoteCommand('ELECTRON_BROWSER_MEMBER_CALL', function (event, contextId,
|
||||
});
|
||||
|
||||
handleRemoteCommand('ELECTRON_BROWSER_MEMBER_SET', function (event, contextId, id, name, args) {
|
||||
args = unwrapArgs(event.sender, event.frameId, contextId, args);
|
||||
args = unwrapArgs(event.sender, [event.processId, event.frameId], contextId, args);
|
||||
const obj = objectsRegistry.get(id);
|
||||
|
||||
if (obj == null) {
|
||||
|
||||
@@ -298,7 +298,7 @@ function metaToError (meta: { type: 'error', value: any, members: ObjectMember[]
|
||||
}
|
||||
|
||||
function handleMessage (channel: string, handler: Function) {
|
||||
ipcRendererInternal.on(channel, (event, passedContextId, id, ...args) => {
|
||||
ipcRendererInternal.onMessageFromMain(channel, (event, passedContextId, id, ...args) => {
|
||||
if (passedContextId === contextId) {
|
||||
handler(id, ...args);
|
||||
} else {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-in
|
||||
type IPCHandler = (event: Electron.IpcRendererEvent, ...args: any[]) => any
|
||||
|
||||
export const handle = function <T extends IPCHandler> (channel: string, handler: T) {
|
||||
ipcRendererInternal.on(channel, async (event, requestId, ...args) => {
|
||||
ipcRendererInternal.onMessageFromMain(channel, async (event, requestId, ...args) => {
|
||||
const replyChannel = `${channel}_RESPONSE_${requestId}`;
|
||||
try {
|
||||
event.sender.send(replyChannel, null, await handler(event, ...args));
|
||||
|
||||
@@ -29,4 +29,27 @@ ipcRendererInternal.invoke = async function<T> (channel: string, ...args: any[])
|
||||
return result;
|
||||
};
|
||||
|
||||
ipcRendererInternal.onMessageFromMain = function (channel: string, listener: (event: Electron.IpcRendererEvent, ...args: any[]) => void) {
|
||||
return ipcRendererInternal.on(channel, (event, ...args) => {
|
||||
if (event.senderId !== 0) {
|
||||
console.error(`Message ${channel} sent by unexpected WebContents (${event.senderId})`);
|
||||
return;
|
||||
}
|
||||
|
||||
listener(event, ...args);
|
||||
});
|
||||
};
|
||||
|
||||
ipcRendererInternal.onceMessageFromMain = function (channel: string, listener: (event: Electron.IpcRendererEvent, ...args: any[]) => void) {
|
||||
return ipcRendererInternal.on(channel, function wrapper (event, ...args) {
|
||||
if (event.senderId !== 0) {
|
||||
console.error(`Message ${channel} sent by unexpected WebContents (${event.senderId})`);
|
||||
return;
|
||||
}
|
||||
|
||||
ipcRendererInternal.removeListener(channel, wrapper);
|
||||
listener(event, ...args);
|
||||
});
|
||||
};
|
||||
|
||||
export { ipcRendererInternal };
|
||||
|
||||
@@ -179,7 +179,7 @@ const warnAboutInsecureCSP = function () {
|
||||
|
||||
console.warn('%cElectron Security Warning (Insecure Content-Security-Policy)',
|
||||
'font-weight: bold;', warning);
|
||||
});
|
||||
}).catch(() => {});
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,6 +27,7 @@ const WEB_VIEW_EVENTS: Record<string, Array<string>> = {
|
||||
'focus-change': ['focus', 'guestInstanceId'],
|
||||
close: [],
|
||||
crashed: [],
|
||||
'render-process-gone': ['details'],
|
||||
'plugin-crashed': ['name', 'version'],
|
||||
destroyed: [],
|
||||
'page-title-updated': ['title', 'explicitSet'],
|
||||
@@ -66,18 +67,18 @@ const dispatchEvent = function (
|
||||
};
|
||||
|
||||
export function registerEvents (webView: WebViewImpl, viewInstanceId: number) {
|
||||
ipcRendererInternal.on(`ELECTRON_GUEST_VIEW_INTERNAL_DESTROY_GUEST-${viewInstanceId}`, function () {
|
||||
ipcRendererInternal.onMessageFromMain(`ELECTRON_GUEST_VIEW_INTERNAL_DESTROY_GUEST-${viewInstanceId}`, function () {
|
||||
webView.guestInstanceId = undefined;
|
||||
webView.reset();
|
||||
const domEvent = new Event('destroyed');
|
||||
webView.dispatchEvent(domEvent);
|
||||
});
|
||||
|
||||
ipcRendererInternal.on(`ELECTRON_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-${viewInstanceId}`, function (event, eventName, ...args) {
|
||||
ipcRendererInternal.onMessageFromMain(`ELECTRON_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-${viewInstanceId}`, function (event, eventName, ...args) {
|
||||
dispatchEvent(webView, eventName, eventName, ...args);
|
||||
});
|
||||
|
||||
ipcRendererInternal.on(`ELECTRON_GUEST_VIEW_INTERNAL_IPC_MESSAGE-${viewInstanceId}`, function (event, channel, ...args) {
|
||||
ipcRendererInternal.onMessageFromMain(`ELECTRON_GUEST_VIEW_INTERNAL_IPC_MESSAGE-${viewInstanceId}`, function (event, channel, ...args) {
|
||||
const domEvent = new Event('ipc-message') as IpcMessageEvent;
|
||||
domEvent.channel = channel;
|
||||
domEvent.args = args;
|
||||
|
||||
@@ -181,7 +181,7 @@ class BrowserWindowProxy {
|
||||
this.guestId = guestId;
|
||||
this._location = new LocationProxy(guestId);
|
||||
|
||||
ipcRendererInternal.once(`ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_CLOSED_${guestId}`, () => {
|
||||
ipcRendererInternal.onceMessageFromMain(`ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_CLOSED_${guestId}`, () => {
|
||||
removeProxy(guestId);
|
||||
this.closed = true;
|
||||
});
|
||||
@@ -281,7 +281,7 @@ export const windowSetup = (
|
||||
if (contextIsolationEnabled) internalContextBridge.overrideGlobalValueFromIsolatedWorld(['prompt'], window.prompt);
|
||||
|
||||
if (!usesNativeWindowOpen || openerId != null) {
|
||||
ipcRendererInternal.on('ELECTRON_GUEST_WINDOW_POSTMESSAGE', function (
|
||||
ipcRendererInternal.onMessageFromMain('ELECTRON_GUEST_WINDOW_POSTMESSAGE', function (
|
||||
_event, sourceId: number, message: any, sourceOrigin: string
|
||||
) {
|
||||
// Manually dispatch event instead of using postMessage because we also need to
|
||||
@@ -336,7 +336,7 @@ export const windowSetup = (
|
||||
let cachedVisibilityState = isHiddenPage ? 'hidden' : 'visible';
|
||||
|
||||
// Subscribe to visibilityState changes.
|
||||
ipcRendererInternal.on('ELECTRON_GUEST_INSTANCE_VISIBILITY_CHANGE', function (_event, visibilityState: VisibilityState) {
|
||||
ipcRendererInternal.onMessageFromMain('ELECTRON_GUEST_INSTANCE_VISIBILITY_CHANGE', function (_event, visibilityState: VisibilityState) {
|
||||
if (cachedVisibilityState !== visibilityState) {
|
||||
cachedVisibilityState = visibilityState;
|
||||
document.dispatchEvent(new Event('visibilitychange'));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "electron",
|
||||
"version": "11.0.0-beta.23",
|
||||
"version": "11.1.0",
|
||||
"repository": "https://github.com/electron/electron",
|
||||
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
|
||||
"devDependencies": {
|
||||
|
||||
@@ -100,6 +100,10 @@ worker_feat_add_hook_to_notify_script_ready.patch
|
||||
cherry-pick-2f5b8357dca2.patch
|
||||
fix_use_electron_generated_resources.patch
|
||||
chore_expose_v8_initialization_isolate_callbacks.patch
|
||||
rename_the_v8_context_snapshot_on_arm64_macos_builds.patch
|
||||
crashpad-initialize-logging.patch
|
||||
fix_properly_honor_printing_page_ranges.patch
|
||||
cherry-pick-8f5a08079948.patch
|
||||
cherry-pick-275865e8c237.patch
|
||||
use_public_apis_to_determine_if_a_font_is_a_system_font_in_mas_build.patch
|
||||
cherry-pick-47e21abe349a.patch
|
||||
fix_setparentacessibile_crash_win.patch
|
||||
|
||||
@@ -23,10 +23,10 @@ index f63b17435218d0d67bba044da67c1c80015fc996..d0fe24182f2cb48a1333054ce44b6a7f
|
||||
int32_t world_id) {}
|
||||
virtual void DidClearWindowObject() {}
|
||||
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
||||
index e811aec4853c1ba0dacdcad758a5bc834643d7e3..5eb2dcde4d2033015677681ceeba7da9b9fe32df 100644
|
||||
index 72a3bd4837f37bb1bab1f5ca48e90c41a297337f..23ff9cc13aaa97d395983dceb2a27158b2d679a5 100644
|
||||
--- a/content/renderer/render_frame_impl.cc
|
||||
+++ b/content/renderer/render_frame_impl.cc
|
||||
@@ -5034,6 +5034,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
@@ -5036,6 +5036,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
observer.DidCreateScriptContext(context, world_id);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ potentially prevent a window from being created.
|
||||
TODO(loc): this patch is currently broken.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
index 497033d3d5257daffe4aca2ebdd1fd71513db73f..7412bf8f9a9e07975917514e7f4c13253112138a 100644
|
||||
index 8aa3723aa317ccd1591196a4929582b61c0d3b5f..b820655013e58a55698450f703dd7230f1d1d250 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -4945,6 +4945,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
@@ -4959,6 +4959,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
last_committed_origin_, params->window_container_type,
|
||||
params->target_url, params->referrer.To<Referrer>(),
|
||||
params->frame_name, params->disposition, *params->features,
|
||||
@@ -21,10 +21,10 @@ index 497033d3d5257daffe4aca2ebdd1fd71513db73f..7412bf8f9a9e07975917514e7f4c1325
|
||||
&no_javascript_access);
|
||||
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
||||
index a39f43b61afc70296470a9ed616d7e8a423780aa..b113c265dcf5b8e3c7533085f1b8409fa13bcfa0 100644
|
||||
index 26bd3968521cc2713d6350a0fa9265124c7efb00..5234e86d8f10533c4f8c6992a328d521c1850cea 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -3703,9 +3703,9 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow(
|
||||
@@ -3712,9 +3712,9 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow(
|
||||
}
|
||||
|
||||
if (delegate_) {
|
||||
|
||||
413
patches/chromium/cherry-pick-275865e8c237.patch
Normal file
413
patches/chromium/cherry-pick-275865e8c237.patch
Normal file
@@ -0,0 +1,413 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Robinson <mrobinson@igalia.com>
|
||||
Date: Tue, 20 Oct 2020 09:00:52 +0000
|
||||
Subject: Mac: Target a11y actions on certain containers to focused or
|
||||
activedescendant children
|
||||
|
||||
When an action is triggered on a container with selectable children and
|
||||
that container has a focused or activedescendant child, retarget the
|
||||
action to that child. This fixes an issue where when the VoiceOver
|
||||
cursor is on a tree with a focused child, triggered context menus would
|
||||
use the tree as the target element.
|
||||
|
||||
menu on a tree instead of a focused child.
|
||||
|
||||
Bug: 1114892
|
||||
Change-Id: Ibe580beed93aeaac54d1dabaee28443b290fd0e2
|
||||
AX-Relnotes: Fix an issue where VoiceOver would trigger a context
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2466281
|
||||
Commit-Queue: Martin Robinson <mrobinson@igalia.com>
|
||||
Reviewed-by: Scott Violet <sky@chromium.org>
|
||||
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
|
||||
Reviewed-by: Nektarios Paisios <nektar@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/master@{#818831}
|
||||
|
||||
diff --git a/content/browser/accessibility/browser_accessibility_cocoa.h b/content/browser/accessibility/browser_accessibility_cocoa.h
|
||||
index 770c0cb6a4dad8cbf35900311a23a8296407d81d..0ffc8d768299cc5e7f37878fb656c12b028fead9 100644
|
||||
--- a/content/browser/accessibility/browser_accessibility_cocoa.h
|
||||
+++ b/content/browser/accessibility/browser_accessibility_cocoa.h
|
||||
@@ -117,6 +117,14 @@ id AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker);
|
||||
- (bool)findRowIndex:(BrowserAccessibilityCocoa*)toFind
|
||||
withCurrentIndex:(int*)currentIndex;
|
||||
|
||||
+// Choose the appropriate accessibility object to receive an action depending
|
||||
+// on the characteristics of this accessibility node.
|
||||
+- (content::BrowserAccessibility*)actionTarget;
|
||||
+
|
||||
+// Return the active descendant for this accessibility object or null if there
|
||||
+// is no active descendant defined or in the case of an error.
|
||||
+- (content::BrowserAccessibility*)activeDescendant;
|
||||
+
|
||||
// Internally-used property.
|
||||
@property(nonatomic, readonly) NSPoint origin;
|
||||
|
||||
diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/content/browser/accessibility/browser_accessibility_cocoa.mm
|
||||
index 17aa494d6473866721a8cc5f4c5c646af9307d93..71f927cd35a27dd5f656907dc177fbfe7577d3f0 100644
|
||||
--- a/content/browser/accessibility/browser_accessibility_cocoa.mm
|
||||
+++ b/content/browser/accessibility/browser_accessibility_cocoa.mm
|
||||
@@ -1744,14 +1744,7 @@ - (id)owns {
|
||||
// supported with VoiceOver.
|
||||
//
|
||||
|
||||
- int activeDescendantId;
|
||||
- if (!_owner->GetIntAttribute(ax::mojom::IntAttribute::kActivedescendantId,
|
||||
- &activeDescendantId))
|
||||
- return nil;
|
||||
-
|
||||
- BrowserAccessibilityManager* manager = _owner->manager();
|
||||
- BrowserAccessibility* activeDescendant =
|
||||
- manager->GetFromID(activeDescendantId);
|
||||
+ BrowserAccessibility* activeDescendant = [self activeDescendant];
|
||||
if (!activeDescendant)
|
||||
return nil;
|
||||
|
||||
@@ -3729,16 +3722,18 @@ - (void)accessibilityPerformAction:(NSString*)action {
|
||||
return;
|
||||
|
||||
// TODO(dmazzoni): Support more actions.
|
||||
- BrowserAccessibilityManager* manager = _owner->manager();
|
||||
+ BrowserAccessibility* actionTarget = [self actionTarget];
|
||||
+ BrowserAccessibilityManager* manager = actionTarget->manager();
|
||||
if ([action isEqualToString:NSAccessibilityPressAction]) {
|
||||
- manager->DoDefaultAction(*_owner);
|
||||
- if (_owner->GetData().GetRestriction() != ax::mojom::Restriction::kNone ||
|
||||
+ manager->DoDefaultAction(*actionTarget);
|
||||
+ if (actionTarget->GetData().GetRestriction() !=
|
||||
+ ax::mojom::Restriction::kNone ||
|
||||
![self isCheckable])
|
||||
return;
|
||||
// Hack: preemptively set the checked state to what it should become,
|
||||
// otherwise VoiceOver will very likely report the old, incorrect state to
|
||||
// the user as it requests the value too quickly.
|
||||
- ui::AXNode* node = _owner->node();
|
||||
+ ui::AXNode* node = actionTarget->node();
|
||||
if (!node)
|
||||
return;
|
||||
AXNodeData data(node->TakeData()); // Temporarily take data.
|
||||
@@ -3756,13 +3751,13 @@ - (void)accessibilityPerformAction:(NSString*)action {
|
||||
}
|
||||
node->SetData(data); // Set the data back in the node.
|
||||
} else if ([action isEqualToString:NSAccessibilityShowMenuAction]) {
|
||||
- manager->ShowContextMenu(*_owner);
|
||||
+ manager->ShowContextMenu(*actionTarget);
|
||||
} else if ([action isEqualToString:NSAccessibilityScrollToVisibleAction]) {
|
||||
- manager->ScrollToMakeVisible(*_owner, gfx::Rect());
|
||||
+ manager->ScrollToMakeVisible(*actionTarget, gfx::Rect());
|
||||
} else if ([action isEqualToString:NSAccessibilityIncrementAction]) {
|
||||
- manager->Increment(*_owner);
|
||||
+ manager->Increment(*actionTarget);
|
||||
} else if ([action isEqualToString:NSAccessibilityDecrementAction]) {
|
||||
- manager->Decrement(*_owner);
|
||||
+ manager->Decrement(*actionTarget);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3871,4 +3866,32 @@ - (BOOL)accessibilityNotifiesWhenDestroyed {
|
||||
return YES;
|
||||
}
|
||||
|
||||
+// Choose the appropriate accessibility object to receive an action depending
|
||||
+// on the characteristics of this accessibility node.
|
||||
+- (BrowserAccessibility*)actionTarget {
|
||||
+ // When an action is triggered on a container with selectable children and
|
||||
+ // one of those children is an active descendant or focused, retarget the
|
||||
+ // action to that child. See https://crbug.com/1114892.
|
||||
+ if (!ui::IsContainerWithSelectableChildren(_owner->node()->data().role))
|
||||
+ return _owner;
|
||||
+
|
||||
+ if (BrowserAccessibility* activeDescendant = [self activeDescendant])
|
||||
+ return activeDescendant;
|
||||
+
|
||||
+ BrowserAccessibility* focused = _owner->manager()->GetFocus();
|
||||
+ if (focused && focused->IsDescendantOf(_owner))
|
||||
+ return focused;
|
||||
+
|
||||
+ return _owner;
|
||||
+}
|
||||
+
|
||||
+// Return the active descendant for this accessibility object or null if there
|
||||
+// is no active descendant defined or in the case of an error.
|
||||
+- (BrowserAccessibility*)activeDescendant {
|
||||
+ int activeDescendantId;
|
||||
+ if (!_owner->GetIntAttribute(ax::mojom::IntAttribute::kActivedescendantId,
|
||||
+ &activeDescendantId))
|
||||
+ return nullptr;
|
||||
+ return _owner->manager()->GetFromID(activeDescendantId);
|
||||
+}
|
||||
@end
|
||||
diff --git a/content/browser/accessibility/browser_accessibility_cocoa_browsertest.mm b/content/browser/accessibility/browser_accessibility_cocoa_browsertest.mm
|
||||
index 17801b9774813df79e4b944cb0a73535eb4c07c2..6eb2c484ddc479d9cfa566df0b103782264d3af8 100644
|
||||
--- a/content/browser/accessibility/browser_accessibility_cocoa_browsertest.mm
|
||||
+++ b/content/browser/accessibility/browser_accessibility_cocoa_browsertest.mm
|
||||
@@ -44,6 +44,35 @@
|
||||
return web_contents->GetRootBrowserAccessibilityManager();
|
||||
}
|
||||
|
||||
+ // Trigger a context menu for the provided element without showing it. Returns
|
||||
+ // the coordinates where the context menu was invoked (calculated based on
|
||||
+ // the provided element). These coordinates are relative to the RenderView
|
||||
+ // origin.
|
||||
+ gfx::Point TriggerContextMenuAndGetMenuLocation(
|
||||
+ NSAccessibilityElement* element,
|
||||
+ ContextMenuFilter* filter) {
|
||||
+ // accessibilityPerformAction is deprecated, but it's still used internally
|
||||
+ // by AppKit.
|
||||
+#pragma clang diagnostic push
|
||||
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
+ [element accessibilityPerformAction:NSAccessibilityShowMenuAction];
|
||||
+ filter->Wait();
|
||||
+
|
||||
+ UntrustworthyContextMenuParams context_menu_params = filter->get_params();
|
||||
+ return gfx::Point(context_menu_params.x, context_menu_params.y);
|
||||
+#pragma clang diagnostic pop
|
||||
+ }
|
||||
+
|
||||
+ void FocusAccessibilityElementAndWaitForFocusChange(
|
||||
+ NSAccessibilityElement* element) {
|
||||
+#pragma clang diagnostic push
|
||||
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
+ [element accessibilitySetValue:@(1)
|
||||
+ forAttribute:NSAccessibilityFocusedAttribute];
|
||||
+#pragma clang diagnostic pop
|
||||
+ WaitForAccessibilityFocusChange();
|
||||
+ }
|
||||
+
|
||||
private:
|
||||
BrowserAccessibility* FindNodeInSubtree(BrowserAccessibility& node,
|
||||
ax::mojom::Role role) {
|
||||
@@ -466,4 +495,165 @@ GURL url(R"HTML(data:text/html,
|
||||
EXPECT_NSEQ(@"AXRow", [row_nodes[1] role]);
|
||||
EXPECT_NSEQ(@"row2", [row_nodes[1] descriptionForAccessibility]);
|
||||
}
|
||||
+
|
||||
+IN_PROC_BROWSER_TEST_F(BrowserAccessibilityCocoaBrowserTest,
|
||||
+ TestTreeContextMenuEvent) {
|
||||
+ AccessibilityNotificationWaiter waiter(shell()->web_contents(),
|
||||
+ ui::kAXModeComplete,
|
||||
+ ax::mojom::Event::kLoadComplete);
|
||||
+
|
||||
+ GURL url(R"HTML(data:text/html,
|
||||
+ <div alt="tree" role="tree">
|
||||
+ <div tabindex="1" role="treeitem">1</div>
|
||||
+ <div tabindex="2" role="treeitem">2</div>
|
||||
+ </div>)HTML");
|
||||
+
|
||||
+ EXPECT_TRUE(NavigateToURL(shell(), url));
|
||||
+ waiter.WaitForNotification();
|
||||
+
|
||||
+ BrowserAccessibility* tree = FindNode(ax::mojom::Role::kTree);
|
||||
+ base::scoped_nsobject<BrowserAccessibilityCocoa> cocoa_tree(
|
||||
+ [ToBrowserAccessibilityCocoa(tree) retain]);
|
||||
+
|
||||
+ NSArray* tree_children = [cocoa_tree children];
|
||||
+ EXPECT_NSEQ(@"AXRow", [tree_children[0] role]);
|
||||
+ EXPECT_NSEQ(@"AXRow", [tree_children[1] role]);
|
||||
+
|
||||
+ content::RenderProcessHost* render_process_host =
|
||||
+ shell()->web_contents()->GetMainFrame()->GetProcess();
|
||||
+ auto menu_filter = base::MakeRefCounted<ContextMenuFilter>(
|
||||
+ ContextMenuFilter::ShowBehavior::kPreventShow);
|
||||
+ render_process_host->AddFilter(menu_filter.get());
|
||||
+
|
||||
+ gfx::Point tree_point =
|
||||
+ TriggerContextMenuAndGetMenuLocation(cocoa_tree, menu_filter.get());
|
||||
+
|
||||
+ menu_filter->Reset();
|
||||
+ gfx::Point item_1_point =
|
||||
+ TriggerContextMenuAndGetMenuLocation(tree_children[1], menu_filter.get());
|
||||
+ ASSERT_NE(tree_point, item_1_point);
|
||||
+
|
||||
+ // Now focus the second child and trigger a context menu on the tree.
|
||||
+ EXPECT_TRUE(
|
||||
+ content::ExecuteScript(shell()->web_contents(),
|
||||
+ "document.body.children[0].children[1].focus();"));
|
||||
+ WaitForAccessibilityFocusChange();
|
||||
+
|
||||
+ // Triggering a context menu on the tree should now trigger the menu
|
||||
+ // on the focused child.
|
||||
+ menu_filter->Reset();
|
||||
+ gfx::Point new_point =
|
||||
+ TriggerContextMenuAndGetMenuLocation(cocoa_tree, menu_filter.get());
|
||||
+ ASSERT_EQ(new_point, item_1_point);
|
||||
+}
|
||||
+
|
||||
+IN_PROC_BROWSER_TEST_F(BrowserAccessibilityCocoaBrowserTest,
|
||||
+ TestEventRetargetingFocus) {
|
||||
+ AccessibilityNotificationWaiter waiter(shell()->web_contents(),
|
||||
+ ui::kAXModeComplete,
|
||||
+ ax::mojom::Event::kLoadComplete);
|
||||
+
|
||||
+ GURL url(R"HTML(data:text/html,
|
||||
+ <div role="tree">
|
||||
+ <div tabindex="1" role="treeitem">1</div>
|
||||
+ <div tabindex="2" role="treeitem">2</div>
|
||||
+ </div>
|
||||
+ <div role="treegrid">
|
||||
+ <div tabindex="1" role="treeitem">1</div>
|
||||
+ <div tabindex="2" role="treeitem">2</div>
|
||||
+ </div>
|
||||
+ <div role="tablist">
|
||||
+ <div tabindex="1" role="tab">1</div>
|
||||
+ <div tabindex="2" role="tab">2</div>
|
||||
+ </div>
|
||||
+ <div role="table">
|
||||
+ <div tabindex="1" role="row">1</div>
|
||||
+ <div tabindex="2" role="row">2</div>
|
||||
+ </div>
|
||||
+ <div role="banner">
|
||||
+ <div tabindex="1" role="link">1</div>
|
||||
+ <div tabindex="2" role="link">2</div>
|
||||
+ </div>)HTML");
|
||||
+
|
||||
+ EXPECT_TRUE(NavigateToURL(shell(), url));
|
||||
+ waiter.WaitForNotification();
|
||||
+
|
||||
+ std::pair<ax::mojom::Role, bool> tests[] = {
|
||||
+ std::make_pair(ax::mojom::Role::kTree, true),
|
||||
+ std::make_pair(ax::mojom::Role::kTreeGrid, true),
|
||||
+ std::make_pair(ax::mojom::Role::kTabList, true),
|
||||
+ std::make_pair(ax::mojom::Role::kTable, false),
|
||||
+ std::make_pair(ax::mojom::Role::kBanner, false),
|
||||
+ };
|
||||
+
|
||||
+ for (auto& test : tests) {
|
||||
+ base::scoped_nsobject<BrowserAccessibilityCocoa> parent(
|
||||
+ [ToBrowserAccessibilityCocoa(FindNode(test.first)) retain]);
|
||||
+ BrowserAccessibilityCocoa* child = [parent children][1];
|
||||
+
|
||||
+ EXPECT_NE(nullptr, parent.get());
|
||||
+ EXPECT_EQ([child owner], [child actionTarget]);
|
||||
+ EXPECT_EQ([parent owner], [parent actionTarget]);
|
||||
+
|
||||
+ FocusAccessibilityElementAndWaitForFocusChange(child);
|
||||
+ ASSERT_EQ(test.second, [parent actionTarget] == [child owner]);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+IN_PROC_BROWSER_TEST_F(BrowserAccessibilityCocoaBrowserTest,
|
||||
+ TestEventRetargetingActiveDescendant) {
|
||||
+ AccessibilityNotificationWaiter waiter(shell()->web_contents(),
|
||||
+ ui::kAXModeComplete,
|
||||
+ ax::mojom::Event::kLoadComplete);
|
||||
+
|
||||
+ GURL url(R"HTML(data:text/html,
|
||||
+ <div role="tree" aria-activedescendant="tree-child">
|
||||
+ <div tabindex="1" role="treeitem">1</div>
|
||||
+ <div id="tree-child" tabindex="2" role="treeitem">2</div>
|
||||
+ </div>
|
||||
+ <div role="treegrid" aria-activedescendant="treegrid-child">
|
||||
+ <div tabindex="1" role="treeitem">1</div>
|
||||
+ <div id="treegrid-child" tabindex="2" role="treeitem">2</div>
|
||||
+ </div>
|
||||
+ <div role="tablist" aria-activedescendant="tablist-child">
|
||||
+ <div tabindex="1" role="tab">1</div>
|
||||
+ <div id="tablist-child" tabindex="2" role="tab">2</div>
|
||||
+ </div>
|
||||
+ <div role="table" aria-activedescendant="table-child">
|
||||
+ <div tabindex="1" role="row">1</div>
|
||||
+ <div id="table-child" tabindex="2" role="row">2</div>
|
||||
+ </div>
|
||||
+ <div role="banner" aria-activedescendant="banner-child">
|
||||
+ <div tabindex="1" role="link">1</div>
|
||||
+ <div id="banner-child" tabindex="2" role="link">2</div>
|
||||
+ </div>)HTML");
|
||||
+
|
||||
+ EXPECT_TRUE(NavigateToURL(shell(), url));
|
||||
+ waiter.WaitForNotification();
|
||||
+
|
||||
+ std::pair<ax::mojom::Role, bool> tests[] = {
|
||||
+ std::make_pair(ax::mojom::Role::kTree, true),
|
||||
+ std::make_pair(ax::mojom::Role::kTreeGrid, true),
|
||||
+ std::make_pair(ax::mojom::Role::kTabList, true),
|
||||
+ std::make_pair(ax::mojom::Role::kTable, false),
|
||||
+ std::make_pair(ax::mojom::Role::kBanner, false),
|
||||
+ };
|
||||
+
|
||||
+ for (auto& test : tests) {
|
||||
+ base::scoped_nsobject<BrowserAccessibilityCocoa> parent(
|
||||
+ [ToBrowserAccessibilityCocoa(FindNode(test.first)) retain]);
|
||||
+ BrowserAccessibilityCocoa* first_child = [parent children][0];
|
||||
+ BrowserAccessibilityCocoa* second_child = [parent children][1];
|
||||
+
|
||||
+ EXPECT_NE(nullptr, parent.get());
|
||||
+ EXPECT_EQ([second_child owner], [second_child actionTarget]);
|
||||
+ EXPECT_EQ(test.second, [second_child owner] == [parent actionTarget]);
|
||||
+
|
||||
+ // aria-activedescendant should take priority of focus for determining
|
||||
+ // if an object is the action target.
|
||||
+ FocusAccessibilityElementAndWaitForFocusChange(first_child);
|
||||
+ EXPECT_EQ(test.second, [second_child owner] == [parent actionTarget]);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
} // namespace content
|
||||
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc
|
||||
index 47161f98b2fcdacece578cde50141860d2ab0a40..a8f988b8465c420224979d805baf454483e49134 100644
|
||||
--- a/content/public/test/browser_test_utils.cc
|
||||
+++ b/content/public/test/browser_test_utils.cc
|
||||
@@ -3220,10 +3220,11 @@ void VerifyStaleContentOnFrameEviction(
|
||||
|
||||
#endif // defined(USE_AURA)
|
||||
|
||||
-ContextMenuFilter::ContextMenuFilter()
|
||||
+ContextMenuFilter::ContextMenuFilter(ShowBehavior behavior)
|
||||
: BrowserMessageFilter(FrameMsgStart),
|
||||
run_loop_(std::make_unique<base::RunLoop>()),
|
||||
- quit_closure_(run_loop_->QuitClosure()) {}
|
||||
+ quit_closure_(run_loop_->QuitClosure()),
|
||||
+ show_behavior_(behavior) {}
|
||||
|
||||
bool ContextMenuFilter::OnMessageReceived(const IPC::Message& message) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
@@ -3234,6 +3235,9 @@ bool ContextMenuFilter::OnMessageReceived(const IPC::Message& message) {
|
||||
GetUIThreadTaskRunner({})->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(&ContextMenuFilter::OnContextMenu, this, menu_params));
|
||||
+ // Returning true here blocks the default action for this message, which
|
||||
+ // means that the menu will not be shown.
|
||||
+ return show_behavior_ == ShowBehavior::kPreventShow;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -3244,6 +3248,12 @@ void ContextMenuFilter::Wait() {
|
||||
run_loop_ = nullptr;
|
||||
}
|
||||
|
||||
+void ContextMenuFilter::Reset() {
|
||||
+ ASSERT_EQ(run_loop_, nullptr);
|
||||
+ run_loop_ = std::make_unique<base::RunLoop>();
|
||||
+ quit_closure_ = run_loop_->QuitClosure();
|
||||
+}
|
||||
+
|
||||
ContextMenuFilter::~ContextMenuFilter() = default;
|
||||
|
||||
void ContextMenuFilter::OnContextMenu(
|
||||
diff --git a/content/public/test/browser_test_utils.h b/content/public/test/browser_test_utils.h
|
||||
index f68d423999ff711b46b7fe9d718163158e1d5223..3568bcceee9867db634306d36e3281d32450ea0a 100644
|
||||
--- a/content/public/test/browser_test_utils.h
|
||||
+++ b/content/public/test/browser_test_utils.h
|
||||
@@ -1688,10 +1688,15 @@ void VerifyStaleContentOnFrameEviction(
|
||||
// sent by the renderer.
|
||||
class ContextMenuFilter : public content::BrowserMessageFilter {
|
||||
public:
|
||||
- ContextMenuFilter();
|
||||
+ // Whether or not the ContextMenu should be prevented from performing
|
||||
+ // its default action, preventing the context menu from showing.
|
||||
+ enum ShowBehavior { kShow, kPreventShow };
|
||||
+
|
||||
+ explicit ContextMenuFilter(ShowBehavior behavior = ShowBehavior::kShow);
|
||||
|
||||
bool OnMessageReceived(const IPC::Message& message) override;
|
||||
void Wait();
|
||||
+ void Reset();
|
||||
|
||||
content::UntrustworthyContextMenuParams get_params() { return last_params_; }
|
||||
|
||||
@@ -1703,6 +1708,7 @@ class ContextMenuFilter : public content::BrowserMessageFilter {
|
||||
std::unique_ptr<base::RunLoop> run_loop_;
|
||||
base::OnceClosure quit_closure_;
|
||||
content::UntrustworthyContextMenuParams last_params_;
|
||||
+ const ShowBehavior show_behavior_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ContextMenuFilter);
|
||||
};
|
||||
723
patches/chromium/cherry-pick-47e21abe349a.patch
Normal file
723
patches/chromium/cherry-pick-47e21abe349a.patch
Normal file
@@ -0,0 +1,723 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Robinson <mrobinson@igalia.com>
|
||||
Date: Thu, 19 Nov 2020 21:28:45 +0000
|
||||
Subject: Improve AXTextStateChangeType in
|
||||
NSAccessibilitySelectedTextChangedNotification
|
||||
|
||||
When setting the AXTextStateChangeType key in the user info data
|
||||
structure for the notification, use AXTextStateChangeTypeSelectionMove
|
||||
when we detect a focus change. This causes VoiceOver to properly
|
||||
announce the label and type of form entries when their contents are
|
||||
selected due to focus changes.
|
||||
|
||||
type are now announced.
|
||||
|
||||
Bug: 1127421
|
||||
Change-Id: I42d66ad60fbcba7c8c34396fdbc3f6e0c739d1a2
|
||||
AX-Relnotes: When focus changes moves to form inputs, the input label and
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2512913
|
||||
Commit-Queue: Martin Robinson <mrobinson@igalia.com>
|
||||
Reviewed-by: Nektarios Paisios <nektar@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/master@{#829380}
|
||||
|
||||
diff --git a/content/browser/accessibility/accessibility_event_recorder_mac.mm b/content/browser/accessibility/accessibility_event_recorder_mac.mm
|
||||
index fcb93bab1c94f792dc9868e895a0e562d1fd8449..1e415ee8f849b67c098e49572c9d4e890ed44d04 100644
|
||||
--- a/content/browser/accessibility/accessibility_event_recorder_mac.mm
|
||||
+++ b/content/browser/accessibility/accessibility_event_recorder_mac.mm
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
+#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include "base/logging.h"
|
||||
@@ -15,6 +16,7 @@
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "content/browser/accessibility/accessibility_tools_utils_mac.h"
|
||||
#include "content/browser/accessibility/browser_accessibility_manager.h"
|
||||
+#include "ui/accessibility/platform/ax_private_webkit_constants_mac.h"
|
||||
|
||||
namespace content {
|
||||
|
||||
@@ -28,7 +30,11 @@
|
||||
~AccessibilityEventRecorderMac() override;
|
||||
|
||||
// Callback executed every time we receive an event notification.
|
||||
- void EventReceived(AXUIElementRef element, CFStringRef notification);
|
||||
+ void EventReceived(AXUIElementRef element,
|
||||
+ CFStringRef notification,
|
||||
+ CFDictionaryRef user_info);
|
||||
+ static std::string SerializeTextSelectionChangedProperties(
|
||||
+ CFDictionaryRef user_info);
|
||||
|
||||
private:
|
||||
// Add one notification to the list of notifications monitored by our
|
||||
@@ -54,10 +60,11 @@
|
||||
static void EventReceivedThunk(AXObserverRef observer_ref,
|
||||
AXUIElementRef element,
|
||||
CFStringRef notification,
|
||||
+ CFDictionaryRef user_info,
|
||||
void* refcon) {
|
||||
AccessibilityEventRecorderMac* this_ptr =
|
||||
static_cast<AccessibilityEventRecorderMac*>(refcon);
|
||||
- this_ptr->EventReceived(element, notification);
|
||||
+ this_ptr->EventReceived(element, notification, user_info);
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -95,8 +102,9 @@ static void EventReceivedThunk(AXObserverRef observer_ref,
|
||||
base::ProcessId pid,
|
||||
AXUIElementRef node)
|
||||
: AccessibilityEventRecorder(manager), observer_run_loop_source_(NULL) {
|
||||
- if (kAXErrorSuccess != AXObserverCreate(pid, EventReceivedThunk,
|
||||
- observer_ref_.InitializeInto())) {
|
||||
+ if (kAXErrorSuccess !=
|
||||
+ AXObserverCreateWithInfoCallback(pid, EventReceivedThunk,
|
||||
+ observer_ref_.InitializeInto())) {
|
||||
LOG(FATAL) << "Failed to create AXObserverRef";
|
||||
}
|
||||
|
||||
@@ -157,7 +165,8 @@ static void EventReceivedThunk(AXObserverRef observer_ref,
|
||||
}
|
||||
|
||||
void AccessibilityEventRecorderMac::EventReceived(AXUIElementRef element,
|
||||
- CFStringRef notification) {
|
||||
+ CFStringRef notification,
|
||||
+ CFDictionaryRef user_info) {
|
||||
std::string notification_str = base::SysCFStringRefToUTF8(notification);
|
||||
std::string role = GetAXAttributeValue(element, NSAccessibilityRoleAttribute);
|
||||
if (role.empty())
|
||||
@@ -180,7 +189,49 @@ static void EventReceivedThunk(AXObserverRef observer_ref,
|
||||
if (!value.empty())
|
||||
log += base::StringPrintf(" AXValue=\"%s\"", value.c_str());
|
||||
|
||||
+ if (notification_str ==
|
||||
+ base::SysNSStringToUTF8(NSAccessibilitySelectedTextChangedNotification))
|
||||
+ log += " " + SerializeTextSelectionChangedProperties(user_info);
|
||||
+
|
||||
OnEvent(log);
|
||||
}
|
||||
|
||||
+std::string
|
||||
+AccessibilityEventRecorderMac::SerializeTextSelectionChangedProperties(
|
||||
+ CFDictionaryRef user_info) {
|
||||
+ std::vector<std::string> serialized_info;
|
||||
+ CFDictionaryApplyFunction(
|
||||
+ user_info,
|
||||
+ [](const void* raw_key, const void* raw_value, void* context) {
|
||||
+ auto* key = static_cast<NSString*>(raw_key);
|
||||
+ auto* value = static_cast<NSObject*>(raw_value);
|
||||
+ auto* serialized_info = static_cast<std::vector<std::string>*>(context);
|
||||
+ std::string value_string;
|
||||
+ if ([key isEqual:ui::NSAccessibilityTextStateChangeTypeKey]) {
|
||||
+ value_string = ToString(static_cast<ui::AXTextStateChangeType>(
|
||||
+ [static_cast<NSNumber*>(value) intValue]));
|
||||
+ } else if ([key isEqual:ui::NSAccessibilityTextSelectionDirection]) {
|
||||
+ value_string = ToString(static_cast<ui::AXTextSelectionDirection>(
|
||||
+ [static_cast<NSNumber*>(value) intValue]));
|
||||
+ } else if ([key isEqual:ui::NSAccessibilityTextSelectionGranularity]) {
|
||||
+ value_string = ToString(static_cast<ui::AXTextSelectionGranularity>(
|
||||
+ [static_cast<NSNumber*>(value) intValue]));
|
||||
+ } else if ([key isEqual:ui::NSAccessibilityTextEditType]) {
|
||||
+ value_string = ToString(static_cast<ui::AXTextEditType>(
|
||||
+ [static_cast<NSNumber*>(value) intValue]));
|
||||
+ } else {
|
||||
+ return;
|
||||
+ }
|
||||
+ serialized_info->push_back(base::SysNSStringToUTF8(key) + "=" +
|
||||
+ value_string);
|
||||
+ },
|
||||
+ &serialized_info);
|
||||
+
|
||||
+ // Always sort the info so that we don't depend on CFDictionary for
|
||||
+ // consistent output ordering.
|
||||
+ std::sort(serialized_info.begin(), serialized_info.end());
|
||||
+
|
||||
+ return base::JoinString(serialized_info, " ");
|
||||
+}
|
||||
+
|
||||
} // namespace content
|
||||
diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.h b/content/browser/accessibility/browser_accessibility_manager_mac.h
|
||||
index b4043f56341e72bcf75ef71c56cb8cf9fc442579..925bfe1ea191ab846805fdbff1b0314e779b1c9e 100644
|
||||
--- a/content/browser/accessibility/browser_accessibility_manager_mac.h
|
||||
+++ b/content/browser/accessibility/browser_accessibility_manager_mac.h
|
||||
@@ -54,7 +54,8 @@ class CONTENT_EXPORT BrowserAccessibilityManagerMac
|
||||
const std::vector<Change>& changes) override;
|
||||
|
||||
// Returns an autoreleased object.
|
||||
- NSDictionary* GetUserInfoForSelectedTextChangedNotification();
|
||||
+ NSDictionary* GetUserInfoForSelectedTextChangedNotification(
|
||||
+ bool focus_changed);
|
||||
|
||||
// Returns an autoreleased object.
|
||||
NSDictionary* GetUserInfoForValueChangedNotification(
|
||||
diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
||||
index 68b8ccd88fb4ad6e4793a54869d5424f2a860d8a..4232959e30ab758bff58aa8e4457b6cdd3c7745b 100644
|
||||
--- a/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
||||
+++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
||||
@@ -19,91 +19,13 @@
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
|
||||
#include "ui/accessibility/ax_role_properties.h"
|
||||
+#include "ui/accessibility/platform/ax_private_webkit_constants_mac.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Use same value as in Safari's WebKit.
|
||||
const int kLiveRegionChangeIntervalMS = 20;
|
||||
|
||||
-// Declare undocumented accessibility constants and enums only present in
|
||||
-// WebKit.
|
||||
-
|
||||
-enum AXTextStateChangeType {
|
||||
- AXTextStateChangeTypeUnknown,
|
||||
- AXTextStateChangeTypeEdit,
|
||||
- AXTextStateChangeTypeSelectionMove,
|
||||
- AXTextStateChangeTypeSelectionExtend
|
||||
-};
|
||||
-
|
||||
-enum AXTextSelectionDirection {
|
||||
- AXTextSelectionDirectionUnknown,
|
||||
- AXTextSelectionDirectionBeginning,
|
||||
- AXTextSelectionDirectionEnd,
|
||||
- AXTextSelectionDirectionPrevious,
|
||||
- AXTextSelectionDirectionNext,
|
||||
- AXTextSelectionDirectionDiscontiguous
|
||||
-};
|
||||
-
|
||||
-enum AXTextSelectionGranularity {
|
||||
- AXTextSelectionGranularityUnknown,
|
||||
- AXTextSelectionGranularityCharacter,
|
||||
- AXTextSelectionGranularityWord,
|
||||
- AXTextSelectionGranularityLine,
|
||||
- AXTextSelectionGranularitySentence,
|
||||
- AXTextSelectionGranularityParagraph,
|
||||
- AXTextSelectionGranularityPage,
|
||||
- AXTextSelectionGranularityDocument,
|
||||
- AXTextSelectionGranularityAll
|
||||
-};
|
||||
-
|
||||
-enum AXTextEditType {
|
||||
- AXTextEditTypeUnknown,
|
||||
- AXTextEditTypeDelete,
|
||||
- AXTextEditTypeInsert,
|
||||
- AXTextEditTypeTyping,
|
||||
- AXTextEditTypeDictation,
|
||||
- AXTextEditTypeCut,
|
||||
- AXTextEditTypePaste,
|
||||
- AXTextEditTypeAttributesChange
|
||||
-};
|
||||
-
|
||||
-// Native mac notifications fired.
|
||||
-NSString* const NSAccessibilityAutocorrectionOccurredNotification =
|
||||
- @"AXAutocorrectionOccurred";
|
||||
-NSString* const NSAccessibilityLoadCompleteNotification = @"AXLoadComplete";
|
||||
-NSString* const NSAccessibilityInvalidStatusChangedNotification =
|
||||
- @"AXInvalidStatusChanged";
|
||||
-NSString* const NSAccessibilityLiveRegionCreatedNotification =
|
||||
- @"AXLiveRegionCreated";
|
||||
-NSString* const NSAccessibilityLiveRegionChangedNotification =
|
||||
- @"AXLiveRegionChanged";
|
||||
-NSString* const NSAccessibilityExpandedChanged = @"AXExpandedChanged";
|
||||
-NSString* const NSAccessibilityMenuItemSelectedNotification =
|
||||
- @"AXMenuItemSelected";
|
||||
-
|
||||
-// The following native mac notifications are not fired:
|
||||
-// AXLayoutComplete: Voiceover does not use this, it is considered too spammy.
|
||||
-
|
||||
-// Attributes used for NSAccessibilitySelectedTextChangedNotification and
|
||||
-// NSAccessibilityValueChangedNotification.
|
||||
-NSString* const NSAccessibilityTextStateChangeTypeKey =
|
||||
- @"AXTextStateChangeType";
|
||||
-NSString* const NSAccessibilityTextStateSyncKey = @"AXTextStateSync";
|
||||
-NSString* const NSAccessibilityTextSelectionDirection =
|
||||
- @"AXTextSelectionDirection";
|
||||
-NSString* const NSAccessibilityTextSelectionGranularity =
|
||||
- @"AXTextSelectionGranularity";
|
||||
-NSString* const NSAccessibilityTextSelectionChangedFocus =
|
||||
- @"AXTextSelectionChangedFocus";
|
||||
-NSString* const NSAccessibilityTextChangeElement = @"AXTextChangeElement";
|
||||
-NSString* const NSAccessibilityTextEditType = @"AXTextEditType";
|
||||
-NSString* const NSAccessibilityTextChangeValue = @"AXTextChangeValue";
|
||||
-NSString* const NSAccessibilityChangeValueStartMarker =
|
||||
- @"AXTextChangeValueStartMarker";
|
||||
-NSString* const NSAccessibilityTextChangeValueLength =
|
||||
- @"AXTextChangeValueLength";
|
||||
-NSString* const NSAccessibilityTextChangeValues = @"AXTextChangeValues";
|
||||
-
|
||||
} // namespace
|
||||
|
||||
namespace content {
|
||||
@@ -164,7 +86,7 @@
|
||||
NSString* mac_notification = nullptr;
|
||||
switch (event_type) {
|
||||
case ax::mojom::Event::kAutocorrectionOccured:
|
||||
- mac_notification = NSAccessibilityAutocorrectionOccurredNotification;
|
||||
+ mac_notification = ui::NSAccessibilityAutocorrectionOccurredNotification;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
@@ -203,6 +125,8 @@ void PostAnnouncementNotification(NSString* announcement) {
|
||||
auto native_node = ToBrowserAccessibilityCocoa(node);
|
||||
DCHECK(native_node);
|
||||
|
||||
+ bool focus_changed = GetFocus() != GetLastFocusedNode();
|
||||
+
|
||||
// Refer to |AXObjectCache::postPlatformNotification| in WebKit source code.
|
||||
NSString* mac_notification = nullptr;
|
||||
switch (event_type) {
|
||||
@@ -232,7 +156,7 @@ void PostAnnouncementNotification(NSString* announcement) {
|
||||
// |NSAccessibilityLoadCompleteNotification| should only be fired on the
|
||||
// top document and when the document is not Chrome's new tab page.
|
||||
if (IsRootTree() && !IsChromeNewTabPage()) {
|
||||
- mac_notification = NSAccessibilityLoadCompleteNotification;
|
||||
+ mac_notification = ui::NSAccessibilityLoadCompleteNotification;
|
||||
} else {
|
||||
// Voiceover moves focus to the web content when it receives an
|
||||
// AXLoadComplete event. On Chrome's new tab page, focus should stay
|
||||
@@ -242,7 +166,7 @@ void PostAnnouncementNotification(NSString* announcement) {
|
||||
}
|
||||
break;
|
||||
case ui::AXEventGenerator::Event::INVALID_STATUS_CHANGED:
|
||||
- mac_notification = NSAccessibilityInvalidStatusChangedNotification;
|
||||
+ mac_notification = ui::NSAccessibilityInvalidStatusChangedNotification;
|
||||
break;
|
||||
case ui::AXEventGenerator::Event::SELECTED_CHILDREN_CHANGED:
|
||||
if (ui::IsTableLike(node->GetRole())) {
|
||||
@@ -289,7 +213,7 @@ void PostAnnouncementNotification(NSString* announcement) {
|
||||
// API has been present on versions of OS X since 10.7 but doesn't
|
||||
// appear to be needed by Voiceover before version 10.11.
|
||||
NSDictionary* user_info =
|
||||
- GetUserInfoForSelectedTextChangedNotification();
|
||||
+ GetUserInfoForSelectedTextChangedNotification(focus_changed);
|
||||
|
||||
BrowserAccessibilityManager* root_manager = GetRootManager();
|
||||
if (!root_manager)
|
||||
@@ -342,11 +266,11 @@ void PostAnnouncementNotification(NSString* announcement) {
|
||||
}
|
||||
break;
|
||||
case ui::AXEventGenerator::Event::LIVE_REGION_CREATED:
|
||||
- mac_notification = NSAccessibilityLiveRegionCreatedNotification;
|
||||
+ mac_notification = ui::NSAccessibilityLiveRegionCreatedNotification;
|
||||
break;
|
||||
case ui::AXEventGenerator::Event::ALERT:
|
||||
NSAccessibilityPostNotification(
|
||||
- native_node, NSAccessibilityLiveRegionCreatedNotification);
|
||||
+ native_node, ui::NSAccessibilityLiveRegionCreatedNotification);
|
||||
// Voiceover requires a live region changed notification to actually
|
||||
// announce the live region.
|
||||
FireGeneratedEvent(ui::AXEventGenerator::Event::LIVE_REGION_CHANGED,
|
||||
@@ -359,7 +283,7 @@ void PostAnnouncementNotification(NSString* announcement) {
|
||||
|
||||
if (never_suppress_or_delay_events_for_testing_) {
|
||||
NSAccessibilityPostNotification(
|
||||
- native_node, NSAccessibilityLiveRegionChangedNotification);
|
||||
+ native_node, ui::NSAccessibilityLiveRegionChangedNotification);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -383,7 +307,7 @@ void PostAnnouncementNotification(NSString* announcement) {
|
||||
[](base::scoped_nsobject<BrowserAccessibilityCocoa> node) {
|
||||
if (node && [node instanceActive]) {
|
||||
NSAccessibilityPostNotification(
|
||||
- node, NSAccessibilityLiveRegionChangedNotification);
|
||||
+ node, ui::NSAccessibilityLiveRegionChangedNotification);
|
||||
}
|
||||
},
|
||||
std::move(retained_node)),
|
||||
@@ -398,7 +322,7 @@ void PostAnnouncementNotification(NSString* announcement) {
|
||||
node->GetRole() == ax::mojom::Role::kTreeItem) {
|
||||
mac_notification = NSAccessibilityRowExpandedNotification;
|
||||
} else {
|
||||
- mac_notification = NSAccessibilityExpandedChanged;
|
||||
+ mac_notification = ui::NSAccessibilityExpandedChanged;
|
||||
}
|
||||
break;
|
||||
case ui::AXEventGenerator::Event::COLLAPSED:
|
||||
@@ -406,11 +330,11 @@ void PostAnnouncementNotification(NSString* announcement) {
|
||||
node->GetRole() == ax::mojom::Role::kTreeItem) {
|
||||
mac_notification = NSAccessibilityRowCollapsedNotification;
|
||||
} else {
|
||||
- mac_notification = NSAccessibilityExpandedChanged;
|
||||
+ mac_notification = ui::NSAccessibilityExpandedChanged;
|
||||
}
|
||||
break;
|
||||
case ui::AXEventGenerator::Event::MENU_ITEM_SELECTED:
|
||||
- mac_notification = NSAccessibilityMenuItemSelectedNotification;
|
||||
+ mac_notification = ui::NSAccessibilityMenuItemSelectedNotification;
|
||||
break;
|
||||
case ui::AXEventGenerator::Event::ACCESS_KEY_CHANGED:
|
||||
case ui::AXEventGenerator::Event::ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED:
|
||||
@@ -514,18 +438,32 @@ void PostAnnouncementNotification(NSString* announcement) {
|
||||
}
|
||||
}
|
||||
|
||||
-NSDictionary* BrowserAccessibilityManagerMac::
|
||||
- GetUserInfoForSelectedTextChangedNotification() {
|
||||
+NSDictionary*
|
||||
+BrowserAccessibilityManagerMac::GetUserInfoForSelectedTextChangedNotification(
|
||||
+ bool focus_changed) {
|
||||
NSMutableDictionary* user_info =
|
||||
[[[NSMutableDictionary alloc] init] autorelease];
|
||||
- [user_info setObject:@YES forKey:NSAccessibilityTextStateSyncKey];
|
||||
- [user_info setObject:@(AXTextStateChangeTypeUnknown)
|
||||
- forKey:NSAccessibilityTextStateChangeTypeKey];
|
||||
- [user_info setObject:@(AXTextSelectionDirectionUnknown)
|
||||
- forKey:NSAccessibilityTextSelectionDirection];
|
||||
- [user_info setObject:@(AXTextSelectionGranularityUnknown)
|
||||
- forKey:NSAccessibilityTextSelectionGranularity];
|
||||
- [user_info setObject:@YES forKey:NSAccessibilityTextSelectionChangedFocus];
|
||||
+ [user_info setObject:@YES forKey:ui::NSAccessibilityTextStateSyncKey];
|
||||
+ [user_info setObject:@(ui::AXTextSelectionDirectionUnknown)
|
||||
+ forKey:ui::NSAccessibilityTextSelectionDirection];
|
||||
+ [user_info setObject:@(ui::AXTextSelectionGranularityUnknown)
|
||||
+ forKey:ui::NSAccessibilityTextSelectionGranularity];
|
||||
+ [user_info setObject:@YES
|
||||
+ forKey:ui::NSAccessibilityTextSelectionChangedFocus];
|
||||
+
|
||||
+ // Try to detect when the text selection changes due to a focus change.
|
||||
+ // This is necessary so that VoiceOver also anounces information about the
|
||||
+ // element that contains this selection.
|
||||
+ // TODO(mrobinson): Determine definitively what the type of this text
|
||||
+ // selection change is. This requires passing this information here from
|
||||
+ // blink.
|
||||
+ if (focus_changed) {
|
||||
+ [user_info setObject:@(ui::AXTextStateChangeTypeSelectionMove)
|
||||
+ forKey:ui::NSAccessibilityTextStateChangeTypeKey];
|
||||
+ } else {
|
||||
+ [user_info setObject:@(ui::AXTextStateChangeTypeUnknown)
|
||||
+ forKey:ui::NSAccessibilityTextStateChangeTypeKey];
|
||||
+ }
|
||||
|
||||
int32_t focus_id = ax_tree()->GetUnignoredSelection().focus_object_id;
|
||||
BrowserAccessibility* focus_object = GetFromID(focus_id);
|
||||
@@ -534,7 +472,7 @@ void PostAnnouncementNotification(NSString* announcement) {
|
||||
auto native_focus_object = ToBrowserAccessibilityCocoa(focus_object);
|
||||
if (native_focus_object && [native_focus_object instanceActive]) {
|
||||
[user_info setObject:native_focus_object
|
||||
- forKey:NSAccessibilityTextChangeElement];
|
||||
+ forKey:ui::NSAccessibilityTextChangeElement];
|
||||
|
||||
#ifndef MAS_BUILD
|
||||
id selected_text = [native_focus_object selectedTextMarkerRange];
|
||||
@@ -565,38 +503,39 @@ void PostAnnouncementNotification(NSString* announcement) {
|
||||
if (!deleted_text.empty()) {
|
||||
NSMutableDictionary* change =
|
||||
[NSMutableDictionary dictionaryWithDictionary:@{
|
||||
- NSAccessibilityTextEditType : @(AXTextEditTypeDelete),
|
||||
- NSAccessibilityTextChangeValueLength : @(deleted_text.length()),
|
||||
- NSAccessibilityTextChangeValue :
|
||||
+ ui::NSAccessibilityTextEditType : @(ui::AXTextEditTypeDelete),
|
||||
+ ui::NSAccessibilityTextChangeValueLength : @(deleted_text.length()),
|
||||
+ ui::NSAccessibilityTextChangeValue :
|
||||
base::SysUTF16ToNSString(deleted_text)
|
||||
}];
|
||||
if (edit_text_marker) {
|
||||
- change[NSAccessibilityChangeValueStartMarker] = edit_text_marker;
|
||||
+ change[ui::NSAccessibilityChangeValueStartMarker] = edit_text_marker;
|
||||
}
|
||||
[changes addObject:change];
|
||||
}
|
||||
if (!inserted_text.empty()) {
|
||||
// TODO(nektar): Figure out if this is a paste, insertion or typing.
|
||||
// Changes to Blink would be required. A heuristic is currently used.
|
||||
- auto edit_type = inserted_text.length() > 1 ? @(AXTextEditTypeInsert)
|
||||
- : @(AXTextEditTypeTyping);
|
||||
+ auto edit_type = inserted_text.length() > 1 ? @(ui::AXTextEditTypeInsert)
|
||||
+ : @(ui::AXTextEditTypeTyping);
|
||||
NSMutableDictionary* change =
|
||||
[NSMutableDictionary dictionaryWithDictionary:@{
|
||||
- NSAccessibilityTextEditType : edit_type,
|
||||
- NSAccessibilityTextChangeValueLength : @(inserted_text.length()),
|
||||
- NSAccessibilityTextChangeValue :
|
||||
+ ui::NSAccessibilityTextEditType : edit_type,
|
||||
+ ui::NSAccessibilityTextChangeValueLength : @(inserted_text.length()),
|
||||
+ ui::NSAccessibilityTextChangeValue :
|
||||
base::SysUTF16ToNSString(inserted_text)
|
||||
}];
|
||||
if (edit_text_marker) {
|
||||
- change[NSAccessibilityChangeValueStartMarker] = edit_text_marker;
|
||||
+ change[ui::NSAccessibilityChangeValueStartMarker] = edit_text_marker;
|
||||
}
|
||||
[changes addObject:change];
|
||||
}
|
||||
|
||||
return @{
|
||||
- NSAccessibilityTextStateChangeTypeKey : @(AXTextStateChangeTypeEdit),
|
||||
- NSAccessibilityTextChangeValues : changes,
|
||||
- NSAccessibilityTextChangeElement : native_node
|
||||
+ ui::
|
||||
+ NSAccessibilityTextStateChangeTypeKey : @(ui::AXTextStateChangeTypeEdit),
|
||||
+ ui::NSAccessibilityTextChangeValues : changes,
|
||||
+ ui::NSAccessibilityTextChangeElement : native_node
|
||||
};
|
||||
}
|
||||
|
||||
diff --git a/content/test/data/accessibility/event/aria-combo-box-focus-expected-mac.txt b/content/test/data/accessibility/event/aria-combo-box-focus-expected-mac.txt
|
||||
index ad5e2bf2c8029185c51eecc94cac1dbe7608c99e..67e07a89f77f7c61a57eb51cecea211df5227341 100644
|
||||
--- a/content/test/data/accessibility/event/aria-combo-box-focus-expected-mac.txt
|
||||
+++ b/content/test/data/accessibility/event/aria-combo-box-focus-expected-mac.txt
|
||||
@@ -1,3 +1,3 @@
|
||||
AXFocusedUIElementChanged on AXStaticText AXValue="Apple not selected"
|
||||
-AXSelectedTextChanged on AXStaticText AXValue="Apple not selected"
|
||||
-AXSelectedTextChanged on AXWebArea
|
||||
\ No newline at end of file
|
||||
+AXSelectedTextChanged on AXStaticText AXValue="Apple not selected" AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeSelectionMove
|
||||
+AXSelectedTextChanged on AXWebArea AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeSelectionMove
|
||||
diff --git a/content/test/data/accessibility/event/caret-browsing-disabled-expected-mac.txt b/content/test/data/accessibility/event/caret-browsing-disabled-expected-mac.txt
|
||||
index ec0b74d984ade9928705242f9b0682a743e20fb2..87447c5a4b14efde5b64b1d340a3fa2fb6574b80 100644
|
||||
--- a/content/test/data/accessibility/event/caret-browsing-disabled-expected-mac.txt
|
||||
+++ b/content/test/data/accessibility/event/caret-browsing-disabled-expected-mac.txt
|
||||
@@ -1,5 +1,5 @@
|
||||
-AXSelectedTextChanged on AXWebArea
|
||||
-AXSelectedTextChanged on AXWebArea
|
||||
+AXSelectedTextChanged on AXWebArea AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeUnknown
|
||||
+AXSelectedTextChanged on AXWebArea AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeUnknown
|
||||
=== Start Continuation ===
|
||||
-AXSelectedTextChanged on AXWebArea
|
||||
-AXSelectedTextChanged on AXWebArea
|
||||
+AXSelectedTextChanged on AXWebArea AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeUnknown
|
||||
+AXSelectedTextChanged on AXWebArea AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeUnknown
|
||||
diff --git a/content/test/data/accessibility/event/caret-browsing-enabled-expected-mac.txt b/content/test/data/accessibility/event/caret-browsing-enabled-expected-mac.txt
|
||||
index ec0b74d984ade9928705242f9b0682a743e20fb2..87447c5a4b14efde5b64b1d340a3fa2fb6574b80 100644
|
||||
--- a/content/test/data/accessibility/event/caret-browsing-enabled-expected-mac.txt
|
||||
+++ b/content/test/data/accessibility/event/caret-browsing-enabled-expected-mac.txt
|
||||
@@ -1,5 +1,5 @@
|
||||
-AXSelectedTextChanged on AXWebArea
|
||||
-AXSelectedTextChanged on AXWebArea
|
||||
+AXSelectedTextChanged on AXWebArea AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeUnknown
|
||||
+AXSelectedTextChanged on AXWebArea AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeUnknown
|
||||
=== Start Continuation ===
|
||||
-AXSelectedTextChanged on AXWebArea
|
||||
-AXSelectedTextChanged on AXWebArea
|
||||
+AXSelectedTextChanged on AXWebArea AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeUnknown
|
||||
+AXSelectedTextChanged on AXWebArea AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeUnknown
|
||||
diff --git a/content/test/data/accessibility/event/text-selection-changed-expected-mac.txt b/content/test/data/accessibility/event/text-selection-changed-expected-mac.txt
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9213c873393d595bba8796cdb0e2325d3ee37ee9
|
||||
--- /dev/null
|
||||
+++ b/content/test/data/accessibility/event/text-selection-changed-expected-mac.txt
|
||||
@@ -0,0 +1,10 @@
|
||||
+AXSelectedTextChanged on AXWebArea AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeUnknown
|
||||
+AXSelectedTextChanged on AXWebArea AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeUnknown
|
||||
+=== Start Continuation ===
|
||||
+AXFocusedUIElementChanged on AXTextField AXDescription="input" AXValue="input"
|
||||
+AXSelectedTextChanged on AXTextField AXDescription="input" AXValue="input" AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeSelectionMove
|
||||
+AXSelectedTextChanged on AXWebArea AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeSelectionMove
|
||||
+=== Start Continuation ===
|
||||
+AXFocusedUIElementChanged on AXTextArea AXDescription="textarea"
|
||||
+AXSelectedTextChanged on AXTextArea AXDescription="textarea" AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeSelectionMove
|
||||
+AXSelectedTextChanged on AXWebArea AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeSelectionMove
|
||||
diff --git a/ui/accessibility/platform/BUILD.gn b/ui/accessibility/platform/BUILD.gn
|
||||
index 2f015b939bb6835f2ff817ce6c960157eaf32342..eafddade0f7fa8ab8d008bf4888fc9ecef85463d 100644
|
||||
--- a/ui/accessibility/platform/BUILD.gn
|
||||
+++ b/ui/accessibility/platform/BUILD.gn
|
||||
@@ -110,6 +110,8 @@ source_set("platform") {
|
||||
"ax_event_intent_mac.mm",
|
||||
"ax_platform_node_mac.h",
|
||||
"ax_platform_node_mac.mm",
|
||||
+ "ax_private_webkit_constants_mac.h",
|
||||
+ "ax_private_webkit_constants_mac.mm",
|
||||
]
|
||||
|
||||
frameworks = [
|
||||
diff --git a/ui/accessibility/platform/ax_private_webkit_constants_mac.h b/ui/accessibility/platform/ax_private_webkit_constants_mac.h
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5f1776a3aeac89b70d6d852b8e5209a1208271ae
|
||||
--- /dev/null
|
||||
+++ b/ui/accessibility/platform/ax_private_webkit_constants_mac.h
|
||||
@@ -0,0 +1,96 @@
|
||||
+// Copyright 2020 The Chromium Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+#ifndef UI_ACCESSIBILITY_PLATFORM_AX_PRIVATE_WEBKIT_CONSTANTS_MAC_H_
|
||||
+#define UI_ACCESSIBILITY_PLATFORM_AX_PRIVATE_WEBKIT_CONSTANTS_MAC_H_
|
||||
+
|
||||
+#import <Cocoa/Cocoa.h>
|
||||
+#include "ui/accessibility/ax_export.h"
|
||||
+
|
||||
+namespace ui {
|
||||
+
|
||||
+enum AXTextStateChangeType {
|
||||
+ AXTextStateChangeTypeUnknown,
|
||||
+ AXTextStateChangeTypeEdit,
|
||||
+ AXTextStateChangeTypeSelectionMove,
|
||||
+ AXTextStateChangeTypeSelectionExtend
|
||||
+};
|
||||
+
|
||||
+enum AXTextSelectionDirection {
|
||||
+ AXTextSelectionDirectionUnknown,
|
||||
+ AXTextSelectionDirectionBeginning,
|
||||
+ AXTextSelectionDirectionEnd,
|
||||
+ AXTextSelectionDirectionPrevious,
|
||||
+ AXTextSelectionDirectionNext,
|
||||
+ AXTextSelectionDirectionDiscontiguous
|
||||
+};
|
||||
+
|
||||
+enum AXTextSelectionGranularity {
|
||||
+ AXTextSelectionGranularityUnknown,
|
||||
+ AXTextSelectionGranularityCharacter,
|
||||
+ AXTextSelectionGranularityWord,
|
||||
+ AXTextSelectionGranularityLine,
|
||||
+ AXTextSelectionGranularitySentence,
|
||||
+ AXTextSelectionGranularityParagraph,
|
||||
+ AXTextSelectionGranularityPage,
|
||||
+ AXTextSelectionGranularityDocument,
|
||||
+ AXTextSelectionGranularityAll
|
||||
+};
|
||||
+
|
||||
+enum AXTextEditType {
|
||||
+ AXTextEditTypeUnknown,
|
||||
+ AXTextEditTypeDelete,
|
||||
+ AXTextEditTypeInsert,
|
||||
+ AXTextEditTypeTyping,
|
||||
+ AXTextEditTypeDictation,
|
||||
+ AXTextEditTypeCut,
|
||||
+ AXTextEditTypePaste,
|
||||
+ AXTextEditTypeAttributesChange
|
||||
+};
|
||||
+
|
||||
+// Native mac notifications fired.
|
||||
+NSString* const NSAccessibilityAutocorrectionOccurredNotification =
|
||||
+ @"AXAutocorrectionOccurred";
|
||||
+NSString* const NSAccessibilityLoadCompleteNotification = @"AXLoadComplete";
|
||||
+NSString* const NSAccessibilityInvalidStatusChangedNotification =
|
||||
+ @"AXInvalidStatusChanged";
|
||||
+NSString* const NSAccessibilityLiveRegionCreatedNotification =
|
||||
+ @"AXLiveRegionCreated";
|
||||
+NSString* const NSAccessibilityLiveRegionChangedNotification =
|
||||
+ @"AXLiveRegionChanged";
|
||||
+NSString* const NSAccessibilityExpandedChanged = @"AXExpandedChanged";
|
||||
+NSString* const NSAccessibilityMenuItemSelectedNotification =
|
||||
+ @"AXMenuItemSelected";
|
||||
+
|
||||
+// The following native mac notifications are not fired:
|
||||
+// AXLayoutComplete: Voiceover does not use this, it is considered too spammy.
|
||||
+
|
||||
+// Attributes used for NSAccessibilitySelectedTextChangedNotification and
|
||||
+// NSAccessibilityValueChangedNotification.
|
||||
+NSString* const NSAccessibilityTextStateChangeTypeKey =
|
||||
+ @"AXTextStateChangeType";
|
||||
+NSString* const NSAccessibilityTextStateSyncKey = @"AXTextStateSync";
|
||||
+NSString* const NSAccessibilityTextSelectionDirection =
|
||||
+ @"AXTextSelectionDirection";
|
||||
+NSString* const NSAccessibilityTextSelectionGranularity =
|
||||
+ @"AXTextSelectionGranularity";
|
||||
+NSString* const NSAccessibilityTextSelectionChangedFocus =
|
||||
+ @"AXTextSelectionChangedFocus";
|
||||
+NSString* const NSAccessibilityTextChangeElement = @"AXTextChangeElement";
|
||||
+NSString* const NSAccessibilityTextEditType = @"AXTextEditType";
|
||||
+NSString* const NSAccessibilityTextChangeValue = @"AXTextChangeValue";
|
||||
+NSString* const NSAccessibilityChangeValueStartMarker =
|
||||
+ @"AXTextChangeValueStartMarker";
|
||||
+NSString* const NSAccessibilityTextChangeValueLength =
|
||||
+ @"AXTextChangeValueLength";
|
||||
+NSString* const NSAccessibilityTextChangeValues = @"AXTextChangeValues";
|
||||
+
|
||||
+AX_EXPORT const char* ToString(AXTextStateChangeType);
|
||||
+AX_EXPORT const char* ToString(AXTextSelectionDirection);
|
||||
+AX_EXPORT const char* ToString(AXTextSelectionGranularity);
|
||||
+AX_EXPORT const char* ToString(AXTextEditType);
|
||||
+
|
||||
+} // namespace ui
|
||||
+
|
||||
+#endif // UI_ACCESSIBILITY_PLATFORM_AX_PRIVATE_WEBKIT_CONSTANTS_MAC_H_
|
||||
diff --git a/ui/accessibility/platform/ax_private_webkit_constants_mac.mm b/ui/accessibility/platform/ax_private_webkit_constants_mac.mm
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7de31a487dd6e0e6a4af2f4fa62e463f41a0d96a
|
||||
--- /dev/null
|
||||
+++ b/ui/accessibility/platform/ax_private_webkit_constants_mac.mm
|
||||
@@ -0,0 +1,91 @@
|
||||
+// Copyright 2020 The Chromium Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+#include "ui/accessibility/platform/ax_private_webkit_constants_mac.h"
|
||||
+
|
||||
+namespace ui {
|
||||
+
|
||||
+const char* ToString(AXTextStateChangeType type) {
|
||||
+ switch (type) {
|
||||
+ case AXTextStateChangeTypeUnknown:
|
||||
+ return "AXTextStateChangeTypeUnknown";
|
||||
+ case AXTextStateChangeTypeEdit:
|
||||
+ return "AXTextStateChangeTypeEdit";
|
||||
+ case AXTextStateChangeTypeSelectionMove:
|
||||
+ return "AXTextStateChangeTypeSelectionMove";
|
||||
+ case AXTextStateChangeTypeSelectionExtend:
|
||||
+ return "AXTextStateChangeTypeSelectionExtend";
|
||||
+ }
|
||||
+
|
||||
+ return "";
|
||||
+}
|
||||
+
|
||||
+const char* ToString(AXTextSelectionDirection direction) {
|
||||
+ switch (direction) {
|
||||
+ case AXTextSelectionDirectionUnknown:
|
||||
+ return "AXTextSelectionDirectionUnknown";
|
||||
+ case AXTextSelectionDirectionBeginning:
|
||||
+ return "AXTextSelectionDirectionBeginning";
|
||||
+ case AXTextSelectionDirectionEnd:
|
||||
+ return "AXTextSelectionDirectionEnd";
|
||||
+ case AXTextSelectionDirectionPrevious:
|
||||
+ return "AXTextSelectionDirectionPrevious";
|
||||
+ case AXTextSelectionDirectionNext:
|
||||
+ return "AXTextSelectionDirectionNext";
|
||||
+ case AXTextSelectionDirectionDiscontiguous:
|
||||
+ return "AXTextSelectionDirectionDiscontiguous";
|
||||
+ }
|
||||
+
|
||||
+ return "";
|
||||
+}
|
||||
+
|
||||
+const char* ToString(AXTextSelectionGranularity granularity) {
|
||||
+ switch (granularity) {
|
||||
+ case AXTextSelectionGranularityUnknown:
|
||||
+ return "AXTextSelectionGranularityUnknown";
|
||||
+ case AXTextSelectionGranularityCharacter:
|
||||
+ return "AXTextSelectionGranularityCharacter";
|
||||
+ case AXTextSelectionGranularityWord:
|
||||
+ return "AXTextSelectionGranularityWord";
|
||||
+ case AXTextSelectionGranularityLine:
|
||||
+ return "AXTextSelectionGranularityLine";
|
||||
+ case AXTextSelectionGranularitySentence:
|
||||
+ return "AXTextSelectionGranularitySentence";
|
||||
+ case AXTextSelectionGranularityParagraph:
|
||||
+ return "AXTextSelectionGranularityParagraph";
|
||||
+ case AXTextSelectionGranularityPage:
|
||||
+ return "AXTextSelectionGranularityPage";
|
||||
+ case AXTextSelectionGranularityDocument:
|
||||
+ return "AXTextSelectionGranularityDocument";
|
||||
+ case AXTextSelectionGranularityAll:
|
||||
+ return "AXTextSelectionGranularityAll";
|
||||
+ }
|
||||
+
|
||||
+ return "";
|
||||
+}
|
||||
+
|
||||
+const char* ToString(AXTextEditType type) {
|
||||
+ switch (type) {
|
||||
+ case AXTextEditTypeUnknown:
|
||||
+ return "AXTextEditTypeUnknown";
|
||||
+ case AXTextEditTypeDelete:
|
||||
+ return "AXTextEditTypeDelete";
|
||||
+ case AXTextEditTypeInsert:
|
||||
+ return "AXTextEditTypeInsert";
|
||||
+ case AXTextEditTypeTyping:
|
||||
+ return "AXTextEditTypeTyping";
|
||||
+ case AXTextEditTypeDictation:
|
||||
+ return "AXTextEditTypeDictation";
|
||||
+ case AXTextEditTypeCut:
|
||||
+ return "AXTextEditTypeCut";
|
||||
+ case AXTextEditTypePaste:
|
||||
+ return "AXTextEditTypePaste";
|
||||
+ case AXTextEditTypeAttributesChange:
|
||||
+ return "AXTextEditTypeAttributesChange";
|
||||
+ }
|
||||
+
|
||||
+ return "";
|
||||
+}
|
||||
+
|
||||
+} // namespace ui
|
||||
115
patches/chromium/cherry-pick-8f5a08079948.patch
Normal file
115
patches/chromium/cherry-pick-8f5a08079948.patch
Normal file
@@ -0,0 +1,115 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Robinson <mrobinson@igalia.com>
|
||||
Date: Mon, 26 Oct 2020 23:12:55 +0000
|
||||
Subject: Expose a11y popup menu type via the name "AXPopupValue" on Mac
|
||||
|
||||
This value was exposed via the name "AXHasPopupValue", while WebKit
|
||||
exposes this value via "AXPopupValue." Fix the attribute name, which in
|
||||
turn fixes an issue with how popup buttons are announced in VoiceOver.
|
||||
|
||||
Bug: 1129678
|
||||
Change-Id: Iede26b2fd6ddb9d7717fcb47fd1dd1cce5b74075
|
||||
AX-Relnotes: Fix an issue with the announcement of popup buttons in VoiceOver.
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2489985
|
||||
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
|
||||
Reviewed-by: Aaron Leventhal <aleventhal@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/master@{#820964}
|
||||
|
||||
diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/content/browser/accessibility/browser_accessibility_cocoa.mm
|
||||
index 3abd9933ab325bda6cb486a41fd6c8b246aa8e71..17aa494d6473866721a8cc5f4c5c646af9307d93 100644
|
||||
--- a/content/browser/accessibility/browser_accessibility_cocoa.mm
|
||||
+++ b/content/browser/accessibility/browser_accessibility_cocoa.mm
|
||||
@@ -92,7 +92,7 @@
|
||||
@"AXFocusableAncestor";
|
||||
NSString* const NSAccessibilityGrabbedAttribute = @"AXGrabbed";
|
||||
NSString* const NSAccessibilityHasPopupAttribute = @"AXHasPopup";
|
||||
-NSString* const NSAccessibilityHasPopupValueAttribute = @"AXHasPopupValue";
|
||||
+NSString* const NSAccessibilityPopupValueAttribute = @"AXPopupValue";
|
||||
NSString* const NSAccessibilityHighestEditableAncestorAttribute =
|
||||
@"AXHighestEditableAncestor";
|
||||
NSString* const NSAccessibilityInvalidAttribute = @"AXInvalid";
|
||||
@@ -836,7 +836,7 @@ + (void)initialize {
|
||||
{NSAccessibilityGrabbedAttribute, @"grabbed"},
|
||||
{NSAccessibilityHeaderAttribute, @"header"},
|
||||
{NSAccessibilityHasPopupAttribute, @"hasPopup"},
|
||||
- {NSAccessibilityHasPopupValueAttribute, @"hasPopupValue"},
|
||||
+ {NSAccessibilityPopupValueAttribute, @"popupValue"},
|
||||
{NSAccessibilityHelpAttribute, @"help"},
|
||||
{NSAccessibilityHighestEditableAncestorAttribute,
|
||||
@"highestEditableAncestor"},
|
||||
@@ -1411,7 +1411,7 @@ - (NSNumber*)hasPopup {
|
||||
return @(_owner->HasIntAttribute(ax::mojom::IntAttribute::kHasPopup));
|
||||
}
|
||||
|
||||
-- (NSString*)hasPopupValue {
|
||||
+- (NSString*)popupValue {
|
||||
if (![self instanceActive])
|
||||
return nil;
|
||||
int hasPopup = _owner->GetIntAttribute(ax::mojom::IntAttribute::kHasPopup);
|
||||
@@ -3586,7 +3586,7 @@ - (NSArray*)accessibilityAttributeNames {
|
||||
|
||||
if (_owner->HasIntAttribute(ax::mojom::IntAttribute::kHasPopup)) {
|
||||
[ret addObjectsFromArray:@[
|
||||
- NSAccessibilityHasPopupAttribute, NSAccessibilityHasPopupValueAttribute
|
||||
+ NSAccessibilityHasPopupAttribute, NSAccessibilityPopupValueAttribute
|
||||
]];
|
||||
}
|
||||
|
||||
diff --git a/content/test/data/accessibility/aria/aria-haspopup-expected-mac.txt b/content/test/data/accessibility/aria/aria-haspopup-expected-mac.txt
|
||||
index e988b9fe7d061fa3aa6930ababa4f32c095bd8a3..de0f31f2065490d6085027e2800706a3926bcf5b 100644
|
||||
--- a/content/test/data/accessibility/aria/aria-haspopup-expected-mac.txt
|
||||
+++ b/content/test/data/accessibility/aria/aria-haspopup-expected-mac.txt
|
||||
@@ -1,10 +1,10 @@
|
||||
AXWebArea
|
||||
-++AXPopUpButton AXHasPopup=1 AXHasPopupValue='menu'
|
||||
+++AXPopUpButton AXHasPopup=1 AXPopupValue='menu'
|
||||
++AXPopUpButton
|
||||
-++AXPopUpButton AXHasPopup=1 AXHasPopupValue='menu'
|
||||
-++AXPopUpButton AXHasPopup=1 AXHasPopupValue='listbox'
|
||||
-++AXPopUpButton AXHasPopup=1 AXHasPopupValue='grid'
|
||||
-++AXPopUpButton AXHasPopup=1 AXHasPopupValue='dialog'
|
||||
-++AXPopUpButton AXHasPopup=1 AXHasPopupValue='menu'
|
||||
-++AXPopUpButton AXHasPopup=1 AXHasPopupValue='listbox'
|
||||
-++AXPopUpButton AXHasPopup=1 AXHasPopupValue='listbox'
|
||||
+++AXPopUpButton AXHasPopup=1 AXPopupValue='menu'
|
||||
+++AXPopUpButton AXHasPopup=1 AXPopupValue='listbox'
|
||||
+++AXPopUpButton AXHasPopup=1 AXPopupValue='grid'
|
||||
+++AXPopUpButton AXHasPopup=1 AXPopupValue='dialog'
|
||||
+++AXPopUpButton AXHasPopup=1 AXPopupValue='menu'
|
||||
+++AXPopUpButton AXHasPopup=1 AXPopupValue='listbox'
|
||||
+++AXPopUpButton AXHasPopup=1 AXPopupValue='listbox'
|
||||
diff --git a/content/test/data/accessibility/aria/aria-haspopup.html b/content/test/data/accessibility/aria/aria-haspopup.html
|
||||
index 026397c4e9ad805f5facfc499cc986cd0763aef3..7d982745e89b8346bf71eee90110fe6a96648629 100644
|
||||
--- a/content/test/data/accessibility/aria/aria-haspopup.html
|
||||
+++ b/content/test/data/accessibility/aria/aria-haspopup.html
|
||||
@@ -3,7 +3,7 @@
|
||||
@MAC-ALLOW:AXShowMenu*
|
||||
@MAC-ALLOW:AXPress*
|
||||
@MAC-ALLOW:AXHasPopup
|
||||
-@MAC-ALLOW:AXHasPopupValue
|
||||
+@MAC-ALLOW:AXPopupValue
|
||||
@WIN-ALLOW:EXPANDED*
|
||||
@WIN-ALLOW:HASPOPUP*
|
||||
@WIN-ALLOW:haspopup*
|
||||
diff --git a/content/test/data/accessibility/html/input-suggestions-source-element-expected-mac.txt b/content/test/data/accessibility/html/input-suggestions-source-element-expected-mac.txt
|
||||
index 4b0bde650deed34edead37ffabd3eda2d7a82b49..38ca751991f564f9a24ba131652014f161d4b996 100644
|
||||
--- a/content/test/data/accessibility/html/input-suggestions-source-element-expected-mac.txt
|
||||
+++ b/content/test/data/accessibility/html/input-suggestions-source-element-expected-mac.txt
|
||||
@@ -1,3 +1,3 @@
|
||||
AXWebArea AXRoleDescription='HTML content'
|
||||
++AXGroup AXRoleDescription='group'
|
||||
-++++AXComboBox AXAutocompleteValue='list' AXHasPopup=1 AXHasPopupValue='listbox' AXRoleDescription='combo box'
|
||||
+++++AXComboBox AXAutocompleteValue='list' AXHasPopup=1 AXPopupValue='listbox' AXRoleDescription='combo box'
|
||||
diff --git a/content/test/data/accessibility/html/input-suggestions-source-element.html b/content/test/data/accessibility/html/input-suggestions-source-element.html
|
||||
index 039ac5855e1122b34dad0c1fae42f798791b7890..d024f17de3d3b04029c532e616140e20afa87549 100644
|
||||
--- a/content/test/data/accessibility/html/input-suggestions-source-element.html
|
||||
+++ b/content/test/data/accessibility/html/input-suggestions-source-element.html
|
||||
@@ -1,7 +1,7 @@
|
||||
<!--
|
||||
@MAC-ALLOW:AXRoleDescription
|
||||
@MAC-ALLOW:AXHasPopup
|
||||
-@MAC-ALLOW:AXHasPopupValue
|
||||
+@MAC-ALLOW:AXPopupValue
|
||||
@WIN-ALLOW:haspopup*
|
||||
@AURALINUX-ALLOW:haspopup*
|
||||
@AURALINUX-ALLOW:supports-autocompletion
|
||||
@@ -7,7 +7,7 @@ spellchecker uses a few IDS_ resources. We need to load these from
|
||||
Electrons grit header instead of Chromes
|
||||
|
||||
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
|
||||
index 4dd4cabe46e19061e944174a64ef7b6ee5b49737..d4272b70b2c6861ff6003bd000ab7639caf41160 100644
|
||||
index 62ddc2d8548bcac4d55bbc7283426c426fecf254..b0eb803cd132390d492b82600d8629e2c43cc72e 100644
|
||||
--- a/chrome/browser/BUILD.gn
|
||||
+++ b/chrome/browser/BUILD.gn
|
||||
@@ -5960,6 +5960,7 @@ static_library("browser") {
|
||||
|
||||
@@ -75,10 +75,10 @@ index aaa9ad1d58d7f584cbf391e0cb0a61a0d25d5c69..5b02834b5ecaf4bcb7e051d9ee98cd5e
|
||||
// Used by WebView to sample crashes without generating the unwanted dumps. If
|
||||
// the returned value is less than 100, crash dumping will be sampled to that
|
||||
diff --git a/components/crash/core/app/crashpad_mac.mm b/components/crash/core/app/crashpad_mac.mm
|
||||
index aa7c3302f2e3fc7129381b355ed4fa1bc386f8cb..d7dd05118f3c90f5ab570f59685c43bd180885e5 100644
|
||||
index eb675321436a53e82432144d43f258bed6e938e2..ae2032a12eac7c789d790e53857d11ba3e03d510 100644
|
||||
--- a/components/crash/core/app/crashpad_mac.mm
|
||||
+++ b/components/crash/core/app/crashpad_mac.mm
|
||||
@@ -71,6 +71,8 @@
|
||||
@@ -77,6 +77,8 @@
|
||||
} // @autoreleasepool
|
||||
return process_annotations;
|
||||
}();
|
||||
@@ -87,7 +87,7 @@ index aa7c3302f2e3fc7129381b355ed4fa1bc386f8cb..d7dd05118f3c90f5ab570f59685c43bd
|
||||
return annotations;
|
||||
}
|
||||
|
||||
@@ -141,6 +143,13 @@ void DumpProcessWithoutCrashing(task_t task_port) {
|
||||
@@ -147,6 +149,13 @@ void DumpProcessWithoutCrashing(task_t task_port) {
|
||||
|
||||
std::vector<std::string> arguments;
|
||||
|
||||
|
||||
@@ -46,10 +46,10 @@ index 29fed88f36ecaf0c022d2a5a2f3ed7db66e2c96c..e1aadf680851d23cc2ce6023b20f496e
|
||||
// navigation. Now we know that the renderer has updated its state accordingly
|
||||
// and it is safe to also clear the browser side history.
|
||||
diff --git a/ui/base/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc
|
||||
index 8d0e981720bb4a0ec4c42f389275fd375c1b1e43..9473f4f7819667d7cc4bfa514955b4e65d69c1c9 100644
|
||||
index 260858079f2f511cb6eb513c37eec8a0d38b55a0..39f2cef515c4a1724aeb6f3660730221f251e51e 100644
|
||||
--- a/ui/base/clipboard/clipboard_win.cc
|
||||
+++ b/ui/base/clipboard/clipboard_win.cc
|
||||
@@ -850,10 +850,10 @@ SkBitmap ClipboardWin::ReadImageInternal(ClipboardBuffer buffer) const {
|
||||
@@ -817,10 +817,10 @@ SkBitmap ClipboardWin::ReadImageInternal(ClipboardBuffer buffer) const {
|
||||
|
||||
void ClipboardWin::WriteToClipboard(ClipboardFormatType format, HANDLE handle) {
|
||||
UINT cf_format = format.ToFormatEtc().cfFormat;
|
||||
|
||||
@@ -35,10 +35,10 @@ index bb7ff971823db702991a3167b5b0ac1b3dd4a6c9..e5afad68300bdd6ac109b3c9b94d3c20
|
||||
|
||||
// If we are likely to software composite the resource, we use sRGB because
|
||||
diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h
|
||||
index 64fe3c1c3f60758c25f9bc88daedf35633508aa7..a2e9ebb3dc31b4e8665376ffb1f805c6093bce5c 100644
|
||||
index e5a58655788be3bd1c86e238e34bbadf8012bc48..2a2de85e89a8a0f803b7c987620a259b26281d8d 100644
|
||||
--- a/cc/trees/layer_tree_settings.h
|
||||
+++ b/cc/trees/layer_tree_settings.h
|
||||
@@ -98,6 +98,8 @@ class CC_EXPORT LayerTreeSettings {
|
||||
@@ -99,6 +99,8 @@ class CC_EXPORT LayerTreeSettings {
|
||||
bool use_rgba_4444 = false;
|
||||
bool unpremultiply_and_dither_low_bit_depth_tiles = false;
|
||||
|
||||
@@ -229,7 +229,7 @@ index e5179c0e4971bc593860b1e5b606fec651e6756b..fc7c09d19c60d498885d3e4f1a4a4ac9
|
||||
+
|
||||
+#undef PATCH_CS
|
||||
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
|
||||
index de4eadaf7be8be95fc0ad454d66c8ec397cfc20a..d4c451ea992490befb34b3690a98d968bb50b899 100644
|
||||
index d7439d851d6c027a20bf09a258603939b5c19f1e..72162a468f63543c508a3d34e357be1dfcdeba51 100644
|
||||
--- a/content/browser/gpu/gpu_process_host.cc
|
||||
+++ b/content/browser/gpu/gpu_process_host.cc
|
||||
@@ -221,6 +221,7 @@ GpuTerminationStatus ConvertToGpuTerminationStatus(
|
||||
@@ -327,7 +327,7 @@ index 95e818f1406eb1a73a746b73a608137ab5c6e894..6e1d3b3b1add4eda90560856b6915d46
|
||||
// is what the renderer uses if its not threaded.
|
||||
settings.enable_checker_imaging =
|
||||
diff --git a/ui/gfx/mac/io_surface.cc b/ui/gfx/mac/io_surface.cc
|
||||
index 3e80dc40c83bd4eb96f9029643c4a0856253494e..8e19a78f106daf4185ee69970832ea1237d3d03b 100644
|
||||
index ec83bd814a0d5d6802b349d08b22013a0d99e015..043e769e7db9773de2054dcc66f13f062823f58f 100644
|
||||
--- a/ui/gfx/mac/io_surface.cc
|
||||
+++ b/ui/gfx/mac/io_surface.cc
|
||||
@@ -18,6 +18,7 @@
|
||||
@@ -353,7 +353,7 @@ index 3e80dc40c83bd4eb96f9029643c4a0856253494e..8e19a78f106daf4185ee69970832ea12
|
||||
// Allow but ignore invalid color spaces.
|
||||
if (!color_space.IsValid())
|
||||
return true;
|
||||
@@ -265,6 +274,15 @@ IOSurfaceRef CreateIOSurface(const gfx::Size& size,
|
||||
@@ -286,6 +295,15 @@ IOSurfaceRef CreateIOSurface(const gfx::Size& size,
|
||||
DCHECK_EQ(kIOReturnSuccess, r);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: disable_hidden.patch
|
||||
Electron uses this to disable background throttling for hidden windows.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
|
||||
index 529a5b71b9987be21bfb1494b420ef88bbd17f7a..19d7421e1de9680a8b1364f010e19cc95ef7325a 100644
|
||||
index 1ff402be7362bd1dd64f3ffb88081f6cfac328d8..aa00ff974485d3093f05b0cdaeb6c8ed865015e3 100644
|
||||
--- a/content/browser/renderer_host/render_widget_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
|
||||
@@ -692,6 +692,9 @@ void RenderWidgetHostImpl::WasHidden() {
|
||||
@@ -693,6 +693,9 @@ void RenderWidgetHostImpl::WasHidden() {
|
||||
if (is_hidden_)
|
||||
return;
|
||||
|
||||
@@ -20,7 +20,7 @@ index 529a5b71b9987be21bfb1494b420ef88bbd17f7a..19d7421e1de9680a8b1364f010e19cc9
|
||||
blink::mojom::PointerLockResult::kWrongDocument);
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h
|
||||
index 9d7d10136a683620d6fb67246aae51df982930d0..c119dd8916fe2fbde97ce91cce6f788fc62f3534 100644
|
||||
index 9f02961f7ef63d672b918439bb84121ea22e2931..66fd1cbec90c1ecc1f0f1a9722367a58d66c64fd 100644
|
||||
--- a/content/browser/renderer_host/render_widget_host_impl.h
|
||||
+++ b/content/browser/renderer_host/render_widget_host_impl.h
|
||||
@@ -173,6 +173,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
||||
|
||||
@@ -62,7 +62,7 @@ index e2ca7dd198390ebc923facd690904faeb8300e62..f2f53775abb0ba2954cbb3ec431d84c3
|
||||
};
|
||||
|
||||
diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc
|
||||
index eaf817b4b5400fa4d2b6af7c86ac69aabf030a38..0f702be38f8e015c4e61677db5cf566259650dc6 100644
|
||||
index fd075a6f8a1357e7456a97d37af339848635a102..54fa642f614acd221ceaeee0938506e6fea41b1a 100644
|
||||
--- a/ui/native_theme/native_theme_win.cc
|
||||
+++ b/ui/native_theme/native_theme_win.cc
|
||||
@@ -737,6 +737,8 @@ bool NativeThemeWin::ShouldUseDarkColors() const {
|
||||
|
||||
@@ -7,10 +7,10 @@ Subject:
|
||||
Disable usage of pthread_fchdir_np and pthread_chdir_np in MAS builds.
|
||||
|
||||
diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc
|
||||
index 2841b7735430ca3fb03fff7a737b393a8d168747..e356bfe7fdfc11b3b1df429337cf460037788dd8 100644
|
||||
index c074f0d73eab1993b580f317c42480688e6669e6..2a86b0c6897efd10c483d0816b3f7a54f1e13d2a 100644
|
||||
--- a/base/process/launch_mac.cc
|
||||
+++ b/base/process/launch_mac.cc
|
||||
@@ -26,8 +26,10 @@ extern "C" {
|
||||
@@ -27,8 +27,10 @@ extern "C" {
|
||||
// descriptor. libpthread only exposes a syscall wrapper starting in
|
||||
// macOS 10.12, but the system call dates back to macOS 10.5. On older OSes,
|
||||
// the syscall is issued directly.
|
||||
@@ -21,7 +21,7 @@ index 2841b7735430ca3fb03fff7a737b393a8d168747..e356bfe7fdfc11b3b1df429337cf4600
|
||||
|
||||
int responsibility_spawnattrs_setdisclaim(posix_spawnattr_t attrs, int disclaim)
|
||||
API_AVAILABLE(macosx(10.14));
|
||||
@@ -102,21 +104,29 @@ class PosixSpawnFileActions {
|
||||
@@ -103,21 +105,29 @@ class PosixSpawnFileActions {
|
||||
};
|
||||
|
||||
int ChangeCurrentThreadDirectory(const char* path) {
|
||||
@@ -51,7 +51,7 @@ index 2841b7735430ca3fb03fff7a737b393a8d168747..e356bfe7fdfc11b3b1df429337cf4600
|
||||
}
|
||||
|
||||
struct GetAppOutputOptions {
|
||||
@@ -232,11 +242,13 @@ Process LaunchProcess(const std::vector<std::string>& argv,
|
||||
@@ -233,11 +243,13 @@ Process LaunchProcess(const std::vector<std::string>& argv,
|
||||
file_actions.Inherit(STDERR_FILENO);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ This patch can be removed once app.allowRendererProcessReuse is forced
|
||||
to true as then Chromiums assumptions around processes become correct.
|
||||
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
||||
index b113c265dcf5b8e3c7533085f1b8409fa13bcfa0..b80aab0f3b4a1389e6dd740d23df8f1beb051deb 100644
|
||||
index 5234e86d8f10533c4f8c6992a328d521c1850cea..3049fe6aa54b1f57e94769fcf300e02d13c361da 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -3075,11 +3075,13 @@ bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) {
|
||||
@@ -3076,11 +3076,13 @@ bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) {
|
||||
WebContentsImpl* outermost = GetOutermostWebContents();
|
||||
if (event.button == blink::WebPointerProperties::Button::kBack &&
|
||||
outermost->controller_.CanGoBack()) {
|
||||
|
||||
28
patches/chromium/fix_setparentacessibile_crash_win.patch
Normal file
28
patches/chromium/fix_setparentacessibile_crash_win.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Biru Mohanathas <birunthan@mohanathas.com>
|
||||
Date: Thu, 10 Dec 2020 19:02:37 +0200
|
||||
Subject: fix crash in NativeViewHost::SetParentAccessible
|
||||
|
||||
This fixes random crashes on Windows 10. It presumably started happening
|
||||
after the changes in
|
||||
https://chromium.googlesource.com/chromium/src.git/+/5c6c8e994bce2bfb867279ae5068e9f9134e70c3%5E!/#F15
|
||||
|
||||
For context, see: https://github.com/electron/electron/issues/26905
|
||||
|
||||
This patch can likely be upstreamed. The crash cannot be fixed without
|
||||
patching something in Chromium - this is the least invasive change.
|
||||
|
||||
diff --git a/ui/views/controls/native/native_view_host.cc b/ui/views/controls/native/native_view_host.cc
|
||||
index d8e5cf4ddb625519863837544c2f91b4e015029b..e1c2e2e41eed722a7989bc8e97e2ea73119b1f70 100644
|
||||
--- a/ui/views/controls/native/native_view_host.cc
|
||||
+++ b/ui/views/controls/native/native_view_host.cc
|
||||
@@ -54,6 +54,9 @@ void NativeViewHost::Detach() {
|
||||
}
|
||||
|
||||
void NativeViewHost::SetParentAccessible(gfx::NativeViewAccessible accessible) {
|
||||
+ if (!native_wrapper_.get())
|
||||
+ return;
|
||||
+
|
||||
native_wrapper_->SetParentAccessible(accessible);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ index e4942faa3fbf90c2819620d3f091aea59299522d..60b2b213d6429fa7cff783370cbbeff2
|
||||
NOT_STARTED,
|
||||
DID_COMMIT,
|
||||
diff --git a/content/browser/renderer_host/navigation_request.h b/content/browser/renderer_host/navigation_request.h
|
||||
index cc726282fd93048177174d91e01b7c4a3ad9fdcd..2685a56b7b1582e66d90fbc07e04462b68c59a0f 100644
|
||||
index c985c048fed8cda25be2802231f213f8d3dc9b79..5e0c08775d6e504327979218d46e999757ea508b 100644
|
||||
--- a/content/browser/renderer_host/navigation_request.h
|
||||
+++ b/content/browser/renderer_host/navigation_request.h
|
||||
@@ -129,6 +129,10 @@ class CONTENT_EXPORT NavigationRequest
|
||||
|
||||
@@ -38,10 +38,10 @@ index f23af2d9738f3aa76e3a49301e1c3216ee4a64b4..ede178acabc63c3c33d6ce93efd5632b
|
||||
v8::Isolate* isolate() { return isolate_; }
|
||||
|
||||
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc
|
||||
index 9ba60a7f928a24b4829dafdf9a7362ad58bd7c64..51fe2fa000e47ced3661ba581c52dceba93447fe 100644
|
||||
index 4174fd98f3a1d9ed6c9a4b57651e8122a2d37770..07d970b84b770b06019dc1de441cf108d67b1782 100644
|
||||
--- a/gin/v8_initializer.cc
|
||||
+++ b/gin/v8_initializer.cc
|
||||
@@ -191,12 +191,14 @@ enum LoadV8FileResult {
|
||||
@@ -198,12 +198,14 @@ enum LoadV8FileResult {
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
|
||||
@@ -12,7 +12,7 @@ rendering and there is no signal from browser process on this event
|
||||
to identify it.
|
||||
|
||||
diff --git a/content/browser/gpu/gpu_data_manager_impl.cc b/content/browser/gpu/gpu_data_manager_impl.cc
|
||||
index 694f63ecd2de241fd1a8b7b529bbd4d1bea78337..cc9679eb86f85239f5612d8db8200db5392f5bc5 100644
|
||||
index 1f36d0320040b318c8f8611253ddffb2749e3dc3..15bcff79b7d416366b1d1dc187c966466a2eacb7 100644
|
||||
--- a/content/browser/gpu/gpu_data_manager_impl.cc
|
||||
+++ b/content/browser/gpu/gpu_data_manager_impl.cc
|
||||
@@ -229,6 +229,11 @@ void GpuDataManagerImpl::TerminateInfoCollectionGpuProcess() {
|
||||
@@ -28,7 +28,7 @@ index 694f63ecd2de241fd1a8b7b529bbd4d1bea78337..cc9679eb86f85239f5612d8db8200db5
|
||||
|
||||
void GpuDataManagerImpl::UpdateGpuFeatureInfo(
|
||||
diff --git a/content/browser/gpu/gpu_data_manager_impl.h b/content/browser/gpu/gpu_data_manager_impl.h
|
||||
index 7030549c94196877b690e8f683dda212534176ec..e9b216f65394e36525533768e087cd367d7bfaae 100644
|
||||
index ef04f1bf4a009c3e6c4fe0cb2d3393ca9bbcef16..1640de1fbcbbf6904b9aaac7b8f6a58feda8ead6 100644
|
||||
--- a/content/browser/gpu/gpu_data_manager_impl.h
|
||||
+++ b/content/browser/gpu/gpu_data_manager_impl.h
|
||||
@@ -97,6 +97,7 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager,
|
||||
@@ -56,7 +56,7 @@ index 879e233fa550b3aad94b64fb1ac603cbae782922..cecf9738c6e33c766fcadea8c71b6656
|
||||
|
||||
void GpuDataManagerImplPrivate::UpdateGpuFeatureInfo(
|
||||
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.h b/content/browser/gpu/gpu_data_manager_impl_private.h
|
||||
index 27b517d56af0c687c15b7e2d2db37798b63df3e8..aa92f8b6e12c762cdb81090d072c76742ac9489c 100644
|
||||
index 73b6c034e382e52dbcb951ee8d783575f01fe451..5d1d8a6bc719c4c9c71e6bce40c50cdfbedf4634 100644
|
||||
--- a/content/browser/gpu/gpu_data_manager_impl_private.h
|
||||
+++ b/content/browser/gpu/gpu_data_manager_impl_private.h
|
||||
@@ -75,6 +75,7 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
|
||||
|
||||
@@ -459,10 +459,10 @@ index 1db129740992672a4e8be8100da18b6813f1a4f8..5b1e456020ac859c826dbef2826cacf3
|
||||
}
|
||||
|
||||
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
|
||||
index 933483c36d94336c8e9cc56a53bc86aee01e12d0..a48b4af66fb4edcf74caef5bec68c53be5469fe8 100644
|
||||
index 56864e40431a051dc93ada792a712ca8cf5e9258..c2ee161f02e8cbf901234210671f6dc5d9910908 100644
|
||||
--- a/device/bluetooth/bluetooth_adapter_mac.mm
|
||||
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
|
||||
@@ -37,6 +37,7 @@
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "device/bluetooth/bluetooth_socket_mac.h"
|
||||
#include "device/bluetooth/public/cpp/bluetooth_address.h"
|
||||
|
||||
@@ -470,7 +470,7 @@ index 933483c36d94336c8e9cc56a53bc86aee01e12d0..a48b4af66fb4edcf74caef5bec68c53b
|
||||
extern "C" {
|
||||
// Undocumented IOBluetooth Preference API [1]. Used by `blueutil` [2] and
|
||||
// `Karabiner` [3] to programmatically control the Bluetooth state. Calling the
|
||||
@@ -50,6 +51,7 @@
|
||||
@@ -55,6 +56,7 @@
|
||||
// [4] https://support.apple.com/kb/PH25091
|
||||
void IOBluetoothPreferenceSetControllerPowerState(int state);
|
||||
}
|
||||
@@ -478,7 +478,7 @@ index 933483c36d94336c8e9cc56a53bc86aee01e12d0..a48b4af66fb4edcf74caef5bec68c53b
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -119,8 +121,10 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) {
|
||||
@@ -123,8 +125,10 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) {
|
||||
controller_state_function_(
|
||||
base::BindRepeating(&BluetoothAdapterMac::GetHostControllerState,
|
||||
base::Unretained(this))),
|
||||
@@ -486,10 +486,10 @@ index 933483c36d94336c8e9cc56a53bc86aee01e12d0..a48b4af66fb4edcf74caef5bec68c53b
|
||||
power_state_function_(
|
||||
base::BindRepeating(IOBluetoothPreferenceSetControllerPowerState)),
|
||||
+#endif
|
||||
should_update_name_(true),
|
||||
classic_discovery_manager_(
|
||||
BluetoothDiscoveryManagerMac::CreateClassic(this)),
|
||||
@@ -307,8 +311,12 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) {
|
||||
low_energy_discovery_manager_(
|
||||
@@ -336,8 +340,12 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) {
|
||||
}
|
||||
|
||||
bool BluetoothAdapterMac::SetPoweredImpl(bool powered) {
|
||||
|
||||
@@ -115,7 +115,7 @@ index dde0f977c676b6914f206ca7022290887257622b..67fe14f482dcbdf884711e3b283f9d61
|
||||
OP(kColorId_ThrobberSpinningColor), \
|
||||
OP(kColorId_ThrobberWaitingColor), \
|
||||
diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc
|
||||
index 950956142148d2127135386dd2b9d0076b7aa148..eaf817b4b5400fa4d2b6af7c86ac69aabf030a38 100644
|
||||
index 28acb663886b4f192ed188770deaa0f5095aca0f..fd075a6f8a1357e7456a97d37af339848635a102 100644
|
||||
--- a/ui/native_theme/native_theme_win.cc
|
||||
+++ b/ui/native_theme/native_theme_win.cc
|
||||
@@ -648,6 +648,18 @@ base::Optional<SkColor> NativeThemeWin::GetPlatformHighContrastColor(
|
||||
|
||||
@@ -30,10 +30,10 @@ index c44d658372805f0695044c6647c641fbb3fda270..b48dc3c5c435d439b0dbca8fed5a9dd8
|
||||
// RenderWidgetHost on the main frame, and false otherwise.
|
||||
virtual bool IsWidgetForMainFrame(RenderWidgetHostImpl*);
|
||||
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
|
||||
index 19d7421e1de9680a8b1364f010e19cc95ef7325a..b213e28a6a475d003892117c0a64c70b556fcdca 100644
|
||||
index aa00ff974485d3093f05b0cdaeb6c8ed865015e3..831e5f4f18639a5b4ef0a70b1dd99d9d046ca0a4 100644
|
||||
--- a/content/browser/renderer_host/render_widget_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
|
||||
@@ -1684,6 +1684,8 @@ void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) {
|
||||
@@ -1685,6 +1685,8 @@ void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) {
|
||||
if (!view_)
|
||||
return;
|
||||
view_->UpdateCursor(cursor);
|
||||
@@ -43,10 +43,10 @@ index 19d7421e1de9680a8b1364f010e19cc95ef7325a..b213e28a6a475d003892117c0a64c70b
|
||||
|
||||
void RenderWidgetHostImpl::OnCursorVisibilityStateChanged(bool is_visible) {
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
||||
index 2e32ddda8980ed760e46e73e01c69c548e77b7b6..2927f0b9ce03a0567a460698903d17d62fc42c95 100644
|
||||
index d07957e1ff00a28feb9d3dee854c9b8d0d33f1fe..750944d45d66f70a5e32219148a4f0cb9edd351c 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -4270,6 +4270,12 @@ bool WebContentsImpl::OnUpdateDragCursor() {
|
||||
@@ -4279,6 +4279,12 @@ bool WebContentsImpl::OnUpdateDragCursor() {
|
||||
browser_plugin_embedder_->OnUpdateDragCursor();
|
||||
}
|
||||
|
||||
@@ -60,10 +60,10 @@ index 2e32ddda8980ed760e46e73e01c69c548e77b7b6..2927f0b9ce03a0567a460698903d17d6
|
||||
RenderWidgetHostImpl* render_widget_host) {
|
||||
return render_widget_host == GetMainFrame()->GetRenderWidgetHost();
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
|
||||
index 3cdec617eda1e972d87e0048c3d5d70d63f97c84..3533e6514d2ad35b2d871f68dd3c2e407b8ce493 100644
|
||||
index 49ef29f9a725219715532a92c18aa1f3ba2e80ab..b78cb8f558052e01d61456ca282359eb4b342c35 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.h
|
||||
+++ b/content/browser/web_contents/web_contents_impl.h
|
||||
@@ -944,6 +944,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
|
||||
@@ -940,6 +940,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
|
||||
void SendScreenRects() override;
|
||||
TextInputManager* GetTextInputManager() override;
|
||||
bool OnUpdateDragCursor() override;
|
||||
|
||||
@@ -1,214 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <samuel.r.attard@gmail.com>
|
||||
Date: Wed, 21 Oct 2020 13:13:00 -0700
|
||||
Subject: rename the v8 context snapshot on arm64 macOS builds
|
||||
|
||||
This is done so that the arm64 and x64 v8 context snapshots can
|
||||
live side by side in a universal app build of a Chromium based
|
||||
application. All other files can be Mach-O universal binaries
|
||||
generated using "lipo" but these snapshot files have to be uniquely
|
||||
named so that both can exist in the Resources folder at the same time
|
||||
and the correct one is chosen at runtime.
|
||||
|
||||
Bug: 1142017
|
||||
Change-Id: I8449b72ba3a36e7ce69b9d9ec7768bd80ecc3e3a
|
||||
|
||||
diff --git a/android_webview/BUILD.gn b/android_webview/BUILD.gn
|
||||
index 169a790b48dd6a76b59bc17c94871e23499bd6fb..3dbca6cfba89ffbbddb23832a090c4ca5a2323b6 100644
|
||||
--- a/android_webview/BUILD.gn
|
||||
+++ b/android_webview/BUILD.gn
|
||||
@@ -790,7 +790,7 @@ if (android_64bit_target_cpu) {
|
||||
"32-bit targets shouldn't have secondary abi")
|
||||
arch_suffix = "32"
|
||||
if (use_v8_context_snapshot) {
|
||||
- renaming_sources = [ "$_secondary_abi_out_dir/v8_context_snapshot.bin" ]
|
||||
+ renaming_sources = [ "$_secondary_abi_out_dir/$v8_context_snapshot_filename" ]
|
||||
renaming_destinations = [ "v8_context_snapshot_$arch_suffix.bin" ]
|
||||
} else {
|
||||
renaming_sources = [ "$_secondary_abi_out_dir/snapshot_blob.bin" ]
|
||||
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
|
||||
index 174df0243f3058dce3481affea390560950a2a78..1a4a98c25b39b5879c19f999dfd680141500ef09 100644
|
||||
--- a/chrome/BUILD.gn
|
||||
+++ b/chrome/BUILD.gn
|
||||
@@ -775,7 +775,7 @@ if (is_win) {
|
||||
if (v8_use_external_startup_data) {
|
||||
public_deps += [ "//v8" ]
|
||||
if (use_v8_context_snapshot) {
|
||||
- sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
|
||||
+ sources += [ "$root_out_dir/$v8_context_snapshot_filename" ]
|
||||
public_deps += [ "//tools/v8_context_snapshot" ]
|
||||
} else {
|
||||
sources += [ "$root_out_dir/snapshot_blob.bin" ]
|
||||
diff --git a/chrome/installer/mini_installer/BUILD.gn b/chrome/installer/mini_installer/BUILD.gn
|
||||
index 7c7af8c0d9487abcd82ecd9d2d5b1ab4b737148b..df39ea145cc6b05775db7fbfb680fce892b8941a 100644
|
||||
--- a/chrome/installer/mini_installer/BUILD.gn
|
||||
+++ b/chrome/installer/mini_installer/BUILD.gn
|
||||
@@ -228,7 +228,7 @@ template("generate_mini_installer") {
|
||||
if (v8_use_external_startup_data) {
|
||||
deps += [ "//v8" ]
|
||||
if (use_v8_context_snapshot) {
|
||||
- inputs += [ "$root_out_dir/v8_context_snapshot.bin" ]
|
||||
+ inputs += [ "$root_out_dir/$v8_context_snapshot_filename" ]
|
||||
deps += [ "//tools/v8_context_snapshot" ]
|
||||
} else {
|
||||
inputs += [ "$root_out_dir/snapshot_blob.bin" ]
|
||||
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
|
||||
index fcf6229f4d530c56b7c65fe6898c00a8a566dc1a..b3115bab5c08106072e28a9f01304f688d51f72b 100644
|
||||
--- a/content/browser/BUILD.gn
|
||||
+++ b/content/browser/BUILD.gn
|
||||
@@ -43,6 +43,7 @@ source_set("browser") {
|
||||
configs += [
|
||||
"//build/config:precompiled_headers",
|
||||
"//content:content_implementation",
|
||||
+ "//tools/v8_context_snapshot:use_v8_context_snapshot",
|
||||
"//v8:external_startup_data",
|
||||
]
|
||||
defines = []
|
||||
diff --git a/content/browser/v8_snapshot_files.cc b/content/browser/v8_snapshot_files.cc
|
||||
index d557c41a38e17c61e1b91d3daa47ea17e13a6a9e..43c93e3f50290d2aef230083a4bcebf307ef0c6e 100644
|
||||
--- a/content/browser/v8_snapshot_files.cc
|
||||
+++ b/content/browser/v8_snapshot_files.cc
|
||||
@@ -13,7 +13,7 @@ std::map<std::string, base::FilePath> GetV8SnapshotFilesToPreload() {
|
||||
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
#if defined(USE_V8_CONTEXT_SNAPSHOT)
|
||||
return {{kV8ContextSnapshotDataDescriptor,
|
||||
- base::FilePath(FILE_PATH_LITERAL("v8_context_snapshot.bin"))}};
|
||||
+ base::FilePath(FILE_PATH_LITERAL(V8_CONTEXT_SNAPSHOT_FILENAME))}};
|
||||
#else
|
||||
return {{kV8SnapshotDataDescriptor,
|
||||
base::FilePath(FILE_PATH_LITERAL("snapshot_blob.bin"))}};
|
||||
diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn
|
||||
index 578e4341247e112440b13080b45ac5e854635bd2..74c1e0f29db065985920756ae057e255d76e51c2 100644
|
||||
--- a/content/shell/BUILD.gn
|
||||
+++ b/content/shell/BUILD.gn
|
||||
@@ -547,7 +547,7 @@ if (is_mac) {
|
||||
if (v8_use_external_startup_data) {
|
||||
public_deps += [ "//v8" ]
|
||||
if (use_v8_context_snapshot) {
|
||||
- sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
|
||||
+ sources += [ "$root_out_dir/$v8_context_snapshot_filename" ]
|
||||
public_deps += [ "//tools/v8_context_snapshot" ]
|
||||
} else {
|
||||
sources += [ "$root_out_dir/snapshot_blob.bin" ]
|
||||
diff --git a/gin/BUILD.gn b/gin/BUILD.gn
|
||||
index 9ec6eb1b898bc87d066bdc75867ff624f7ef1f50..dfc59c17382f8463e82185032d977a1868c71985 100644
|
||||
--- a/gin/BUILD.gn
|
||||
+++ b/gin/BUILD.gn
|
||||
@@ -85,7 +85,10 @@ component("gin") {
|
||||
frameworks = [ "CoreFoundation.framework" ]
|
||||
}
|
||||
|
||||
- configs += [ "//v8:external_startup_data" ]
|
||||
+ configs += [
|
||||
+ "//tools/v8_context_snapshot:use_v8_context_snapshot",
|
||||
+ "//v8:external_startup_data",
|
||||
+ ]
|
||||
}
|
||||
|
||||
executable("gin_shell") {
|
||||
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc
|
||||
index 51fe2fa000e47ced3661ba581c52dceba93447fe..07d970b84b770b06019dc1de441cf108d67b1782 100644
|
||||
--- a/gin/v8_initializer.cc
|
||||
+++ b/gin/v8_initializer.cc
|
||||
@@ -76,7 +76,9 @@ const char kSnapshotFileName32[] = "snapshot_blob_32.bin";
|
||||
#endif
|
||||
|
||||
#else // defined(OS_ANDROID)
|
||||
-const char kV8ContextSnapshotFileName[] = "v8_context_snapshot.bin";
|
||||
+#if defined(USE_V8_CONTEXT_SNAPSHOT)
|
||||
+const char kV8ContextSnapshotFileName[] = V8_CONTEXT_SNAPSHOT_FILENAME;
|
||||
+#endif
|
||||
const char kSnapshotFileName[] = "snapshot_blob.bin";
|
||||
#endif // defined(OS_ANDROID)
|
||||
|
||||
@@ -86,7 +88,12 @@ const char* GetSnapshotFileName(
|
||||
case V8Initializer::V8SnapshotFileType::kDefault:
|
||||
return kSnapshotFileName;
|
||||
case V8Initializer::V8SnapshotFileType::kWithAdditionalContext:
|
||||
+#if defined(USE_V8_CONTEXT_SNAPSHOT)
|
||||
return kV8ContextSnapshotFileName;
|
||||
+#else
|
||||
+ NOTREACHED();
|
||||
+ return nullptr;
|
||||
+#endif
|
||||
}
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
diff --git a/headless/BUILD.gn b/headless/BUILD.gn
|
||||
index aeab3dc3ad08688b7a7af191b43e20845da72091..d2ab76aed326d246c8f8d550ff709b84b56e45d3 100644
|
||||
--- a/headless/BUILD.gn
|
||||
+++ b/headless/BUILD.gn
|
||||
@@ -471,7 +471,7 @@ component("headless_non_renderer") {
|
||||
if (v8_use_external_startup_data) {
|
||||
public_deps += [ "//v8" ]
|
||||
if (use_v8_context_snapshot) {
|
||||
- data += [ "$root_out_dir/v8_context_snapshot.bin" ]
|
||||
+ data += [ "$root_out_dir/$v8_context_snapshot_filename" ]
|
||||
data_deps += [ "//tools/v8_context_snapshot" ]
|
||||
} else {
|
||||
data += [ "$root_out_dir/snapshot_blob.bin" ]
|
||||
diff --git a/tools/v8_context_snapshot/BUILD.gn b/tools/v8_context_snapshot/BUILD.gn
|
||||
index 2f20f684d89021dcd0e64421a0553a3e4a66334d..7662cc8ee83e39709eee6e0919c85370fedbb983 100644
|
||||
--- a/tools/v8_context_snapshot/BUILD.gn
|
||||
+++ b/tools/v8_context_snapshot/BUILD.gn
|
||||
@@ -21,14 +21,17 @@ group("v8_context_snapshot") {
|
||||
if (use_v8_context_snapshot) {
|
||||
public_deps = [ ":generate_v8_context_snapshot" ]
|
||||
if (!is_android) {
|
||||
- data = [ "$root_out_dir/v8_context_snapshot.bin" ]
|
||||
+ data = [ "$root_out_dir/$v8_context_snapshot_filename" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
config("use_v8_context_snapshot") {
|
||||
if (use_v8_context_snapshot) {
|
||||
- defines = [ "USE_V8_CONTEXT_SNAPSHOT" ]
|
||||
+ defines = [
|
||||
+ "USE_V8_CONTEXT_SNAPSHOT",
|
||||
+ "V8_CONTEXT_SNAPSHOT_FILENAME=\"$v8_context_snapshot_filename\"",
|
||||
+ ]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +39,7 @@ if (use_v8_context_snapshot) {
|
||||
if (is_android && enable_java_templates) {
|
||||
android_assets("v8_context_snapshot_assets") {
|
||||
deps = [ ":v8_context_snapshot" ]
|
||||
- renaming_sources = [ "$root_out_dir/v8_context_snapshot.bin" ]
|
||||
+ renaming_sources = [ "$root_out_dir/$v8_context_snapshot_filename" ]
|
||||
if (current_cpu == "arm" || current_cpu == "x86" ||
|
||||
current_cpu == "mipsel") {
|
||||
renaming_destinations = [ "v8_context_snapshot_32.bin" ]
|
||||
@@ -49,7 +52,7 @@ if (use_v8_context_snapshot) {
|
||||
|
||||
action("generate_v8_context_snapshot") {
|
||||
script = "//build/gn_run_binary.py"
|
||||
- output_file = "$root_out_dir/v8_context_snapshot.bin"
|
||||
+ output_file = "$root_out_dir/$v8_context_snapshot_filename"
|
||||
output_path = rebase_path(output_file, root_build_dir)
|
||||
|
||||
args = [
|
||||
diff --git a/tools/v8_context_snapshot/v8_context_snapshot.gni b/tools/v8_context_snapshot/v8_context_snapshot.gni
|
||||
index 6a6f477ad3f543680cd6485bdf6b0e82d567012c..7f485e135cef8e3f0c01ede28b4cfe76067bc624 100644
|
||||
--- a/tools/v8_context_snapshot/v8_context_snapshot.gni
|
||||
+++ b/tools/v8_context_snapshot/v8_context_snapshot.gni
|
||||
@@ -18,6 +18,18 @@ declare_args() {
|
||||
!is_chromeos && !is_android && !is_chromecast && !is_fuchsia &&
|
||||
!(host_os == "mac" && current_cpu == "x86") &&
|
||||
(v8_target_cpu == target_cpu || is_msan) && !(is_win && host_os != "win")
|
||||
+
|
||||
+ # We use a different filename for arm64 macOS builds so that the arm64 and
|
||||
+ # x64 snapshots can live side-by-side in a universal macOS app.
|
||||
+ if (is_mac) {
|
||||
+ if (v8_target_cpu == "x64") {
|
||||
+ v8_context_snapshot_filename = "v8_context_snapshot.x86_64.bin"
|
||||
+ } else if (v8_target_cpu == "arm64") {
|
||||
+ v8_context_snapshot_filename = "v8_context_snapshot.arm64.bin"
|
||||
+ }
|
||||
+ } else {
|
||||
+ v8_context_snapshot_filename = "v8_context_snapshot.bin"
|
||||
+ }
|
||||
}
|
||||
|
||||
# We cannot use V8 context snapshot, if V8 doesn't use snapshot files.
|
||||
@@ -10,10 +10,10 @@ kinds of utility windows. Similarly for `disableAutoHideCursor`.
|
||||
Additionally, disables usage of some private APIs in MAS builds.
|
||||
|
||||
diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
||||
index eae6d8c330a523e85c7997e59091be0ce42031dc..3f23af8dca0d8a1fa149877cde1a553360610eba 100644
|
||||
index eae6d8c330a523e85c7997e59091be0ce42031dc..d90f13139cfc9291c76824a6529e2931176d1079 100644
|
||||
--- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
||||
+++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
||||
@@ -154,6 +154,11 @@ void ExtractUnderlines(NSAttributedString* string,
|
||||
@@ -154,6 +154,15 @@ void ExtractUnderlines(NSAttributedString* string,
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -21,11 +21,15 @@ index eae6d8c330a523e85c7997e59091be0ce42031dc..3f23af8dca0d8a1fa149877cde1a5533
|
||||
+- (BOOL)acceptsFirstMouse;
|
||||
+- (BOOL)disableAutoHideCursor;
|
||||
+@end
|
||||
+
|
||||
+@interface NSView (ElectronCustomMethods)
|
||||
+- (BOOL)shouldIgnoreMouseEvent;
|
||||
+@end
|
||||
+
|
||||
// These are not documented, so use only after checking -respondsToSelector:.
|
||||
@interface NSApplication (UndocumentedSpeechMethods)
|
||||
- (void)speakString:(NSString*)string;
|
||||
@@ -573,6 +578,9 @@ - (BOOL)acceptsMouseEventsWhenInactive {
|
||||
@@ -573,6 +582,9 @@ - (BOOL)acceptsMouseEventsWhenInactive {
|
||||
}
|
||||
|
||||
- (BOOL)acceptsFirstMouse:(NSEvent*)theEvent {
|
||||
@@ -35,7 +39,18 @@ index eae6d8c330a523e85c7997e59091be0ce42031dc..3f23af8dca0d8a1fa149877cde1a5533
|
||||
return [self acceptsMouseEventsWhenInactive];
|
||||
}
|
||||
|
||||
@@ -996,6 +1004,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv {
|
||||
@@ -648,6 +660,10 @@ - (BOOL)shouldIgnoreMouseEvent:(NSEvent*)theEvent {
|
||||
// its parent view.
|
||||
BOOL hitSelf = NO;
|
||||
while (view) {
|
||||
+ if ([view respondsToSelector:@selector(shouldIgnoreMouseEvent)] && ![view shouldIgnoreMouseEvent]) {
|
||||
+ return NO;
|
||||
+ }
|
||||
+
|
||||
if (view == self)
|
||||
hitSelf = YES;
|
||||
if ([view isKindOfClass:[self class]] && ![view isEqual:self] &&
|
||||
@@ -996,6 +1012,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv {
|
||||
eventType == NSKeyDown &&
|
||||
!(modifierFlags & NSCommandKeyMask);
|
||||
|
||||
@@ -46,7 +61,7 @@ index eae6d8c330a523e85c7997e59091be0ce42031dc..3f23af8dca0d8a1fa149877cde1a5533
|
||||
// We only handle key down events and just simply forward other events.
|
||||
if (eventType != NSKeyDown) {
|
||||
_hostHelper->ForwardKeyboardEvent(event, latency_info);
|
||||
@@ -1772,9 +1784,11 @@ - (NSAccessibilityRole)accessibilityRole {
|
||||
@@ -1772,9 +1792,11 @@ - (NSAccessibilityRole)accessibilityRole {
|
||||
// Since this implementation doesn't have to wait any IPC calls, this doesn't
|
||||
// make any key-typing jank. --hbono 7/23/09
|
||||
//
|
||||
@@ -58,7 +73,7 @@ index eae6d8c330a523e85c7997e59091be0ce42031dc..3f23af8dca0d8a1fa149877cde1a5533
|
||||
|
||||
- (NSArray*)validAttributesForMarkedText {
|
||||
// This code is just copied from WebKit except renaming variables.
|
||||
@@ -1783,7 +1797,10 @@ - (NSArray*)validAttributesForMarkedText {
|
||||
@@ -1783,7 +1805,10 @@ - (NSArray*)validAttributesForMarkedText {
|
||||
initWithObjects:NSUnderlineStyleAttributeName,
|
||||
NSUnderlineColorAttributeName,
|
||||
NSMarkedClauseSegmentAttributeName,
|
||||
|
||||
@@ -52,7 +52,7 @@ Some alternatives to this patch:
|
||||
None of these options seems like a substantial maintainability win over this patch to me (@nornagon).
|
||||
|
||||
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
|
||||
index 790871c1bc61afb22587653811681fa7bf4a5948..174df0243f3058dce3481affea390560950a2a78 100644
|
||||
index 7913e9c6bd0a275543b2183761134826aa14a5c8..1a4a98c25b39b5879c19f999dfd680141500ef09 100644
|
||||
--- a/chrome/BUILD.gn
|
||||
+++ b/chrome/BUILD.gn
|
||||
@@ -1437,7 +1437,7 @@ if (is_chrome_branded && !is_android) {
|
||||
|
||||
@@ -9,10 +9,10 @@ for every navigation to keep Node.js working properly. Once Native Modules in th
|
||||
are required to be NAPI or context aware (Electron v11), this patch can be removed.
|
||||
|
||||
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
|
||||
index c9852764a59cb37f312978d8aa14ec51c308502b..a20d30ae6dea56a4a55c9377a6957ce8247eeb89 100644
|
||||
index ce09634902a5937af110ab5453c9ae1f18b8d987..21877ff0e807799dbf9cf8d489123d35d2c741ce 100644
|
||||
--- a/chrome/renderer/chrome_content_renderer_client.cc
|
||||
+++ b/chrome/renderer/chrome_content_renderer_client.cc
|
||||
@@ -1269,6 +1269,25 @@ bool ChromeContentRendererClient::AllowPopup() {
|
||||
@@ -1282,6 +1282,25 @@ bool ChromeContentRendererClient::AllowPopup() {
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -92,10 +92,10 @@ index 541fb915a2096a6ea56860662fff9f1dec9929cf..e4637fc393bafcdeac62cd4257f42451
|
||||
// |url|. If the function returns a valid |new_url|, the request must be
|
||||
// updated to use it. The |force_ignore_site_for_cookies| output parameter
|
||||
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
||||
index 5eb2dcde4d2033015677681ceeba7da9b9fe32df..6b3177a36bcd47192c967562d72bee02fb9ebc81 100644
|
||||
index 23ff9cc13aaa97d395983dceb2a27158b2d679a5..d6ca9930c8c8caacac4e3d7f8a65189349589464 100644
|
||||
--- a/content/renderer/render_frame_impl.cc
|
||||
+++ b/content/renderer/render_frame_impl.cc
|
||||
@@ -5797,6 +5797,23 @@ void RenderFrameImpl::BeginNavigation(
|
||||
@@ -5799,6 +5799,23 @@ void RenderFrameImpl::BeginNavigation(
|
||||
// we can do a per-frame check here rather than a process-wide check.
|
||||
bool should_fork = HasWebUIScheme(url) || HasWebUIScheme(old_url) ||
|
||||
(enabled_bindings_ & kWebUIBindingsPolicyMask);
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <samuel.r.attard@gmail.com>
|
||||
Date: Tue, 17 Nov 2020 16:59:28 -0800
|
||||
Subject: use public APIs to determine if a font is a system font in MAS build
|
||||
|
||||
CTFontDescriptorIsSystemUIFont is a private API, we're using an _interesting_ technique in the MAS build to determine if the font is a system font by checking if it's kCTFontPriorityAttribute is set to system priority.
|
||||
|
||||
diff --git a/ui/gfx/platform_font_mac.mm b/ui/gfx/platform_font_mac.mm
|
||||
index fc6047806e3511f60b58a669fdf628e1a48eb05b..bcc29ac87cfc965eb4c3f06d959605d2cb259770 100644
|
||||
--- a/ui/gfx/platform_font_mac.mm
|
||||
+++ b/ui/gfx/platform_font_mac.mm
|
||||
@@ -25,9 +25,11 @@
|
||||
|
||||
using Weight = Font::Weight;
|
||||
|
||||
+#if !defined(MAS_BUILD)
|
||||
extern "C" {
|
||||
bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef);
|
||||
}
|
||||
+#endif
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -269,7 +271,13 @@ NSInteger ToNSFontManagerWeight(Weight weight) {
|
||||
// TODO(avi, etienneb): Figure out this font stuff.
|
||||
base::ScopedCFTypeRef<CTFontDescriptorRef> descriptor(
|
||||
CTFontCopyFontDescriptor(font));
|
||||
+#if defined(MAS_BUILD)
|
||||
+ CFNumberRef priority = (CFNumberRef)CTFontDescriptorCopyAttribute(descriptor.get(), (CFStringRef)kCTFontPriorityAttribute);
|
||||
+ SInt64 v;
|
||||
+ if (CFNumberGetValue(priority, kCFNumberSInt64Type, &v) && v == kCTFontPrioritySystem) {
|
||||
+#else
|
||||
if (CTFontDescriptorIsSystemUIFont(descriptor.get())) {
|
||||
+#endif
|
||||
// Assume it's the standard system font. The fact that this much is known is
|
||||
// enough.
|
||||
return PlatformFontMac::SystemFontType::kGeneral;
|
||||
@@ -7,10 +7,10 @@ v8_context_snapshot_generator is a build time executable.
|
||||
The patch adds the config.
|
||||
|
||||
diff --git a/tools/v8_context_snapshot/BUILD.gn b/tools/v8_context_snapshot/BUILD.gn
|
||||
index 7728ccccee97e747d476500baf0ae46a52b66ae3..2f20f684d89021dcd0e64421a0553a3e4a66334d 100644
|
||||
index c238e7e3837e0ee521374045b28340a8fc223a7d..7662cc8ee83e39709eee6e0919c85370fedbb983 100644
|
||||
--- a/tools/v8_context_snapshot/BUILD.gn
|
||||
+++ b/tools/v8_context_snapshot/BUILD.gn
|
||||
@@ -112,6 +112,7 @@ if (use_v8_context_snapshot) {
|
||||
@@ -115,6 +115,7 @@ if (use_v8_context_snapshot) {
|
||||
configs += [
|
||||
"//v8:external_startup_data",
|
||||
":disable_icf",
|
||||
|
||||
@@ -9,10 +9,10 @@ is needed for OSR.
|
||||
Originally landed in https://github.com/electron/libchromiumcontent/pull/226.
|
||||
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
||||
index b80aab0f3b4a1389e6dd740d23df8f1beb051deb..2e32ddda8980ed760e46e73e01c69c548e77b7b6 100644
|
||||
index 3049fe6aa54b1f57e94769fcf300e02d13c361da..d07957e1ff00a28feb9d3dee854c9b8d0d33f1fe 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -2770,6 +2770,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
|
||||
@@ -2771,6 +2771,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
|
||||
std::string unique_name;
|
||||
frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name);
|
||||
|
||||
@@ -25,7 +25,7 @@ index b80aab0f3b4a1389e6dd740d23df8f1beb051deb..2e32ddda8980ed760e46e73e01c69c54
|
||||
WebContentsViewDelegate* delegate =
|
||||
GetContentClient()->browser()->GetWebContentsViewDelegate(this);
|
||||
|
||||
@@ -2780,6 +2786,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
|
||||
@@ -2781,6 +2787,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
|
||||
view_.reset(CreateWebContentsView(this, delegate,
|
||||
&render_view_host_delegate_view_));
|
||||
}
|
||||
|
||||
@@ -7,7 +7,5 @@ workaround_an_undefined_symbol_error.patch
|
||||
do_not_export_private_v8_symbols_on_windows.patch
|
||||
revert_cleanup_switch_offset_of_to_offsetof_where_possible.patch
|
||||
fix_build_deprecated_attirbute_for_older_msvc_versions.patch
|
||||
chore_add_v8_apple_silicon_patches.patch
|
||||
fix_use_proper_page_size_for_mac_arm64.patch
|
||||
fix_correct_calling_convention_for_windows_on_arm.patch
|
||||
perf_make_getpositioninfoslow_faster.patch
|
||||
|
||||
@@ -9,10 +9,10 @@ necessary for native modules to load.
|
||||
Also, some fixes relating to mksnapshot on ARM.
|
||||
|
||||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
index 704ed28caa59eb6159baa2be4f6f94d62db74c16..8bdb2718008eed2a04a916253850a76b5eff8c96 100644
|
||||
index 94b598bc9a2882c1a47fad6d2c47068b472ecb6c..128271ee0305baef31001894a163beff98bcdd6a 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -411,7 +411,7 @@ config("internal_config") {
|
||||
@@ -410,7 +410,7 @@ config("internal_config") {
|
||||
":v8_header_features",
|
||||
]
|
||||
|
||||
@@ -21,7 +21,7 @@ index 704ed28caa59eb6159baa2be4f6f94d62db74c16..8bdb2718008eed2a04a916253850a76b
|
||||
defines += [ "BUILDING_V8_SHARED" ]
|
||||
}
|
||||
}
|
||||
@@ -4478,7 +4478,7 @@ if (current_toolchain == v8_generator_toolchain) {
|
||||
@@ -4477,7 +4477,7 @@ if (current_toolchain == v8_generator_toolchain) {
|
||||
"src/interpreter/bytecodes.h",
|
||||
]
|
||||
|
||||
@@ -30,7 +30,7 @@ index 704ed28caa59eb6159baa2be4f6f94d62db74c16..8bdb2718008eed2a04a916253850a76b
|
||||
|
||||
deps = [
|
||||
":v8_libbase",
|
||||
@@ -4515,6 +4515,8 @@ if (current_toolchain == v8_snapshot_toolchain) {
|
||||
@@ -4514,6 +4514,8 @@ if (current_toolchain == v8_snapshot_toolchain) {
|
||||
|
||||
configs = [ ":internal_config" ]
|
||||
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <marshallofsound@electronjs.org>
|
||||
Date: Mon, 6 Jul 2020 20:47:43 -0700
|
||||
Subject: chore: add v8 apple silicon patches
|
||||
|
||||
Once these are available upstream we can remove this patch.
|
||||
|
||||
diff --git a/src/codegen/arm64/macro-assembler-arm64.cc b/src/codegen/arm64/macro-assembler-arm64.cc
|
||||
index fef1758aaa81a85009461839ec9aa816e7d196a6..c0f7a1cf5fd4787896b06bce911aabf17b290e88 100644
|
||||
--- a/src/codegen/arm64/macro-assembler-arm64.cc
|
||||
+++ b/src/codegen/arm64/macro-assembler-arm64.cc
|
||||
@@ -2975,6 +2975,35 @@ void TurboAssembler::PrintfNoPreserve(const char* format,
|
||||
|
||||
int arg_count = kPrintfMaxArgCount;
|
||||
|
||||
+#if V8_OS_MACOSX && !USE_SIMULATOR
|
||||
+ CPURegList tmp_list = kCallerSaved;
|
||||
+ tmp_list.Remove(x0); // Used to pass the format string.
|
||||
+ tmp_list.Remove(arg0, arg1, arg2, arg3);
|
||||
+
|
||||
+ // Override the MacroAssembler's scratch register list. The lists will be
|
||||
+ // reset automatically at the end of the UseScratchRegisterScope.
|
||||
+ UseScratchRegisterScope temps(this);
|
||||
+ TmpList()->set_list(tmp_list.list());
|
||||
+
|
||||
+ VRegister temp_D = temps.AcquireD();
|
||||
+
|
||||
+ // https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html#//apple_ref/doc/uid/TP40013702-SW1
|
||||
+ Claim(kPrintfMaxArgCount, 8);
|
||||
+ int64_t offset = 0;
|
||||
+ for (unsigned i = 0; i < kPrintfMaxArgCount; i++) {
|
||||
+ CPURegister arg = args[i];
|
||||
+ if (arg.IsNone()) {
|
||||
+ break;
|
||||
+ }
|
||||
+ if (arg.IsS()) {
|
||||
+ fcvt(temp_D, arg.S());
|
||||
+ arg = temp_D;
|
||||
+ }
|
||||
+ // FIXME: Use stp.
|
||||
+ str(arg, MemOperand(sp, offset, Offset));
|
||||
+ offset += 8;
|
||||
+ }
|
||||
+#else
|
||||
// The PCS varargs registers for printf. Note that x0 is used for the printf
|
||||
// format string.
|
||||
static const CPURegList kPCSVarargs =
|
||||
@@ -3085,7 +3114,7 @@ void TurboAssembler::PrintfNoPreserve(const char* format,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
-
|
||||
+#endif
|
||||
// Load the format string into x0, as per the procedure-call standard.
|
||||
//
|
||||
// To make the code as portable as possible, the format string is encoded
|
||||
@@ -3107,6 +3136,10 @@ void TurboAssembler::PrintfNoPreserve(const char* format,
|
||||
}
|
||||
|
||||
CallPrintf(arg_count, pcs);
|
||||
+
|
||||
+#if V8_OS_MACOSX && !USE_SIMULATOR
|
||||
+ Drop(kPrintfMaxArgCount, 8);
|
||||
+#endif
|
||||
}
|
||||
|
||||
void TurboAssembler::CallPrintf(int arg_count, const CPURegister* args) {
|
||||
diff --git a/src/compiler/backend/arm64/instruction-selector-arm64.cc b/src/compiler/backend/arm64/instruction-selector-arm64.cc
|
||||
index fac7f9c1d1146b36b57aa70565fc86a1604887c8..6c13a0747009e38fd574ba94d38b6654fdd70edf 100644
|
||||
--- a/src/compiler/backend/arm64/instruction-selector-arm64.cc
|
||||
+++ b/src/compiler/backend/arm64/instruction-selector-arm64.cc
|
||||
@@ -1898,6 +1898,7 @@ void InstructionSelector::EmitPrepareArguments(
|
||||
|
||||
// Poke the arguments into the stack.
|
||||
while (slot >= 0) {
|
||||
+ // FIXME: In the Apple ARM64 ABI parameters should be packed on the stack.
|
||||
PushParameter input0 = (*arguments)[slot];
|
||||
PushParameter input1 = slot > 0 ? (*arguments)[slot - 1] : PushParameter();
|
||||
// Emit a poke-pair if consecutive parameters have the same type.
|
||||
diff --git a/src/flags/flag-definitions.h b/src/flags/flag-definitions.h
|
||||
index ab689283e970a79bc02dbeee7a4a74720265fcd7..12e54765d316f97297ad0a999ca32c5d07872580 100644
|
||||
--- a/src/flags/flag-definitions.h
|
||||
+++ b/src/flags/flag-definitions.h
|
||||
@@ -763,7 +763,12 @@ DEFINE_INT(wasm_num_compilation_tasks, 128,
|
||||
"maximum number of parallel compilation tasks for wasm")
|
||||
DEFINE_DEBUG_BOOL(trace_wasm_native_heap, false,
|
||||
"trace wasm native heap events")
|
||||
-DEFINE_BOOL(wasm_write_protect_code_memory, false,
|
||||
+#if V8_OS_MACOSX && V8_TARGET_ARCH_ARM64
|
||||
+#define V8_DEFAULT_WASM_WRITE_PROTECT_CODE_MEMORY true
|
||||
+#else
|
||||
+#define V8_DEFAULT_WASM_WRITE_PROTECT_CODE_MEMORY false
|
||||
+#endif
|
||||
+DEFINE_BOOL(wasm_write_protect_code_memory, V8_DEFAULT_WASM_WRITE_PROTECT_CODE_MEMORY,
|
||||
"write protect code memory on the wasm native heap")
|
||||
DEFINE_DEBUG_BOOL(trace_wasm_serialization, false,
|
||||
"trace serialization/deserialization")
|
||||
diff --git a/src/wasm/function-compiler.cc b/src/wasm/function-compiler.cc
|
||||
index 8b41a90992f58c535df285e7fa569b51ae31f85d..1ff813abf44d25e8f2fd84b236623b74913684fb 100644
|
||||
--- a/src/wasm/function-compiler.cc
|
||||
+++ b/src/wasm/function-compiler.cc
|
||||
@@ -258,6 +258,7 @@ void WasmCompilationUnit::CompileWasmFunction(Isolate* isolate,
|
||||
isolate->counters(), detected);
|
||||
if (result.succeeded()) {
|
||||
WasmCodeRefScope code_ref_scope;
|
||||
+ NativeModuleModificationScope native_module_modification_scope(native_module);
|
||||
native_module->PublishCode(
|
||||
native_module->AddCompiledCode(std::move(result)));
|
||||
} else {
|
||||
diff --git a/src/wasm/wasm-code-manager.h b/src/wasm/wasm-code-manager.h
|
||||
index 5e8ed5475bb064cb657069242ce7517de7f5f8e2..5652bb407da3646e55c42492b3e9facec4556367 100644
|
||||
--- a/src/wasm/wasm-code-manager.h
|
||||
+++ b/src/wasm/wasm-code-manager.h
|
||||
@@ -886,7 +886,7 @@ class V8_EXPORT_PRIVATE WasmCodeManager final {
|
||||
// and even if we did, the resulting set of pages may be fragmented.
|
||||
// Currently, we try and keep the number of syscalls low.
|
||||
// - similar argument for debug time.
|
||||
-class NativeModuleModificationScope final {
|
||||
+class V8_EXPORT_PRIVATE NativeModuleModificationScope final {
|
||||
public:
|
||||
explicit NativeModuleModificationScope(NativeModule* native_module);
|
||||
~NativeModuleModificationScope();
|
||||
diff --git a/src/wasm/wasm-objects.cc b/src/wasm/wasm-objects.cc
|
||||
index cf78ab5ff3286d6c07527a323eac4213255fe825..b89433d445f46110ba6cacfc6ec930d31171fd1f 100644
|
||||
--- a/src/wasm/wasm-objects.cc
|
||||
+++ b/src/wasm/wasm-objects.cc
|
||||
@@ -1512,6 +1512,7 @@ void WasmInstanceObject::ImportWasmJSFunctionIntoTable(
|
||||
wasm::WasmCompilationResult result = compiler::CompileWasmImportCallWrapper(
|
||||
isolate->wasm_engine(), &env, kind, sig, false,
|
||||
shared.internal_formal_parameter_count());
|
||||
+ wasm::NativeModuleModificationScope native_module_modification_scope(native_module);
|
||||
std::unique_ptr<wasm::WasmCode> wasm_code = native_module->AddCode(
|
||||
result.func_index, result.code_desc, result.frame_slot_count,
|
||||
result.tagged_parameter_slots,
|
||||
@@ -12,10 +12,10 @@ This patch can be safely removed if, when it is removed, `node.lib` does not
|
||||
contain any standard C++ library exports (e.g. `std::ostringstream`).
|
||||
|
||||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
index da035d3afac94617d163197156dc2871be6c4be3..07fd11838469c4296f50d21a5f7941570293cd58 100644
|
||||
index 6197ec36eb4c2ee3047334be243633ad5e866506..80ad800fa986e616896b782701fe9eb0ba2a0baa 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -411,6 +411,10 @@ config("internal_config") {
|
||||
@@ -410,6 +410,10 @@ config("internal_config") {
|
||||
":v8_header_features",
|
||||
]
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: expose_mksnapshot.patch
|
||||
Needed in order to target mksnapshot for mksnapshot zip.
|
||||
|
||||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
index 8bdb2718008eed2a04a916253850a76b5eff8c96..da035d3afac94617d163197156dc2871be6c4be3 100644
|
||||
index 128271ee0305baef31001894a163beff98bcdd6a..6197ec36eb4c2ee3047334be243633ad5e866506 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -4489,7 +4489,6 @@ if (current_toolchain == v8_generator_toolchain) {
|
||||
@@ -4488,7 +4488,6 @@ if (current_toolchain == v8_generator_toolchain) {
|
||||
|
||||
if (current_toolchain == v8_snapshot_toolchain) {
|
||||
v8_executable("mksnapshot") {
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: John Kleinschmidt <jkleinsc@github.com>
|
||||
Date: Wed, 8 Jul 2020 10:46:13 -0400
|
||||
Subject: fix: use proper page size for mac arm64
|
||||
|
||||
This fix temporarily sets page size to 16k for mac arm64 so that mksnapshot can run on x64
|
||||
and generate a mac arm64 snapshot
|
||||
|
||||
diff --git a/src/base/platform/platform-posix.cc b/src/base/platform/platform-posix.cc
|
||||
index 89173b593a6ce887c0f3cea082f2d31e17f8f5db..f233d83286dd82559ee3573b7adc525adf7ce377 100644
|
||||
--- a/src/base/platform/platform-posix.cc
|
||||
+++ b/src/base/platform/platform-posix.cc
|
||||
@@ -167,9 +167,19 @@ void* Allocate(void* hint, size_t size, OS::MemoryPermission access,
|
||||
PageType page_type) {
|
||||
int prot = GetProtectionFromMemoryPermission(access);
|
||||
int flags = GetFlagsForMemoryPermission(access, page_type);
|
||||
+#if defined(__APPLE__) && V8_TARGET_ARCH_ARM64 && defined(__x86_64__)
|
||||
+ // XXX: This logic is simple and leaky as it is only used for mksnapshot.
|
||||
+ size_t alignment = 16384;
|
||||
+ void* result = mmap(hint, size + alignment, prot, flags, kMmapFd,
|
||||
+ kMmapFdOffset);
|
||||
+ if (result == MAP_FAILED) return nullptr;
|
||||
+ return reinterpret_cast<void*>(
|
||||
+ RoundUp(reinterpret_cast<uintptr_t>(result), alignment));
|
||||
+#else
|
||||
void* result = mmap(hint, size, prot, flags, kMmapFd, kMmapFdOffset);
|
||||
if (result == MAP_FAILED) return nullptr;
|
||||
return result;
|
||||
+#endif
|
||||
}
|
||||
|
||||
#endif // !V8_OS_FUCHSIA
|
||||
@@ -226,7 +236,9 @@ void OS::Initialize(bool hard_abort, const char* const gc_fake_mmap) {
|
||||
}
|
||||
|
||||
int OS::ActivationFrameAlignment() {
|
||||
-#if V8_TARGET_ARCH_ARM
|
||||
+#if defined(__APPLE__) && V8_TARGET_ARCH_ARM
|
||||
+ return 4;
|
||||
+#elif V8_TARGET_ARCH_ARM
|
||||
// On EABI ARM targets this is required for fp correctness in the
|
||||
// runtime system.
|
||||
return 8;
|
||||
@@ -29,6 +29,8 @@ PDB_LIST = [
|
||||
os.path.join(RELEASE_DIR, '{0}.exe.pdb'.format(PROJECT_NAME))
|
||||
]
|
||||
|
||||
PDB_LIST += glob.glob(os.path.join(RELEASE_DIR, '*.dll.pdb'))
|
||||
|
||||
NPX_CMD = "npx"
|
||||
if sys.platform == "win32":
|
||||
NPX_CMD += ".cmd"
|
||||
|
||||
@@ -12,7 +12,5 @@
|
||||
<string>APPL</string>
|
||||
<key>LSBackgroundOnly</key>
|
||||
<true/>
|
||||
<key>LSRequiresNativeExecution</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -308,10 +308,8 @@ void BrowserWindow::OnWindowResize() {
|
||||
if (!draggable_regions_.empty()) {
|
||||
UpdateDraggableRegions(draggable_regions_);
|
||||
} else {
|
||||
// Ensure draggable bounds are recalculated for BrowserViews if any exist.
|
||||
auto browser_views = window_->browser_views();
|
||||
for (NativeBrowserView* view : browser_views) {
|
||||
view->UpdateDraggableRegions(draggable_regions_);
|
||||
for (NativeBrowserView* view : window_->browser_views()) {
|
||||
view->UpdateDraggableRegions(view->GetDraggableRegions());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -70,25 +70,21 @@ void BrowserWindow::UpdateDraggableRegions(
|
||||
|
||||
// Draggable regions are implemented by having the whole web view draggable
|
||||
// and overlaying regions that are not draggable.
|
||||
if (&draggable_regions_ != ®ions) {
|
||||
draggable_regions_.clear();
|
||||
for (const auto& r : regions)
|
||||
draggable_regions_.push_back(r.Clone());
|
||||
}
|
||||
|
||||
auto browser_views = window_->browser_views();
|
||||
for (NativeBrowserView* view : browser_views) {
|
||||
view->UpdateDraggableRegions(draggable_regions_);
|
||||
}
|
||||
if (&draggable_regions_ != ®ions)
|
||||
draggable_regions_ = mojo::Clone(regions);
|
||||
|
||||
std::vector<gfx::Rect> drag_exclude_rects;
|
||||
if (regions.empty()) {
|
||||
drag_exclude_rects.push_back(gfx::Rect(0, 0, webViewWidth, webViewHeight));
|
||||
drag_exclude_rects.emplace_back(0, 0, webViewWidth, webViewHeight);
|
||||
} else {
|
||||
drag_exclude_rects = CalculateNonDraggableRegions(
|
||||
DraggableRegionsToSkRegion(regions), webViewWidth, webViewHeight);
|
||||
}
|
||||
|
||||
for (NativeBrowserView* view : window_->browser_views()) {
|
||||
view->UpdateDraggableRegions(drag_exclude_rects);
|
||||
}
|
||||
|
||||
// Create and add a ControlRegionView for each region that needs to be
|
||||
// excluded from the dragging.
|
||||
for (const auto& rect : drag_exclude_rects) {
|
||||
|
||||
@@ -66,15 +66,26 @@ base::Optional<base::FilePath> CreateTemporaryFileOnIO() {
|
||||
|
||||
void StopTracing(gin_helper::Promise<base::FilePath> promise,
|
||||
base::Optional<base::FilePath> file_path) {
|
||||
auto resolve_or_reject = base::AdaptCallbackForRepeating(base::BindOnce(
|
||||
[](gin_helper::Promise<base::FilePath> promise,
|
||||
const base::FilePath& path, base::Optional<std::string> error) {
|
||||
if (error) {
|
||||
promise.RejectWithErrorMessage(error.value());
|
||||
} else {
|
||||
promise.Resolve(path);
|
||||
}
|
||||
},
|
||||
std::move(promise), *file_path));
|
||||
if (file_path) {
|
||||
auto endpoint = TracingController::CreateFileEndpoint(
|
||||
*file_path, base::AdaptCallbackForRepeating(base::BindOnce(
|
||||
&gin_helper::Promise<base::FilePath>::ResolvePromise,
|
||||
std::move(promise), *file_path)));
|
||||
TracingController::GetInstance()->StopTracing(endpoint);
|
||||
*file_path, base::BindRepeating(resolve_or_reject, base::nullopt));
|
||||
if (!TracingController::GetInstance()->StopTracing(endpoint)) {
|
||||
resolve_or_reject.Run(base::make_optional(
|
||||
"Failed to stop tracing (was a trace in progress?)"));
|
||||
}
|
||||
} else {
|
||||
promise.RejectWithErrorMessage(
|
||||
"Failed to create temporary file for trace data");
|
||||
resolve_or_reject.Run(
|
||||
base::make_optional("Failed to create temporary file for trace data"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "base/values.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/hang_monitor/hang_crash_dump.h"
|
||||
#include "chrome/browser/ssl/security_state_tab_helper.h"
|
||||
#include "content/browser/renderer_host/frame_tree_node.h" // nogncheck
|
||||
#include "content/browser/renderer_host/render_frame_host_manager.h" // nogncheck
|
||||
@@ -141,6 +140,10 @@
|
||||
#include "printing/mojom/print.mojom.h"
|
||||
#endif
|
||||
|
||||
#ifndef MAS_BUILD
|
||||
#include "chrome/browser/hang_monitor/hang_crash_dump.h" // nogncheck
|
||||
#endif
|
||||
|
||||
namespace gin {
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
@@ -1777,7 +1780,9 @@ void WebContents::ForcefullyCrashRenderer() {
|
||||
rph->ForceCrash();
|
||||
#else
|
||||
// Try to generate a crash report for the hung process.
|
||||
#ifndef MAS_BUILD
|
||||
CrashDumpHungChildProcess(rph->GetProcess().Handle());
|
||||
#endif
|
||||
rph->Shutdown(content::RESULT_CODE_HUNG);
|
||||
#endif
|
||||
}
|
||||
@@ -2418,7 +2423,7 @@ bool WebContents::SendIPCMessageWithSender(bool internal,
|
||||
|
||||
bool WebContents::SendIPCMessageToFrame(bool internal,
|
||||
bool send_to_all,
|
||||
int32_t frame_id,
|
||||
v8::Local<v8::Value> frame,
|
||||
const std::string& channel,
|
||||
v8::Local<v8::Value> args) {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
@@ -2428,17 +2433,30 @@ bool WebContents::SendIPCMessageToFrame(bool internal,
|
||||
gin::StringToV8(isolate, "Failed to serialize arguments")));
|
||||
return false;
|
||||
}
|
||||
auto frames = web_contents()->GetAllFrames();
|
||||
auto iter = std::find_if(frames.begin(), frames.end(), [frame_id](auto* f) {
|
||||
return f->GetRoutingID() == frame_id;
|
||||
});
|
||||
if (iter == frames.end())
|
||||
return false;
|
||||
if (!(*iter)->IsRenderFrameLive())
|
||||
int32_t frame_id;
|
||||
int32_t process_id;
|
||||
if (gin::ConvertFromV8(isolate, frame, &frame_id)) {
|
||||
process_id = web_contents()->GetMainFrame()->GetProcess()->GetID();
|
||||
} else {
|
||||
std::vector<int32_t> id_pair;
|
||||
if (gin::ConvertFromV8(isolate, frame, &id_pair) && id_pair.size() == 2) {
|
||||
process_id = id_pair[0];
|
||||
frame_id = id_pair[1];
|
||||
} else {
|
||||
isolate->ThrowException(v8::Exception::Error(gin::StringToV8(
|
||||
isolate,
|
||||
"frameId must be a number or a pair of [processId, frameId]")));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
auto* rfh = content::RenderFrameHost::FromID(process_id, frame_id);
|
||||
if (!rfh || !rfh->IsRenderFrameLive() ||
|
||||
content::WebContents::FromRenderFrameHost(rfh) != web_contents())
|
||||
return false;
|
||||
|
||||
mojo::AssociatedRemote<mojom::ElectronRenderer> electron_renderer;
|
||||
(*iter)->GetRemoteAssociatedInterfaces()->GetInterface(&electron_renderer);
|
||||
rfh->GetRemoteAssociatedInterfaces()->GetInterface(&electron_renderer);
|
||||
electron_renderer->Message(internal, send_to_all, channel, std::move(message),
|
||||
0 /* sender_id */);
|
||||
return true;
|
||||
@@ -3113,6 +3131,12 @@ namespace {
|
||||
using electron::api::GetAllWebContents;
|
||||
using electron::api::WebContents;
|
||||
|
||||
gin::Handle<WebContents> WebContentsFromID(v8::Isolate* isolate, int32_t id) {
|
||||
WebContents* contents = WebContents::FromID(id);
|
||||
return contents ? gin::CreateHandle(isolate, contents)
|
||||
: gin::Handle<WebContents>();
|
||||
}
|
||||
|
||||
std::vector<gin::Handle<WebContents>> GetAllWebContentsAsV8(
|
||||
v8::Isolate* isolate) {
|
||||
std::vector<gin::Handle<WebContents>> list;
|
||||
@@ -3131,7 +3155,7 @@ void Initialize(v8::Local<v8::Object> exports,
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("WebContents", WebContents::GetConstructor(context));
|
||||
dict.SetMethod("create", &WebContents::Create);
|
||||
dict.SetMethod("fromId", &WebContents::FromID);
|
||||
dict.SetMethod("fromId", &WebContentsFromID);
|
||||
dict.SetMethod("getAllWebContents", &GetAllWebContentsAsV8);
|
||||
}
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ class WebContents : public gin::Wrappable<WebContents>,
|
||||
|
||||
bool SendIPCMessageToFrame(bool internal,
|
||||
bool send_to_all,
|
||||
int32_t frame_id,
|
||||
v8::Local<v8::Value> frame,
|
||||
const std::string& channel,
|
||||
v8::Local<v8::Value> args);
|
||||
|
||||
|
||||
@@ -196,19 +196,30 @@ std::vector<Browser::LaunchItem> GetLoginItemSettingsHelper(
|
||||
const Browser::LoginItemSettings& options) {
|
||||
std::vector<Browser::LaunchItem> launch_items;
|
||||
|
||||
while (it->Valid()) {
|
||||
base::string16 exe = options.path;
|
||||
if (FormatCommandLineString(&exe, options.args)) {
|
||||
base::FilePath lookup_exe_path;
|
||||
if (options.path.empty()) {
|
||||
base::string16 process_exe_path;
|
||||
GetProcessExecPath(&process_exe_path);
|
||||
lookup_exe_path =
|
||||
base::CommandLine::FromString(process_exe_path).GetProgram();
|
||||
} else {
|
||||
lookup_exe_path = base::CommandLine::FromString(options.path).GetProgram();
|
||||
}
|
||||
|
||||
if (!lookup_exe_path.empty()) {
|
||||
while (it->Valid()) {
|
||||
base::CommandLine registry_launch_cmd =
|
||||
base::CommandLine::FromString(it->Value());
|
||||
base::FilePath registry_launch_path = registry_launch_cmd.GetProgram();
|
||||
bool exe_match = base::FilePath::CompareEqualIgnoreCase(
|
||||
lookup_exe_path.value(), registry_launch_path.value());
|
||||
|
||||
// add launch item to vector if it has a matching path (case-insensitive)
|
||||
if ((base::CompareCaseInsensitiveASCII(it->Value(), exe.c_str())) == 0) {
|
||||
if (exe_match) {
|
||||
Browser::LaunchItem launch_item;
|
||||
base::string16 launch_path = options.path;
|
||||
if (launch_path.empty()) {
|
||||
GetProcessExecPath(&launch_path);
|
||||
}
|
||||
launch_item.name = it->Name();
|
||||
launch_item.path = launch_path;
|
||||
launch_item.args = options.args;
|
||||
launch_item.path = registry_launch_path.value();
|
||||
launch_item.args = registry_launch_cmd.GetArgs();
|
||||
launch_item.scope = scope;
|
||||
launch_item.enabled = true;
|
||||
|
||||
@@ -249,8 +260,8 @@ std::vector<Browser::LaunchItem> GetLoginItemSettingsHelper(
|
||||
reinterpret_cast<char*>(binary_accepted_alt));
|
||||
std::string reg_startup_binary(
|
||||
reinterpret_cast<char*>(startup_binary));
|
||||
launch_item.enabled = (reg_binary == reg_startup_binary) ||
|
||||
(reg_binary == reg_binary_alt);
|
||||
launch_item.enabled = (reg_startup_binary == reg_binary) ||
|
||||
(reg_startup_binary == reg_binary_alt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,8 +270,8 @@ std::vector<Browser::LaunchItem> GetLoginItemSettingsHelper(
|
||||
*executable_will_launch_at_login || launch_item.enabled;
|
||||
launch_items.push_back(launch_item);
|
||||
}
|
||||
it->operator++();
|
||||
}
|
||||
it->operator++();
|
||||
}
|
||||
return launch_items;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user