Add support for parsing and applying viewport <meta> (#35901)

This patch comprises following steps:
1. Parses the `viewport` Attribute from `<meta>`.
2. Creates a `ViewportDescription` struct.
3. Populate values into Viewport struct.
4. Pass & Stash Viewport Description to Webview.
5. Process parsed values of `viewport <meta>`

Testing: Tested locally.
Fixes: #36159

---------

Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>
Co-authored-by: Xiaocheng Hu <xiaochengh.work@gmail.com>
This commit is contained in:
Shubham Gupta 2025-06-06 23:13:51 +08:00 committed by GitHub
parent c7a215faba
commit aff2a85372
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 248 additions and 19 deletions

View file

@ -23,6 +23,7 @@ use webrender_api::DocumentId;
pub mod display_list;
pub mod rendering_context;
pub mod viewport_description;
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
@ -42,6 +43,8 @@ use webrender_api::{
ImageKey, NativeFontHandle, PipelineId as WebRenderPipelineId,
};
use crate::viewport_description::ViewportDescription;
/// Sends messages to the compositor.
#[derive(Clone)]
pub struct CompositorProxy {
@ -176,6 +179,8 @@ pub enum CompositorMsg {
/// Measure the current memory usage associated with the compositor.
/// The report must be sent on the provided channel once it's complete.
CollectMemoryReport(ReportsChan),
/// A top-level frame has parsed a viewport metatag and is sending the new constraints.
Viewport(WebViewId, ViewportDescription),
}
impl Debug for CompositorMsg {