diff options
author | bors-servo <release+servo@mozilla.com> | 2014-03-14 10:16:57 -0400 |
---|---|---|
committer | bors-servo <release+servo@mozilla.com> | 2014-03-14 10:16:57 -0400 |
commit | 58f3946e4b73b88bf96312baad38f77d1156e82e (patch) | |
tree | 66c6499de1c3ec8404137e304973b0e1f528dd60 /src | |
parent | 71f4fd0478183692ba114351841b44c58691e665 (diff) | |
parent | 3f8882450c0392a8463568090c541facd6f474b7 (diff) | |
download | servo-58f3946e4b73b88bf96312baad38f77d1156e82e.tar.gz servo-58f3946e4b73b88bf96312baad38f77d1156e82e.zip |
auto merge of #1905 : pcwalton/servo/acid2-fixes, r=SimonSapin
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.
r? @SimonSapin
Diffstat (limited to 'src')
-rw-r--r-- | src/components/script/html/hubbub_html_parser.rs | 19 | ||||
-rw-r--r-- | src/components/style/properties.rs.mako | 1 | ||||
-rw-r--r-- | src/components/util/str.rs | 13 | ||||
-rw-r--r-- | src/test/ref/background_none_a.html | 21 | ||||
-rw-r--r-- | src/test/ref/background_none_b.html | 16 | ||||
-rw-r--r-- | src/test/ref/basic.list | 1 |
6 files changed, 64 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))); } _ => {} } diff --git a/src/components/style/properties.rs.mako b/src/components/style/properties.rs.mako index a9e4c0b03fd..16a6628c05d 100644 --- a/src/components/style/properties.rs.mako +++ b/src/components/style/properties.rs.mako @@ -499,6 +499,7 @@ pub mod longhands { let image_url = parse_url(url.as_slice(), Some(base_url.clone())); Some(Some(image_url)) }, + &ast::Ident(ref value) if "none" == value.to_ascii_lower() => Some(None), _ => None, } } diff --git a/src/components/util/str.rs b/src/components/util/str.rs index 6010ef69636..bd89ad9ea6f 100644 --- a/src/components/util/str.rs +++ b/src/components/util/str.rs @@ -25,3 +25,16 @@ pub fn is_whitespace(s: &str) -> bool { _ => false }) } + +/// A "space character" according to: +/// +/// http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html# +/// space-character +pub static HTML_SPACE_CHARACTERS: [char, ..5] = [ + '\u0020', + '\u0009', + '\u000a', + '\u000c', + '\u000d', +]; + diff --git a/src/test/ref/background_none_a.html b/src/test/ref/background_none_a.html new file mode 100644 index 00000000000..e74c01404c2 --- /dev/null +++ b/src/test/ref/background_none_a.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<html> +<head> +<title>background: none test</title> +<style> +#a { + background: red; + width: 32px; + height: 32px; +} + +#a { + background: none; +} +</style> +</head> +<body> +<div id=a></div> +</body> +</html> + diff --git a/src/test/ref/background_none_b.html b/src/test/ref/background_none_b.html new file mode 100644 index 00000000000..f6bc5208519 --- /dev/null +++ b/src/test/ref/background_none_b.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html> +<head> +<title>background: none test</title> +<style> +#a { + width: 32px; + height: 32px; +} +</style> +</head> +<body> +<div id=a></div> +</body> +</html> + diff --git a/src/test/ref/basic.list b/src/test/ref/basic.list index c47a03dd3fb..8108ab7a9c9 100644 --- a/src/test/ref/basic.list +++ b/src/test/ref/basic.list @@ -53,3 +53,4 @@ == position_fixed_static_y_a.html position_fixed_static_y_b.html == position_relative_a.html position_relative_b.html == position_relative_top_percentage_a.html position_relative_top_percentage_b.html +== background_none_a.html background_none_b.html |