mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
Remove the image loading workaround from the parser.
This commit is contained in:
parent
3b9ff728fe
commit
2639e36c78
3 changed files with 3 additions and 13 deletions
|
@ -66,7 +66,7 @@ impl HTMLImageElement {
|
||||||
impl HTMLImageElement {
|
impl HTMLImageElement {
|
||||||
/// Makes the local `image` member match the status of the `src` attribute and starts
|
/// Makes the local `image` member match the status of the `src` attribute and starts
|
||||||
/// prefetching the image. This method must be called after `src` is changed.
|
/// prefetching the image. This method must be called after `src` is changed.
|
||||||
pub fn update_image(&mut self, image_cache: ImageCacheTask, url: Option<Url>) {
|
fn update_image(&mut self, image_cache: ImageCacheTask, url: Option<Url>) {
|
||||||
let elem = &mut self.htmlelement.element;
|
let elem = &mut self.htmlelement.element;
|
||||||
let src_opt = elem.get_attribute(Null, "src").map(|x| x.get().Value());
|
let src_opt = elem.get_attribute(Null, "src").map(|x| x.get().Value());
|
||||||
match src_opt {
|
match src_opt {
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use dom::bindings::codegen::InheritTypes::{NodeBase, NodeCast, TextCast, ElementCast};
|
use dom::bindings::codegen::InheritTypes::{NodeBase, NodeCast, TextCast, ElementCast};
|
||||||
use dom::bindings::codegen::InheritTypes::{HTMLIFrameElementCast, HTMLImageElementCast};
|
use dom::bindings::codegen::InheritTypes::HTMLIFrameElementCast;
|
||||||
use dom::bindings::js::JS;
|
use dom::bindings::js::JS;
|
||||||
use dom::bindings::utils::Reflectable;
|
use dom::bindings::utils::Reflectable;
|
||||||
use dom::document::Document;
|
use dom::document::Document;
|
||||||
use dom::element::{HTMLLinkElementTypeId, HTMLIframeElementTypeId, HTMLImageElementTypeId};
|
use dom::element::{HTMLLinkElementTypeId, HTMLIframeElementTypeId};
|
||||||
use dom::htmlelement::HTMLElement;
|
use dom::htmlelement::HTMLElement;
|
||||||
use dom::htmlheadingelement::{Heading1, Heading2, Heading3, Heading4, Heading5, Heading6};
|
use dom::htmlheadingelement::{Heading1, Heading2, Heading3, Heading4, Heading5, Heading6};
|
||||||
use dom::htmliframeelement::IFrameSize;
|
use dom::htmliframeelement::IFrameSize;
|
||||||
|
@ -21,7 +21,6 @@ use extra::url::Url;
|
||||||
use hubbub::hubbub;
|
use hubbub::hubbub;
|
||||||
use js::jsapi::JSContext;
|
use js::jsapi::JSContext;
|
||||||
use servo_msg::constellation_msg::SubpageId;
|
use servo_msg::constellation_msg::SubpageId;
|
||||||
use servo_net::image_cache_task::ImageCacheTask;
|
|
||||||
use servo_net::resource_task::{Load, Payload, Done, ResourceTask, load_whole_resource};
|
use servo_net::resource_task::{Load, Payload, Done, ResourceTask, load_whole_resource};
|
||||||
use servo_util::namespace::Null;
|
use servo_util::namespace::Null;
|
||||||
use servo_util::str::DOMString;
|
use servo_util::str::DOMString;
|
||||||
|
@ -251,7 +250,6 @@ pub fn parse_html(cx: *JSContext,
|
||||||
document: &mut JS<Document>,
|
document: &mut JS<Document>,
|
||||||
url: Url,
|
url: Url,
|
||||||
resource_task: ResourceTask,
|
resource_task: ResourceTask,
|
||||||
image_cache_task: ImageCacheTask,
|
|
||||||
next_subpage_id: SubpageId)
|
next_subpage_id: SubpageId)
|
||||||
-> HtmlParserResult {
|
-> HtmlParserResult {
|
||||||
debug!("Hubbub: parsing {:?}", url);
|
debug!("Hubbub: parsing {:?}", url);
|
||||||
|
@ -382,13 +380,6 @@ pub fn parse_html(cx: *JSContext,
|
||||||
sandboxed)));
|
sandboxed)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME: This should be taken care of by set_attr, but we don't have
|
|
||||||
// access to a window so HTMLImageElement::AfterSetAttr bails.
|
|
||||||
ElementNodeTypeId(HTMLImageElementTypeId) => {
|
|
||||||
let mut image_element: JS<HTMLImageElement> = HTMLImageElementCast::to(&element);
|
|
||||||
image_element.get_mut().update_image(image_cache_task.clone(), Some(url2.clone()));
|
|
||||||
}
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -722,7 +722,6 @@ impl ScriptTask {
|
||||||
&mut document,
|
&mut document,
|
||||||
url.clone(),
|
url.clone(),
|
||||||
self.resource_task.clone(),
|
self.resource_task.clone(),
|
||||||
self.image_cache_task.clone(),
|
|
||||||
page.next_subpage_id.clone());
|
page.next_subpage_id.clone());
|
||||||
|
|
||||||
let HtmlParserResult {
|
let HtmlParserResult {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue