mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Pass Viewport Description to compositor
Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
This commit is contained in:
parent
55b1a9be2f
commit
4c12008f58
4 changed files with 22 additions and 2 deletions
|
@ -973,6 +973,7 @@ impl IOCompositor {
|
|||
warn!("Sending response to get screen size failed ({error:?}).");
|
||||
}
|
||||
},
|
||||
CompositorMsg::Viewport(_webview_id, _viewport_description) => {},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ mod from_constellation {
|
|||
Self::GetScreenSize(..) => target!("GetScreenSize"),
|
||||
Self::GetAvailableScreenSize(..) => target!("GetAvailableScreenSize"),
|
||||
Self::CollectMemoryReport(..) => target!("CollectMemoryReport"),
|
||||
Self::Viewport(..) => target!("Viewport"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::str::FromStr;
|
||||
|
||||
use compositing_traits::CompositorMsg;
|
||||
use compositing_traits::viewport_description::ViewportDescription;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::{LocalName, Prefix, local_name, ns};
|
||||
|
@ -126,8 +129,19 @@ impl HTMLMetaElement {
|
|||
return;
|
||||
}
|
||||
let element = self.upcast::<Element>();
|
||||
if let Some(content) = element.get_attribute(&ns!(), &local_name!("content")) {
|
||||
let _viewport = ViewportDescription::from_str(&content.value()).unwrap_or_default();
|
||||
let Some(content) = element.get_attribute(&ns!(), &local_name!("content")) else {
|
||||
return;
|
||||
};
|
||||
|
||||
if let Ok(viewport) = ViewportDescription::from_str(&content.value()) {
|
||||
self.owner_window()
|
||||
.compositor_api()
|
||||
.sender()
|
||||
.send(CompositorMsg::Viewport(
|
||||
self.owner_window().webview_id(),
|
||||
viewport,
|
||||
))
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,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 {
|
||||
|
@ -177,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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue