refactor iframe element fields to support sending size to the constellation

This commit is contained in:
Tim Kuehn 2013-08-07 17:52:09 -07:00
parent 86f0aacb3d
commit 666c29480e
4 changed files with 42 additions and 10 deletions

View file

@ -16,10 +16,28 @@ use extra::url::Url;
pub struct HTMLIFrameElement {
parent: HTMLElement,
frame: Option<Url>,
subpage_id: Option<SubpageId>,
size_future_chan: Option<ChanOne<Size2D<uint>>>,
size: Option<IframeSize>,
}
struct IframeSize {
pipeline_id: PipelineId,
subpage_id: SubpageId,
future_chan: Option<ChanOne<Size2D<uint>>>,
constellation_chan: ConstellationChan,
}
impl IframeSize {
pub fn set_rect(&mut self, rect: Rect<f32>) {
let future_chan = replace(&mut self.future_chan, None);
do future_chan.map_consume |future_chan| {
let Size2D { width, height } = rect.size;
future_chan.send(Size2D(width as uint, height as uint));
};
self.constellation_chan.send(FrameRectMsg(self.pipeline_id, self.subpage_id, rect));
}
}
impl HTMLIFrameElement {
pub fn Src(&self) -> DOMString {
null_string
@ -123,4 +141,4 @@ impl HTMLIFrameElement {
pub fn GetSVGDocument(&self) -> Option<AbstractDocument> {
None
}
}
}