Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse srcset algo #10829

Closed
wants to merge 10 commits into from

further moved

  • Loading branch information
akhan7 committed May 4, 2016
commit 30acbd0214830b7ea9bf1bffdb893061f90f83da
@@ -457,9 +457,43 @@ fn parse_a_srcset_attribute(input: String) -> Vec<ImageSource> {
// Descriptor Tokeniser: whitespace
let (space, position) = collect_sequence_characters(position, |c| util::str::char_is_whitespace(c));

let current_descriptor = String::new();
let mut current_descriptor = String::new();
let mut state = ParseState::InDescriptor;


for (i,c) in position.chars().enumerate() {
match c {
' ' => {
if current_descriptor != "" {
descriptor.push_back(current_descriptor.clone());
state = ParseState::AfterDescriptor;
}
},
',' => { position.chars().enumerate();
if current_descriptor != "" {
descriptor.push_back(current_descriptor.clone());
state = ParseState::AfterDescriptor;
}
}
'(' => {
current_descriptor.push(c);
state = ParseState::InParens;
}
//Matching EOF
/*'' => { if current_descriptor != "" {
descriptor.push_back(current_descriptor.clone());
state = ParseState::AfterDescriptor;
}
}
*/
_ => {
current_descriptor.push(c);
}


}
}


return candidate;

}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.