Don't re-parse dummy base URL every time in GeckoElement::style_attribute.

This commit is contained in:
Cameron McCormack 2016-05-26 15:50:34 +10:00
parent 92ae502765
commit 94ce09763e

View file

@ -314,6 +314,12 @@ impl<'le> GeckoElement<'le> {
}
}
lazy_static! {
pub static ref DUMMY_BASE_URL: Url = {
Url::parse("http://www.example.org").unwrap()
};
}
impl<'le> TElement for GeckoElement<'le> {
type ConcreteNode = GeckoNode<'le>;
type ConcreteDocument = GeckoDocument<'le>;
@ -330,7 +336,7 @@ impl<'le> TElement for GeckoElement<'le> {
// in the nsAttrValue. That will allow us to borrow it from here.
let attr = self.get_attr(&ns!(), &atom!("style"));
// FIXME(bholley): Real base URL and error reporter.
let base_url = Url::parse("http://www.example.org").unwrap();
let base_url = &*DUMMY_BASE_URL;
// FIXME(heycam): Needs real ParserContextExtraData so that URLs parse
// properly.
let extra_data = ParserContextExtraData::default();