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

WIP #17808

Closed
wants to merge 5 commits into from
Closed

WIP #17808

Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Parse Sizes attribute

  • Loading branch information
Rakhisharma committed Sep 25, 2017
commit 05185e2b65a3f1ccf1d245bbd67295fd5baebfc9
@@ -798,8 +798,7 @@ impl LayoutHTMLImageElementHelpers for LayoutJS<HTMLImageElement> {
//https://html.spec.whatwg.org/multipage/#parse-a-sizes-attribute
pub fn parse_a_sizes_attribute(input: DOMString, width: Option<u32>) -> Vec<Size> {

This comment has been minimized.

Copy link
@jdm

jdm Aug 31, 2017

Member

Add a comment like // https://html.spec.whatwg.org/multipage/#parse-a-sizes-attribute so it's clear which algorithm this is based on.

let mut sizes = Vec::<Size>::new();
let unparsed_sizes = input.split(',').collect::<Vec<_>>();
for unparsed_size in &unparsed_sizes {
for unparsed_size in input.split(',') {
let whitespace = unparsed_size.chars().rev().take_while(|c| char::is_whitespace(*c)).count();
let trimmed: String = unparsed_size.chars().take(unparsed_size.chars().count() - whitespace).collect();

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