mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
renderer: Have the viewport meta element establish the initial zoom of new pages (#37315)
This patch contains 2 components: 1. Instead of passing `self.pinch_zoom_level().get()` while checking `zoom_result`, initialize it in `combined_magnification`. Ideally, this part shouldn't have any effect on behavior. 2. Separates the logic for PinchZoom and ViewportZoom. So, when a new page is opened, it will start with its own viewport zoom scale (rather than the previous scale multiples). i.e `self.pinch_zoom_level().get() * 1.0 * magnification` ```rust let mut combined_magnification = 1.0; ... ScrollZoomEvent::ViewportZoom(magnification) => { combined_magnification *= magnification }, ... let pinch_zoom_result = match self.set_pinch_zoom_level(self.pinch_zoom_level().get() * combined_magnification) ``` Testing: This change adds a new WPT test. Fixes: #37314 --------- Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
This commit is contained in:
parent
547ce67514
commit
34829dfce7
5 changed files with 83 additions and 11 deletions
25
tests/wpt/meta/MANIFEST.json
vendored
25
tests/wpt/meta/MANIFEST.json
vendored
|
@ -373460,6 +373460,21 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"visual-viewport": {
|
||||
"viewport-apply-initial-scale-after-navigation.html": [
|
||||
"ec03c380d6d27ed0b486a26203d441dc101fd39f",
|
||||
[
|
||||
null,
|
||||
[
|
||||
[
|
||||
"/visual-viewport/viewport-apply-initial-scale-after-navigation-ref.html",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
{}
|
||||
]
|
||||
]
|
||||
},
|
||||
"web-animations": {
|
||||
"animation-model": {
|
||||
"keyframe-effects": {
|
||||
|
@ -522286,6 +522301,16 @@
|
|||
"c036b16ec87bc7e562c4040ad1923c5a8b483cec",
|
||||
[]
|
||||
],
|
||||
"resource": {
|
||||
"viewport-apply-initial-scale-after-navigation-inner.html": [
|
||||
"edbf5dbb70aa916363ff32eab847f2d03562d4f5",
|
||||
[]
|
||||
]
|
||||
},
|
||||
"viewport-apply-initial-scale-after-navigation-ref.html": [
|
||||
"904d370d6b464ef526b79e3974532d3f2c57d13b",
|
||||
[]
|
||||
],
|
||||
"viewport_support.js": [
|
||||
"a82bd2b028010e053199e55bd7bb357361581e6f",
|
||||
[]
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<title>Viewport: Apply initial-scale after Navigation</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<script>
|
||||
onload = takeScreenshot;
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Viewport: Apply initial-scale after Navigation</h1>
|
||||
<p>Test passes if page opens with own initial-scale of 1.0</p>
|
||||
</body>
|
||||
</html>
|
12
tests/wpt/tests/visual-viewport/viewport-apply-initial-scale-after-navigation-ref.html
vendored
Normal file
12
tests/wpt/tests/visual-viewport/viewport-apply-initial-scale-after-navigation-ref.html
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Viewport: Apply initial-scale after Navigation</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Viewport: Apply initial-scale after Navigation</h1>
|
||||
<p>Test passes if page opens with own initial-scale of 1.0</p>
|
||||
</body>
|
||||
</html>
|
17
tests/wpt/tests/visual-viewport/viewport-apply-initial-scale-after-navigation.html
vendored
Normal file
17
tests/wpt/tests/visual-viewport/viewport-apply-initial-scale-after-navigation.html
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<title>Viewport: Apply initial-scale after Navigation</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=2.0">
|
||||
<link rel="match" href="viewport-apply-initial-scale-after-navigation-ref.html">
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<script>
|
||||
function runTest() {
|
||||
const url = "resource/viewport-apply-initial-scale-after-navigation-inner.html";
|
||||
window.location.replace(new URL(url, window.location));
|
||||
}
|
||||
onload = () => runTest();
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue