mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Issue #1071 - Ensure that Documents always have a non-null Window.
This commit is contained in:
parent
c9c9eec3d8
commit
60b6d1bb57
7 changed files with 29 additions and 53 deletions
|
@ -44,10 +44,9 @@ impl HTMLImageElement {
|
|||
if "src" == name {
|
||||
let doc = self.htmlelement.element.node.owner_doc;
|
||||
do doc.with_base |doc| {
|
||||
for window in doc.window.iter() {
|
||||
let url = window.page.url.map(|&(ref url, _)| url.clone());
|
||||
self.update_image(window.image_cache_task.clone(), url);
|
||||
}
|
||||
let window = doc.window;
|
||||
let url = window.page.url.map(|&(ref url, _)| url.clone());
|
||||
self.update_image(window.image_cache_task.clone(), url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,19 +99,11 @@ impl HTMLImageElement {
|
|||
|
||||
pub fn Width(&self, abstract_self: AbstractNode<ScriptView>) -> u32 {
|
||||
let node = &self.htmlelement.element.node;
|
||||
match node.owner_doc.with_base(|doc| doc.window) {
|
||||
Some(win) => {
|
||||
let page = win.page;
|
||||
let (port, chan) = stream();
|
||||
match page.query_layout(ContentBoxQuery(abstract_self, chan), port) {
|
||||
ContentBoxResponse(rect) => {
|
||||
to_px(rect.size.width) as u32
|
||||
}
|
||||
}
|
||||
}
|
||||
None => {
|
||||
debug!("no window");
|
||||
0
|
||||
let page = node.owner_doc.with_base(|doc| doc.window).page;
|
||||
let (port, chan) = stream();
|
||||
match page.query_layout(ContentBoxQuery(abstract_self, chan), port) {
|
||||
ContentBoxResponse(rect) => {
|
||||
to_px(rect.size.width) as u32
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,19 +120,11 @@ impl HTMLImageElement {
|
|||
|
||||
pub fn Height(&self, abstract_self: AbstractNode<ScriptView>) -> u32 {
|
||||
let node = &self.htmlelement.element.node;
|
||||
match node.owner_doc.with_base(|doc| doc.window) {
|
||||
Some(win) => {
|
||||
let page = win.page;
|
||||
let (port, chan) = stream();
|
||||
match page.query_layout(ContentBoxQuery(abstract_self, chan), port) {
|
||||
ContentBoxResponse(rect) => {
|
||||
to_px(rect.size.height) as u32
|
||||
}
|
||||
}
|
||||
}
|
||||
None => {
|
||||
debug!("no window");
|
||||
0
|
||||
let page = node.owner_doc.with_base(|doc| doc.window).page;
|
||||
let (port, chan) = stream();
|
||||
match page.query_layout(ContentBoxQuery(abstract_self, chan), port) {
|
||||
ContentBoxResponse(rect) => {
|
||||
to_px(rect.size.height) as u32
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue