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

Fix parsing behavior of text-shadow property #16754

Merged
merged 2 commits into from May 6, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Clean up text-shadow property

  • Loading branch information
canova committed May 6, 2017
commit c072f3ab18ab7fd13cd8da23ce8e1eba05ba103b
@@ -726,7 +726,7 @@ ${helpers.single_keyword("text-align-last",
impl HasViewportPercentage for SpecifiedValue {
fn has_viewport_percentage(&self) -> bool {
let &SpecifiedValue(ref vec) = self;
vec.iter().any(|ref x| x .has_viewport_percentage())
vec.iter().any(|ref x| x.has_viewport_percentage())
}
}

@@ -784,61 +784,56 @@ ${helpers.single_keyword("text-align-last",
impl ToCss for computed_value::T {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
let mut iter = self.0.iter();
if let Some(shadow) = iter.next() {
try!(shadow.to_css(dest));
} else {
try!(dest.write_str("none"));
return Ok(())
match iter.next() {
Some(shadow) => shadow.to_css(dest)?,
None => return dest.write_str("none"),
}
for shadow in iter {
try!(dest.write_str(", "));
try!(shadow.to_css(dest));
dest.write_str(", ")?;
shadow.to_css(dest)?;
}
Ok(())
}
}

impl ToCss for computed_value::TextShadow {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
try!(self.offset_x.to_css(dest));
try!(dest.write_str(" "));
try!(self.offset_y.to_css(dest));
try!(dest.write_str(" "));
try!(self.blur_radius.to_css(dest));
try!(dest.write_str(" "));
try!(self.color.to_css(dest));
Ok(())
self.offset_x.to_css(dest)?;
dest.write_str(" ")?;
self.offset_y.to_css(dest)?;
dest.write_str(" ")?;
self.blur_radius.to_css(dest)?;
dest.write_str(" ")?;
self.color.to_css(dest)
}
}

impl ToCss for SpecifiedValue {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
let mut iter = self.0.iter();
if let Some(shadow) = iter.next() {
try!(shadow.to_css(dest));
} else {
try!(dest.write_str("none"));
return Ok(())
match iter.next() {
Some(shadow) => shadow.to_css(dest)?,
None => return dest.write_str("none"),
}
for shadow in iter {
try!(dest.write_str(", "));
try!(shadow.to_css(dest));
dest.write_str(", ")?;
shadow.to_css(dest)?;
}
Ok(())
}
}

impl ToCss for SpecifiedTextShadow {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
try!(self.offset_x.to_css(dest));
try!(dest.write_str(" "));
try!(self.offset_y.to_css(dest));
try!(dest.write_str(" "));
try!(self.blur_radius.to_css(dest));
self.offset_x.to_css(dest)?;
dest.write_str(" ")?;
self.offset_y.to_css(dest)?;
dest.write_str(" ")?;
self.blur_radius.to_css(dest)?;

if let Some(ref color) = self.color {
try!(dest.write_str(" "));
try!(color.to_css(dest));
dest.write_str(" ")?;
color.to_css(dest)?;
}
Ok(())
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.