aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2013-11-20 15:04:09 +0000
committerSangeun Kim <sammy.kim@samsung.com>2014-01-03 13:16:42 +0900
commitdaebaf1eea050b19fb8872dfe28d36d75cce4764 (patch)
tree5bd858885104e6910526ac70a17dcc86e3bbc8da /src
parent2b487ed3e984c0ec48ee8240ace78ec80ff94853 (diff)
downloadservo-daebaf1eea050b19fb8872dfe28d36d75cce4764.tar.gz
servo-daebaf1eea050b19fb8872dfe28d36d75cce4764.zip
Fix parsing of the 'content' property.
Conflicts: src/components/style/properties.rs.mako
Diffstat (limited to 'src')
-rw-r--r--src/components/style/properties.rs.mako39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/components/style/properties.rs.mako b/src/components/style/properties.rs.mako
index 95c33427fa7..e2f7deceafc 100644
--- a/src/components/style/properties.rs.mako
+++ b/src/components/style/properties.rs.mako
@@ -394,6 +394,45 @@ pub mod longhands {
// CSS 2.1, Section 12 - Generated content, automatic numbering, and lists
+ <%self:longhand name="content" inherited="False">
+ pub use to_computed_value = super::computed_as_specified;
+ pub mod computed_value {
+ #[deriving(Eq, Clone)]
+ pub enum Content {
+ StringContent(~str),
+ }
+ #[deriving(Eq, Clone)]
+ pub enum T {
+ normal,
+ none,
+ Content(~[Content]),
+ }
+ }
+ pub type SpecifiedValue = computed_value::T;
+ #[inline] pub fn get_initial_value() -> computed_value::T { normal }
+
+ // normal | none | [ <string> ]+
+ // TODO: <uri>, <counter>, attr(<identifier>), open-quote, close-quote, no-open-quote, no-close-quote
+ pub fn parse(input: &[ComponentValue]) -> Option<SpecifiedValue> {
+ match one_component_value(input) {
+ Some(&Ident(ref keyword)) => match keyword.to_ascii_lower().as_slice() {
+ "normal" => return Some(normal),
+ "none" => return Some(none),
+ _ => ()
+ },
+ _ => ()
+ }
+ let mut content = ~[];
+ for component_value in input.skip_whitespace() {
+ match component_value {
+ &String(ref value)
+ => content.push(StringContent(value.to_owned())),
+ _ => return None // invalid/unsupported value
+ }
+ }
+ Some(Content(content))
+ }
+ </%self:longhand>
// CSS 2.1, Section 13 - Paged media
// CSS 2.1, Section 14 - Colors and Backgrounds