Auto merge of #16345 - CJKu:cku-master, r=heycam

stylo: Correct computed value of mask-image.

<!-- Please describe your changes on the following line: -->
The patch is part of fix in Bug 1341667(stylo: Figure out why all the W3C masking reftests fail)

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16345)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-11 22:07:36 -05:00 committed by GitHub
commit 7262270990
2 changed files with 3 additions and 15 deletions

View file

@ -2374,8 +2374,8 @@ fn static_assert() {
% else: % else:
use properties::longhands::mask_image::single_value::computed_value::T; use properties::longhands::mask_image::single_value::computed_value::T;
match image { match image {
T::Image(image) => geckoimage.mImage.set(image, false, cacheable), T::Image(image) => geckoimage.mImage.set(image, true, cacheable),
_ => () // we need to support url valeus _ => ()
} }
% endif % endif

View file

@ -218,7 +218,6 @@ ${helpers.single_keyword("mask-composite",
#[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum T { pub enum T {
Image(computed::Image), Image(computed::Image),
Url(SpecifiedUrl),
None None
} }
@ -227,7 +226,6 @@ ${helpers.single_keyword("mask-composite",
match *self { match *self {
T::None => dest.write_str("none"), T::None => dest.write_str("none"),
T::Image(ref image) => image.to_css(dest), T::Image(ref image) => image.to_css(dest),
T::Url(ref url) => url.to_css(dest),
} }
} }
} }
@ -239,7 +237,6 @@ ${helpers.single_keyword("mask-composite",
#[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum SpecifiedValue { pub enum SpecifiedValue {
Image(Image), Image(Image),
Url(SpecifiedUrl),
None None
} }
@ -247,7 +244,6 @@ ${helpers.single_keyword("mask-composite",
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
match *self { match *self {
SpecifiedValue::Image(ref image) => image.to_css(dest), SpecifiedValue::Image(ref image) => image.to_css(dest),
SpecifiedValue::Url(ref url) => url.to_css(dest),
SpecifiedValue::None => dest.write_str("none"), SpecifiedValue::None => dest.write_str("none"),
} }
} }
@ -268,12 +264,8 @@ ${helpers.single_keyword("mask-composite",
let image = try!(Image::parse(context, input)); let image = try!(Image::parse(context, input));
match image { match image {
Image::Url(url_value) => { Image::Url(url_value) => {
if url_value.is_fragment() {
Ok(SpecifiedValue::Url(url_value))
} else {
Ok(SpecifiedValue::Image(Image::Url(url_value))) Ok(SpecifiedValue::Image(Image::Url(url_value)))
} }
}
image => Ok(SpecifiedValue::Image(image)) image => Ok(SpecifiedValue::Image(image))
} }
} }
@ -287,8 +279,6 @@ ${helpers.single_keyword("mask-composite",
SpecifiedValue::None => computed_value::T::None, SpecifiedValue::None => computed_value::T::None,
SpecifiedValue::Image(ref image) => SpecifiedValue::Image(ref image) =>
computed_value::T::Image(image.to_computed_value(context)), computed_value::T::Image(image.to_computed_value(context)),
SpecifiedValue::Url(ref url) =>
computed_value::T::Url(url.clone()),
} }
} }
@ -298,8 +288,6 @@ ${helpers.single_keyword("mask-composite",
computed_value::T::None => SpecifiedValue::None, computed_value::T::None => SpecifiedValue::None,
computed_value::T::Image(ref image) => computed_value::T::Image(ref image) =>
SpecifiedValue::Image(ToComputedValue::from_computed_value(image)), SpecifiedValue::Image(ToComputedValue::from_computed_value(image)),
computed_value::T::Url(ref url) =>
SpecifiedValue::Url(url.clone()),
} }
} }
} }