mirror of
https://github.com/servo/servo.git
synced 2025-06-24 00:54:32 +01:00
support in layout to send iframe sizes
This commit is contained in:
parent
666c29480e
commit
a58b01bc86
3 changed files with 28 additions and 0 deletions
|
@ -398,6 +398,7 @@ impl Constellation {
|
|||
}
|
||||
|
||||
fn handle_frame_rect_msg(&mut self, pipeline_id: PipelineId, subpage_id: SubpageId, rect: Rect<f32>) {
|
||||
debug!("Received frame rect %? from %?, %?", rect, pipeline_id, subpage_id);
|
||||
let mut already_sent = HashSet::new();
|
||||
|
||||
// If the subframe is in the current frame tree, the compositor needs the new size
|
||||
|
@ -639,6 +640,7 @@ impl Constellation {
|
|||
// TODO(tkuehn): In fact, this kind of message might be provably
|
||||
// impossible to occur.
|
||||
if current_frame.contains(pipeline_id) {
|
||||
debug!("updating compositor frame tree with %?", current_frame);
|
||||
self.set_ids(current_frame);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ use layout::float_context::{FloatContext, Invalid};
|
|||
|
||||
use std::cell::Cell;
|
||||
use geom::point::Point2D;
|
||||
use geom::size::Size2D;
|
||||
use geom::rect::Rect;
|
||||
use gfx::display_list::DisplayList;
|
||||
use gfx::geometry::Au;
|
||||
|
@ -364,6 +365,25 @@ impl BlockFlowData {
|
|||
list: &Cell<DisplayList<E>>)
|
||||
-> bool {
|
||||
|
||||
if self.common.node.is_iframe_element() {
|
||||
let x = self.common.abs_position.x + do self.box.map_default(Au(0)) |box| {
|
||||
box.with_model(|model| model.margin.left + model.border.left + model.padding.left)
|
||||
};
|
||||
let y = self.common.abs_position.y + do self.box.map_default(Au(0)) |box| {
|
||||
box.with_model(|model| model.margin.top + model.border.top + model.padding.top)
|
||||
};
|
||||
let w = self.common.position.size.width - do self.box.map_default(Au(0)) |box| {
|
||||
box.with_model(|model| model.noncontent_width())
|
||||
};
|
||||
let h = self.common.position.size.height - do self.box.map_default(Au(0)) |box| {
|
||||
box.with_model(|model| model.noncontent_height())
|
||||
};
|
||||
do self.common.node.with_mut_iframe_element |iframe_element| {
|
||||
iframe_element.size.get_mut_ref().set_rect(Rect(Point2D(x.to_f32(), y.to_f32()),
|
||||
Size2D(w.to_f32(), h.to_f32())));
|
||||
}
|
||||
}
|
||||
|
||||
let abs_rect = Rect(self.common.abs_position, self.common.position.size);
|
||||
if !abs_rect.intersects(dirty) {
|
||||
return false;
|
||||
|
|
|
@ -119,6 +119,12 @@ impl BoxModel {
|
|||
left + right
|
||||
}
|
||||
|
||||
pub fn noncontent_height(&self) -> Au {
|
||||
let top = self.margin.top + self.border.top + self.padding.top;
|
||||
let bottom = self.margin.bottom + self.border.bottom + self.padding.bottom;
|
||||
top + bottom
|
||||
}
|
||||
|
||||
pub fn offset(&self) -> Au {
|
||||
self.margin.left + self.border.left + self.padding.left
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue