mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
dom: Calculate the viewport size of iframes when they are first added to the tree.
This commit is contained in:
parent
38e4ae0833
commit
fd260f78c8
10 changed files with 72 additions and 11 deletions
|
@ -7,6 +7,7 @@
|
|||
use crate::context::LayoutContext;
|
||||
use app_units::Au;
|
||||
use euclid::default::{Point2D, Rect};
|
||||
use euclid::Size2D;
|
||||
use euclid::Vector2D;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
|
@ -22,6 +23,7 @@ use std::sync::{Arc, Mutex};
|
|||
use style::dom::OpaqueNode;
|
||||
use style::properties::PropertyId;
|
||||
use style::selector_parser::PseudoElement;
|
||||
use style_traits::CSSPixel;
|
||||
use webrender_api::units::LayoutPixel;
|
||||
use webrender_api::ExternalScrollId;
|
||||
|
||||
|
@ -70,6 +72,9 @@ pub struct LayoutThreadData {
|
|||
|
||||
/// A queued response for the inner text of a given element.
|
||||
pub element_inner_text_response: String,
|
||||
|
||||
/// A queued response for the viewport dimensions for a given browsing context.
|
||||
pub inner_window_dimensions_response: Option<Size2D<f32, CSSPixel>>,
|
||||
}
|
||||
|
||||
pub struct LayoutRPCImpl(pub Arc<Mutex<LayoutThreadData>>);
|
||||
|
@ -150,6 +155,12 @@ impl LayoutRPC for LayoutRPCImpl {
|
|||
let rw_data = rw_data.lock().unwrap();
|
||||
rw_data.element_inner_text_response.clone()
|
||||
}
|
||||
|
||||
fn inner_window_dimensions(&self) -> Option<Size2D<f32, CSSPixel>> {
|
||||
let &LayoutRPCImpl(ref rw_data) = self;
|
||||
let rw_data = rw_data.lock().unwrap();
|
||||
rw_data.inner_window_dimensions_response.clone()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn process_content_box_request(_requested_node: OpaqueNode) -> Option<Rect<Au>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue