From 53279596db7e3bf2fbfd457780cebc6435c646c1 Mon Sep 17 00:00:00 2001 From: cku Date: Thu, 27 Apr 2017 00:06:09 +0800 Subject: [PATCH 1/2] Stylo: Make sure that the URL stylo parse for border-image-source is propagated to Gecko computed style. --- components/style/properties/gecko.mako.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index fc40dcff52d..69b6cbf1672 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -944,9 +944,7 @@ fn static_assert() { } if let Some(image) = v.0 { - // TODO: We need to make border-image-source match with background-image - // until then we are setting with_url to false - self.gecko.mBorderImageSource.set(image, false, &mut false) + self.gecko.mBorderImageSource.set(image, true, &mut false) } } From 2f9127628029c3474c32913d6f270ac0b96060d2 Mon Sep 17 00:00:00 2001 From: cku Date: Thu, 27 Apr 2017 00:06:43 +0800 Subject: [PATCH 2/2] Stylo: Remove the second parameter(with_url) of nsStyleImage::set. --- components/style/gecko/conversions.rs | 9 ++++----- components/style/properties/gecko.mako.rs | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/components/style/gecko/conversions.rs b/components/style/gecko/conversions.rs index 42c146f7125..631e5abb1eb 100644 --- a/components/style/gecko/conversions.rs +++ b/components/style/gecko/conversions.rs @@ -101,12 +101,12 @@ impl From for LengthOrPercentage { 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 @@ -119,7 +119,7 @@ impl nsStyleImage { *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); @@ -145,8 +145,7 @@ impl nsStyleImage { unsafe { Gecko_SetImageElement(self, element.as_ptr()); } - }, - _ => (), + } } } diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 69b6cbf1672..9005fe691a4 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -944,7 +944,7 @@ fn static_assert() { } if let Some(image) = v.0 { - self.gecko.mBorderImageSource.set(image, true, &mut false) + self.gecko.mBorderImageSource.set(image, &mut false) } } @@ -2764,12 +2764,12 @@ fn static_assert() { .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