forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reland "Consistent touchpad pinch behaviour for app windows and webvi…
…ews" This is a reland of be51aad Original change's description: > Consistent touchpad pinch behaviour for app windows and webviews > > Currently, app windows (possibly containing webviews): > 1) suppress all pinch events which also suppresses the > synthetic wheel event, but not touchscreen touch events, and > 2) allow "smart zoom" on Mac which can change the page scale even > though other means of changing the page scale are suppressed. > > As a result of (1), if we have, say, google maps in a webview, a > user can pinch zoom with a touchscreen, but not with a touchpad. > > We now suppress gesture events to app windows based on whether they > cause a scale change. So now touchscreen and touchpad pinching are > consistent since the page has access to the events so that it may > implement custom pinch zoom behaviour, but unhandled events still > do not result in a scale change for the app window. Also, smart > zoom is suppressed to be consistent with other touchpad pinching. > > Bug: 725970, 874132 > Change-Id: I03dd2048002d69dc7c8a822fc727140c67d64706 > Reviewed-on: https://chromium-review.googlesource.com/1174933 > Reviewed-by: Ben Wells <benwells@chromium.org> > Reviewed-by: James MacLean <wjmaclean@chromium.org> > Reviewed-by: Ehsan Karamad <ekaramad@chromium.org> > Commit-Queue: Kevin McNee <mcnee@chromium.org> > Cr-Commit-Position: refs/heads/master@{#585489} Bug: 725970, 874132 Change-Id: I23420821c1166f7b641faf672798ddac0e928ad9 Reviewed-on: https://chromium-review.googlesource.com/1187345 Reviewed-by: Ehsan Karamad <ekaramad@chromium.org> Reviewed-by: James MacLean <wjmaclean@chromium.org> Reviewed-by: Ben Wells <benwells@chromium.org> Commit-Queue: Kevin McNee <mcnee@chromium.org> Cr-Commit-Position: refs/heads/master@{#585856}
- Loading branch information
Showing
14 changed files
with
200 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
chrome/test/data/extensions/platform_apps/touchpad_pinch/background.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright 2018 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. | ||
|
||
chrome.app.runtime.onLaunched.addListener(function() { | ||
chrome.app.window.create('window.html'); | ||
}); |
10 changes: 10 additions & 0 deletions
10
chrome/test/data/extensions/platform_apps/touchpad_pinch/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "Touchpad pinch synthetic wheel event", | ||
"version": "1", | ||
"manifest_version": 2, | ||
"app": { | ||
"background": { | ||
"scripts": ["background.js"] | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
chrome/test/data/extensions/platform_apps/touchpad_pinch/window.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!-- | ||
* Copyright (c) 2018 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. | ||
--> | ||
<html> | ||
<head> | ||
<style> | ||
html,body { | ||
height: 100%; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<p>Hello.</p> | ||
<script src="window.js"></script> | ||
</body> | ||
</html> |
17 changes: 17 additions & 0 deletions
17
chrome/test/data/extensions/platform_apps/touchpad_pinch/window.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2018 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. | ||
|
||
window.onload = () => { | ||
document.body.addEventListener('wheel', (e) => { | ||
chrome.test.sendMessage('Seen wheel event'); | ||
}); | ||
|
||
// We need to wait for the compositor thread to be made aware of the wheel | ||
// listener before sending the pinch event sequence. | ||
window.requestAnimationFrame(() => { | ||
window.requestAnimationFrame(() => { | ||
chrome.test.sendMessage('Launched'); | ||
}); | ||
}); | ||
}; |
10 changes: 10 additions & 0 deletions
10
chrome/test/data/extensions/platform_apps/web_view/touchpad_pinch/embedder.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!-- | ||
* Copyright (c) 2018 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. | ||
--> | ||
<html> | ||
<body> | ||
<script src="embedder.js"></script> | ||
</body> | ||
</html> |
20 changes: 20 additions & 0 deletions
20
chrome/test/data/extensions/platform_apps/web_view/touchpad_pinch/embedder.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2018 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. | ||
|
||
window.onload = () => { | ||
chrome.test.getConfig(function(config) { | ||
var guestURL = 'http://localhost:' + config.testServer.port + | ||
'/extensions/platform_apps/web_view/touchpad_pinch/guest.html'; | ||
var webview = document.createElement('webview'); | ||
webview.src = guestURL; | ||
webview.addEventListener('loadstop', () => { | ||
webview.contentWindow.postMessage({}, '*'); | ||
}); | ||
document.body.appendChild(webview); | ||
}); | ||
}; | ||
|
||
window.addEventListener('message', (e) => { | ||
chrome.test.sendMessage(e.data); | ||
}); |
18 changes: 18 additions & 0 deletions
18
chrome/test/data/extensions/platform_apps/web_view/touchpad_pinch/guest.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!-- | ||
* Copyright (c) 2018 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. | ||
--> | ||
<html> | ||
<head> | ||
<style> | ||
html,body { | ||
height: 100%; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<p>Hello.</p> | ||
<script src="guest.js"></script> | ||
</body> | ||
</html> |
23 changes: 23 additions & 0 deletions
23
chrome/test/data/extensions/platform_apps/web_view/touchpad_pinch/guest.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2018 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. | ||
|
||
var parentWindow = null; | ||
|
||
window.onload = () => { | ||
document.body.addEventListener('wheel', (e) => { | ||
parentWindow.postMessage('Seen wheel event', '*'); | ||
}); | ||
}; | ||
|
||
window.addEventListener('message', (e) => { | ||
parentWindow = e.source; | ||
|
||
// We need to wait for the compositor thread to be made aware of the wheel | ||
// listener before sending the pinch event sequence. | ||
window.requestAnimationFrame(() => { | ||
window.requestAnimationFrame(() => { | ||
parentWindow.postMessage('WebViewTest.LAUNCHED', '*'); | ||
}); | ||
}); | ||
}); |
13 changes: 13 additions & 0 deletions
13
chrome/test/data/extensions/platform_apps/web_view/touchpad_pinch/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "<webview> Touchpad pinch synthetic wheel event", | ||
"version": "1", | ||
"manifest_version": 2, | ||
"permissions": [ | ||
"webview" | ||
], | ||
"app": { | ||
"background": { | ||
"scripts": ["test.js"] | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
chrome/test/data/extensions/platform_apps/web_view/touchpad_pinch/test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright 2018 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. | ||
|
||
chrome.app.runtime.onLaunched.addListener(function() { | ||
chrome.app.window.create('embedder.html'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters