Bug 1341703 - Part 2. Remove the second parameter(with_url) of nsStyleImage::set. draft
authorcku <cku@mozilla.com>
Wed, 19 Apr 2017 23:14:02 +0800
changeset 565190 2acc71c009c277b476ec454ae66affa39b3cf724
parent 565189 4b83500a4afafa1739686f03db580c3d3b3162e6
child 565191 1003c77f8987f39f6c5f6fce7ab0ed250e816d36
push id54804
push userbmo:cku@mozilla.com
push dateWed, 19 Apr 2017 15:30:23 +0000
bugs1341703
milestone55.0a1
Bug 1341703 - Part 2. Remove the second parameter(with_url) of nsStyleImage::set. In stylo, nsStyleImage is used by background-image, mask-image and border-image-source. The reason to need with_url is to temporary block passing url of border-image-source to gecko, before implementation is ready, by passing with_url as false. Since we are ready to open this path in Part 1. This parameter is no longer needed. MozReview-Commit-ID: 9fqSmG6T3NZ
servo/components/style/gecko/conversions.rs
servo/components/style/properties/gecko.mako.rs
--- a/servo/components/style/gecko/conversions.rs
+++ b/servo/components/style/gecko/conversions.rs
@@ -96,35 +96,35 @@ impl From<nsStyleCoord_CalcValue> for Le
             (true, 0) => LengthOrPercentage::Percentage(other.mPercent),
             _ => LengthOrPercentage::Calc(other.into()),
         }
     }
 }
 
 impl nsStyleImage {
     /// Set a given Servo `Image` value into this `nsStyleImage`.
-    pub fn set(&mut self, image: Image, with_url: bool, cacheable: &mut bool) {
+    pub fn set(&mut self, image: Image, cacheable: &mut bool) {
         match image {
             Image::Gradient(gradient) => {
                 self.set_gradient(gradient)
             },
-            Image::Url(ref url) if with_url => {
+            Image::Url(ref url) => {
                 unsafe {
                     Gecko_SetUrlImageValue(self, url.for_ffi());
                     // We unfortunately must make any url() value uncacheable, since
                     // the applicable declarations cache is not per document, but
                     // global, and the imgRequestProxy objects we store in the style
                     // structs don't like to be tracked by more than one document.
                     //
                     // FIXME(emilio): With the scoped TLS thing this is no longer
                     // true, remove this line in a follow-up!
                     *cacheable = false;
                 }
             },
-            Image::ImageRect(ref image_rect) if with_url => {
+            Image::ImageRect(ref image_rect) => {
                 unsafe {
                     Gecko_SetUrlImageValue(self, image_rect.url.for_ffi());
                     Gecko_InitializeImageCropRect(self);
 
                     // We unfortunately must make any url() value uncacheable, since
                     // the applicable declarations cache is not per document, but
                     // global, and the imgRequestProxy objects we store in the style
                     // structs don't like to be tracked by more than one document.
@@ -140,18 +140,17 @@ impl nsStyleImage {
                     image_rect.bottom.to_gecko_style_coord(&mut rect.data_at_mut(2));
                     image_rect.left.to_gecko_style_coord(&mut rect.data_at_mut(3));
                 }
             }
             Image::Element(ref element) => {
                 unsafe {
                     Gecko_SetImageElement(self, element.as_ptr());
                 }
-            },
-            _ => (),
+            }
         }
     }
 
     fn set_gradient(&mut self, gradient: Gradient) {
         use cssparser::Color as CSSColor;
         use gecko_bindings::structs::{NS_STYLE_GRADIENT_SHAPE_CIRCULAR, NS_STYLE_GRADIENT_SHAPE_ELLIPTICAL};
         use gecko_bindings::structs::{NS_STYLE_GRADIENT_SHAPE_LINEAR, NS_STYLE_GRADIENT_SIZE_CLOSEST_CORNER};
         use gecko_bindings::structs::{NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE, NS_STYLE_GRADIENT_SIZE_EXPLICIT_SIZE};
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -908,17 +908,17 @@ fn static_assert() {
 
     pub fn set_border_image_source(&mut self, v: 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 {
-            self.gecko.mBorderImageSource.set(image, true, &mut false)
+            self.gecko.mBorderImageSource.set(image, &mut false)
         }
     }
 
     pub fn copy_border_image_source_from(&mut self, other: &Self) {
         unsafe {
             Gecko_CopyImageValueFrom(&mut self.gecko.mBorderImageSource,
                                      &other.gecko.mBorderImageSource);
         }
@@ -2509,22 +2509,22 @@ fn static_assert() {
         }
 
         self.gecko.${image_layers_field}.mImageCount = images.0.len() as u32;
 
         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, true, cacheable)
+                    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, true, cacheable),
+                    T::Image(image) => geckoimage.mImage.set(image, cacheable),
                     _ => ()
                 }
             % endif
 
         }
     }
 
     <%