diff options
author | Tim Kuehn <tkuehn@cmu.edu> | 2013-08-07 17:52:09 -0700 |
---|---|---|
committer | Tim Kuehn <tkuehn@cmu.edu> | 2013-08-19 19:11:11 -0400 |
commit | 666c29480e805a5daa65acf5b34692a4c9c8b3f9 (patch) | |
tree | 3fc84fc41104ff643251f2514ccc2449cce13a22 /src/components/script/dom/htmliframeelement.rs | |
parent | 86f0aacb3d59e908c0817e3906f267e3608133a2 (diff) | |
download | servo-666c29480e805a5daa65acf5b34692a4c9c8b3f9.tar.gz servo-666c29480e805a5daa65acf5b34692a4c9c8b3f9.zip |
refactor iframe element fields to support sending size to the constellation
Diffstat (limited to 'src/components/script/dom/htmliframeelement.rs')
-rw-r--r-- | src/components/script/dom/htmliframeelement.rs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/components/script/dom/htmliframeelement.rs b/src/components/script/dom/htmliframeelement.rs index 98217737a27..8fa028baff2 100644 --- a/src/components/script/dom/htmliframeelement.rs +++ b/src/components/script/dom/htmliframeelement.rs @@ -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 } -}
\ No newline at end of file +} |