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

Till descriptor

  • Loading branch information
akhan7 committed May 3, 2016
commit 13a665d103fce0d78ad88433a73f96fe9669c8aa
@@ -34,6 +34,7 @@ use string_cache::Atom;
use url::Url;
use util::str::{DOMString, LengthOrPercentageOrAuto};
use style::values::specified::Length;
use std::collections::LinkedList;

#[derive(JSTraceable, HeapSizeOf)]
#[allow(dead_code)]
@@ -422,19 +423,24 @@ fn collect_sequence_characters<'a, P>(s: &'a str, predicate: P)
return (s, "");
}

impl ImageSource{
fn parse_a_srcset_attribute(input: String) -> Vec<ImageSource> {
fn parse_a_srcset_attribute(input: String) -> Vec<ImageSource> {
let position = &input;
let candidate: Vec<ImageSource> = Vec::new();
//let position1 = &s;
let(spaces, position) = collect_sequence_characters(position, |c| c ==',' || c == ' ');
println!("{} {}", spaces, position);
let x = spaces.find(',');
match x {
Some(val) => println!("{}", val), // can do assert here
None => println!("Parse error"),
Some(val) => println!("Parse Error"),
None => println!("No commas"),
}
candidate
if position == "" {
//Does something need to be asserted here? The algorithm says abort the steps is this condition exists
return candidate;
}
let (url, spaces) = collect_sequence_characters(position, |c| c != ' ');
let mut descriptor = LinkedList::<String>::new();
return candidate;

}
}
}


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