mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Only allow color value at the last element.
This commit is contained in:
parent
766feec4c0
commit
7d48c9fa90
1 changed files with 8 additions and 5 deletions
|
@ -39,17 +39,20 @@
|
|||
let mut background_${name} = background_${name}::SpecifiedValue(Vec::new());
|
||||
% endfor
|
||||
try!(input.parse_comma_separated(|input| {
|
||||
// background-color can only be in the last element, so if it
|
||||
// is parsed anywhere before, the value is invalid.
|
||||
if background_color.is_some() {
|
||||
return Err(());
|
||||
}
|
||||
|
||||
% for name in "image position repeat size attachment origin clip".split():
|
||||
let mut ${name} = None;
|
||||
% endfor
|
||||
loop {
|
||||
if let Ok(value) = input.try(|i| CSSColor::parse(context, i)) {
|
||||
if background_color.is_none() {
|
||||
if background_color.is_none() {
|
||||
if let Ok(value) = input.try(|i| CSSColor::parse(context, i)) {
|
||||
background_color = Some(value);
|
||||
continue
|
||||
} else {
|
||||
// color can only be the last element
|
||||
return Err(())
|
||||
}
|
||||
}
|
||||
if position.is_none() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue