aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorNazım Can Altınova <canaltinova@gmail.com>2016-04-17 00:48:29 +0300
committerNazım Can Altınova <canaltinova@gmail.com>2016-04-18 19:54:37 +0300
commitffd7960ad8abc8692425d8c27313dcc8889e58f9 (patch)
tree366e8062691cf51bcf5c6b493a9d794d4b83de27 /components/script
parent86778a0d714e4e9d2696d54ec422aede47ba3cb9 (diff)
downloadservo-ffd7960ad8abc8692425d8c27313dcc8889e58f9.tar.gz
servo-ffd7960ad8abc8692425d8c27313dcc8889e58f9.zip
Use the document base url when resolving stylesheets
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/htmllinkelement.rs21
1 files changed, 9 insertions, 12 deletions
diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs
index e7af4f537be..1b058b4c671 100644
--- a/components/script/dom/htmllinkelement.rs
+++ b/components/script/dom/htmllinkelement.rs
@@ -190,9 +190,8 @@ impl VirtualMethods for HTMLLinkElement {
impl HTMLLinkElement {
fn handle_stylesheet_url(&self, href: &str) {
- let window = window_from_node(self);
- let window = window.r();
- match window.get_url().join(href) {
+ let document = document_from_node(self);
+ match document.base_url().join(href) {
Ok(url) => {
let element = self.upcast::<Element>();
@@ -206,8 +205,7 @@ impl HTMLLinkElement {
let media = parse_media_query_list(&mut css_parser);
// TODO: #8085 - Don't load external stylesheets if the node's mq doesn't match.
- let doc = window.Document();
- let script_chan = window.networking_task_source();
+ let script_chan = document.window().networking_task_source();
let elem = Trusted::new(self, script_chan.clone());
let context = Arc::new(Mutex::new(StylesheetContext {
@@ -231,20 +229,19 @@ impl HTMLLinkElement {
});
if self.parser_inserted.get() {
- doc.increment_script_blocking_stylesheet_count();
+ document.increment_script_blocking_stylesheet_count();
}
- doc.load_async(LoadType::Stylesheet(url), response_target);
+ document.load_async(LoadType::Stylesheet(url), response_target);
}
Err(e) => debug!("Parsing url {} failed: {}", href, e)
}
}
fn handle_favicon_url(&self, rel: &str, href: &str, sizes: &Option<String>) {
- let window = window_from_node(self);
- let window = window.r();
- match window.get_url().join(href) {
+ let document = document_from_node(self);
+ match document.base_url().join(href) {
Ok(url) => {
- let ConstellationChan(ref chan) = window.constellation_chan();
+ let ConstellationChan(ref chan) = document.window().constellation_chan();
let event = ConstellationMsg::NewFavicon(url.clone());
chan.send(event).unwrap();
@@ -252,7 +249,7 @@ impl HTMLLinkElement {
Some(ref sizes) => MozBrowserEvent::IconChange(rel.to_owned(), url.to_string(), sizes.to_owned()),
None => MozBrowserEvent::IconChange(rel.to_owned(), url.to_string(), "".to_owned())
};
- window.Document().trigger_mozbrowser_event(mozbrowser_event);
+ document.trigger_mozbrowser_event(mozbrowser_event);
}
Err(e) => debug!("Parsing url {} failed: {}", href, e)
}