Auto merge of #16707 - CJKu:bug-1359787, r=manish

Stylo: Implement {specified|computed}::LayerImage.

<!-- Please describe your changes on the following line: -->
Bug 1359787 - Stylo: Unite the implementation of background-image/ mask-image and border-image-source in {background|svg|border}.mako.rs

---
<!-- 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
- [ ] 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/16707)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-05-03 21:49:33 -05:00 committed by GitHub
commit 896a920ff5
10 changed files with 100 additions and 267 deletions

View file

@ -921,13 +921,13 @@ fn static_assert() {
need_clone=True) %>
% endfor
pub fn set_border_image_source(&mut self, v: longhands::border_image_source::computed_value::T) {
pub fn set_border_image_source(&mut self, image: longhands::border_image_source::computed_value::T) {
unsafe {
// Prevent leaking of the last elements we did set
Gecko_SetNullImageValue(&mut self.gecko.mBorderImageSource);
}
if let Some(image) = v.0 {
if let Some(image) = image.0 {
self.gecko.mBorderImageSource.set(image, &mut false)
}
}
@ -2791,18 +2791,9 @@ fn static_assert() {
for (image, geckoimage) in images.0.into_iter().zip(self.gecko.${image_layers_field}
.mLayers.iter_mut()) {
% if shorthand == "background":
if let Some(image) = image.0 {
geckoimage.mImage.set(image, cacheable)
}
% else:
use properties::longhands::mask_image::single_value::computed_value::T;
match image {
T::Image(image) => geckoimage.mImage.set(image, cacheable),
_ => ()
}
% endif
if let Some(image) = image.0 {
geckoimage.mImage.set(image, cacheable)
}
}
}