-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Propagate emulated window segments to renderer
Ensure that window_segments on WebDeviceEmulationParams are copied over IPC and consumed in the renderer. The params are stored on RenderWidgetScreenMetricsEmulator which uses these to call back to set the emulated values on the RenderWidget. The original segments are also stored so that they can be restored if the segments are no longer emulated (either due to emulation being non longer applied or if a future setDeviceMetricsOverride does not contain the segments). Bug: 1099026 Change-Id: I9f32e432dc6e600ce3843e7774e7e0da53a97a5a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2262193 Commit-Queue: Daniel Libby <dlibby@microsoft.com> Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Cr-Commit-Position: refs/heads/master@{#788997}
- Loading branch information
Showing
8 changed files
with
161 additions
and
26 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
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
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
41 changes: 41 additions & 0 deletions
41
...link/web_tests/inspector-protocol/emulation/device-emulation-window-segments-expected.txt
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,41 @@ | ||
Tests that device emulation of window segments is propagated and powers getWindowSegments API. | ||
No segments: | ||
Main frame segments: | ||
1 | ||
0 0 800 600 | ||
Iframe segments: | ||
1 | ||
0 0 800 600 | ||
Side-by-side segments | ||
Main frame segments: | ||
2 | ||
0 0 390 600 | ||
410 0 390 600 | ||
Iframe segments: | ||
2 | ||
0 0 390 600 | ||
410 0 390 600 | ||
Unspecified display feature | ||
Main frame segments: | ||
1 | ||
0 0 800 600 | ||
Iframe segments: | ||
1 | ||
0 0 800 600 | ||
Stacked segments | ||
Main frame segments: | ||
2 | ||
0 0 800 290 | ||
0 310 800 290 | ||
Iframe segments: | ||
2 | ||
0 0 800 290 | ||
0 310 800 290 | ||
Emulation disabled | ||
Main frame segments: | ||
1 | ||
0 0 800 600 | ||
Iframe segments: | ||
1 | ||
0 0 800 600 | ||
|
52 changes: 52 additions & 0 deletions
52
third_party/blink/web_tests/inspector-protocol/emulation/device-emulation-window-segments.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,52 @@ | ||
(async function(testRunner) { | ||
let {page, session, dp} = await testRunner.startBlank('Tests that device emulation of window segments is propagated and powers getWindowSegments API.'); | ||
|
||
let deviceMetrics = { | ||
width: 800, | ||
height: 600, | ||
deviceScaleFactor: 2, | ||
mobile: false, | ||
fitWindow: false, | ||
scale: 2, | ||
screenWidth: 1200, | ||
screenHeight: 1000, | ||
positionX: 110, | ||
positionY: 120, | ||
}; | ||
|
||
await session.protocol.Emulation.setDeviceMetricsOverride(deviceMetrics); | ||
|
||
await session.navigate('../resources/device-emulation.html'); | ||
|
||
testRunner.log("No segments:"); | ||
testRunner.log(await session.evaluate(`dumpWindowSegments()`)); | ||
|
||
testRunner.log("Side-by-side segments"); | ||
deviceMetrics.displayFeature = { | ||
orientation: "vertical", | ||
offset: 390, | ||
maskLength: 20 | ||
}; | ||
await session.protocol.Emulation.setDeviceMetricsOverride(deviceMetrics); | ||
testRunner.log(await session.evaluate(`dumpWindowSegments()`)); | ||
|
||
testRunner.log("Unspecified display feature"); | ||
delete deviceMetrics.displayFeature; | ||
await session.protocol.Emulation.setDeviceMetricsOverride(deviceMetrics); | ||
testRunner.log(await session.evaluate(`dumpWindowSegments()`)); | ||
|
||
testRunner.log("Stacked segments"); | ||
deviceMetrics.displayFeature = { | ||
orientation: "horizontal", | ||
offset: 290, | ||
maskLength: 20 | ||
}; | ||
await session.protocol.Emulation.setDeviceMetricsOverride(deviceMetrics); | ||
testRunner.log(await session.evaluate(`dumpWindowSegments()`)); | ||
|
||
testRunner.log("Emulation disabled"); | ||
await dp.Emulation.clearDeviceMetricsOverride(); | ||
testRunner.log(await session.evaluate(`dumpWindowSegments()`)); | ||
|
||
testRunner.completeTest(); | ||
}) |
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