mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01: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
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue