aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/html/hubbub_html_parser.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-03-13 10:35:29 -0700
committerPatrick Walton <pcwalton@mimiga.net>2014-03-13 18:08:50 -0700
commit3f8882450c0392a8463568090c541facd6f474b7 (patch)
treeb36928fb54d253558e307b78085166ba732878bb /src/components/script/html/hubbub_html_parser.rs
parent3933d17262de06458e1d79217d5a7810c4154611 (diff)
downloadservo-3f8882450c0392a8463568090c541facd6f474b7.tar.gz
servo-3f8882450c0392a8463568090c541facd6f474b7.zip
script: Fix background color of Acid2.
There were two problems here: (1) we did not process style sheets with an unexpected `rel` attribute but a correct MIME type; (2) we did not consider `none` a valid value for the `background` property.
Diffstat (limited to 'src/components/script/html/hubbub_html_parser.rs')
-rw-r--r--src/components/script/html/hubbub_html_parser.rs19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs
index 5e555b63f39..e96c3eaf893 100644
--- a/src/components/script/html/hubbub_html_parser.rs
+++ b/src/components/script/html/hubbub_html_parser.rs
@@ -22,9 +22,10 @@ use hubbub::hubbub;
use servo_msg::constellation_msg::SubpageId;
use servo_net::resource_task::{Load, Payload, Done, ResourceTask, load_whole_resource};
use servo_util::namespace::Null;
-use servo_util::str::DOMString;
+use servo_util::str::{DOMString, HTML_SPACE_CHARACTERS};
use servo_util::task::spawn_named;
use servo_util::url::parse_url;
+use std::ascii::StrAsciiExt;
use std::cast;
use std::cell::RefCell;
use std::comm::{Port, SharedChan};
@@ -337,12 +338,16 @@ pub fn parse_html(page: &Page,
ElementNodeTypeId(HTMLLinkElementTypeId) => {
match (element.get().get_attribute(Null, "rel"),
element.get().get_attribute(Null, "href")) {
- (Some(rel), Some(href)) => {
- if "stylesheet" == rel.get().value_ref() {
- debug!("found CSS stylesheet: {:s}", href.get().value_ref());
- let url = parse_url(href.get().value_ref(), Some(url2.clone()));
- css_chan2.send(CSSTaskNewFile(UrlProvenance(url)));
- }
+ (Some(ref rel), Some(ref href)) if rel.get()
+ .value_ref()
+ .split(HTML_SPACE_CHARACTERS.
+ as_slice())
+ .any(|s| {
+ s.eq_ignore_ascii_case("stylesheet")
+ }) => {
+ debug!("found CSS stylesheet: {:s}", href.get().value_ref());
+ let url = parse_url(href.get().value_ref(), Some(url2.clone()));
+ css_chan2.send(CSSTaskNewFile(UrlProvenance(url)));
}
_ => {}
}