paint: Correctly apply viewport <meta> initial-scale#43160
paint: Correctly apply viewport <meta> initial-scale#43160shubhamg13 wants to merge 2 commits intoservo:mainfrom
Conversation
|
4f0c72f to
81110a7
Compare
81110a7 to
b2e38b2
Compare
components/servo/tests/webview.rs
Outdated
| let load_webview = webview.clone(); | ||
| let _ = servo_test.spin(move || load_webview.load_status() != LoadStatus::Complete); | ||
| show_webview_and_wait_for_rendering_to_be_ready(&servo_test, &webview, &delegate); | ||
| let eval_visual_viewport = |attr: &str| { |
There was a problem hiding this comment.
This function is not used in this PR.
|
@stevennovaryo might know better about this one. |
b2e38b2 to
e681974
Compare
e681974 to
efc3412
Compare
efc3412 to
a035223
Compare
a035223 to
e75f69f
Compare
Signed-off-by: Shubham Gupta <[email protected]>
Signed-off-by: Shubham Gupta <[email protected]>
e75f69f to
5909efd
Compare
|
🔨 Triggering try run (#23597795448) for Linux (WPT) |
|
Test results for linux-wpt from try job (#23597795448): Flaky unexpected result (33)
Stable unexpected results that are known to be intermittent (19)
|
|
✨ Try run (#23597795448) succeeded. |
| self.adjust_pinch_zoom( | ||
| self.viewport_description.initial_scale.get(), | ||
| DevicePoint::origin(), | ||
| ); |
There was a problem hiding this comment.
I am unsure whether we should apply this directly into the pinch zoom. From a simple demo it seems to affect layout like page zoom, but it also adds on into VisualViewport.scale.
For example, lets consider the following HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="initial-scale=1.0">
<style>
#target {
background-color: green;
padding: 20px;
border-radius: 8px;
max-width: 220px;
word-wrap: break-word;
}
.child {
background-color: palegreen;
display: inline-block;
width: 50px;
height: 50px;
padding: 10px;
}
</style>
</head>
<body>
<div id="target">
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
</div>
</body>
</html>If we change the initial-scale to a certain amount, the layout will follow the available space and the values returned by layout queries will be different as well.
There was a problem hiding this comment.
Yes, some values will be different as we skip parsing device-width from meta and its application in any calculation. I checked with your sample with scale 2.0 it works consistent.
As far as considering current architecture of Servo and broken bits of specs, it felt right to apply to pinch-zoom and resize layout viewport accordingly.
If you have any suggestions, I'm open to it.
) Scenario proposed should be best tested using unit tests. Testing: TODO (Waiting for #43160) Fixes: #41582 Signed-off-by: Shubham Gupta <[email protected]>
Fixup: #40055
Instead of applying initial scale to page.
initial-scaleshould directly affect thevisualviewport.scaleas it is layer that manages zoom factor [css-viewport] How to determine minimum-scale and layout viewport size? w3c/csswg-drafts#9004initial-scaleshould be considered withdevice_pixel_ratiowhile calculatinglayout_viewportas per following spec gudelines.Specs: https://www.w3.org/TR/css-viewport-1/#the-viewport
Sample Page: viewport_meta_with_style_2.html
Testing:
tests/webview.rs:test_viewport_meta_tag_initial_scaleFixes: #39002