aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/style/gecko/conversions.rs5
-rw-r--r--components/style/gecko/url.rs9
-rw-r--r--components/style/properties/gecko.mako.rs30
3 files changed, 19 insertions, 25 deletions
diff --git a/components/style/gecko/conversions.rs b/components/style/gecko/conversions.rs
index bb0ea1e5013..314ded9cb1c 100644
--- a/components/style/gecko/conversions.rs
+++ b/components/style/gecko/conversions.rs
@@ -634,6 +634,7 @@ pub mod basic_shape {
use gecko_bindings::structs::{StyleGeometryBox, StyleShapeSource, StyleShapeSourceType};
use gecko_bindings::structs::{nsStyleCoord, nsStyleCorners};
use gecko_bindings::sugar::ns_style_coord::{CoordDataMut, CoordDataValue};
+ use gecko_bindings::sugar::refptr::RefPtr;
use std::borrow::Borrow;
use values::computed::basic_shape::{BasicShape, ClippingShape, FloatAreaShape, ShapeRadius};
use values::computed::border::{BorderCornerRadius, BorderRadius};
@@ -678,8 +679,8 @@ pub mod basic_shape {
match other.mType {
StyleShapeSourceType::URL => unsafe {
let shape_image = &*other.mShapeImage.mPtr;
- let other_url = &(**shape_image.__bindgen_anon_1.mURLValue.as_ref());
- let url = ComputedUrl::from_url_value_data(&other_url._base);
+ let other_url = RefPtr::from_ptr_ref(shape_image.__bindgen_anon_1.mURLValue.as_ref());
+ let url = ComputedUrl::from_url_value(other_url.clone());
ShapeSource::ImageOrUrl(url)
},
StyleShapeSourceType::Image => {
diff --git a/components/style/gecko/url.rs b/components/style/gecko/url.rs
index 163c1690523..cb503f4720a 100644
--- a/components/style/gecko/url.rs
+++ b/components/style/gecko/url.rs
@@ -287,11 +287,10 @@ impl ToCss for ComputedUrl {
}
impl ComputedUrl {
- /// Convert from URLValueData to ComputedUrl.
- pub unsafe fn from_url_value_data(url: &URLValueData) -> Self {
- ComputedUrl(
- SpecifiedUrl::from_css_url(CssUrl::from_url_value_data(url))
- )
+ /// Convert from RefPtr<URLValue> to ComputedUrl.
+ pub unsafe fn from_url_value(url_value: RefPtr<URLValue>) -> Self {
+ let url = CssUrl::from_url_value_data(&url_value._base);
+ ComputedUrl(SpecifiedUrl { url, url_value })
}
}
diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs
index 2f091b8d5ab..bb71edaa7c3 100644
--- a/components/style/properties/gecko.mako.rs
+++ b/components/style/properties/gecko.mako.rs
@@ -43,6 +43,7 @@ use gecko_bindings::structs::mozilla::CSSPseudoElementType;
use gecko_bindings::structs::mozilla::CSSPseudoElementType_InheritingAnonBox;
use gecko_bindings::structs::root::NS_STYLE_CONTEXT_TYPE_SHIFT;
use gecko_bindings::sugar::ns_style_coord::{CoordDataValue, CoordData, CoordDataMut};
+use gecko_bindings::sugar::refptr::RefPtr;
use gecko::values::convert_nscolor_to_rgba;
use gecko::values::convert_rgba_to_nscolor;
use gecko::values::GeckoStyleCoordConvertible;
@@ -758,13 +759,10 @@ def set_gecko_property(ffi_name, expr):
nsStyleSVGPaintType::eStyleSVGPaintType_ContextFill => SVGPaintKind::ContextFill,
nsStyleSVGPaintType::eStyleSVGPaintType_ContextStroke => SVGPaintKind::ContextStroke,
nsStyleSVGPaintType::eStyleSVGPaintType_Server => {
- unsafe {
- SVGPaintKind::PaintServer(
- ComputedUrl::from_url_value_data(
- &(**paint.mPaint.mPaintServer.as_ref())._base
- )
- )
- }
+ SVGPaintKind::PaintServer(unsafe {
+ let url = RefPtr::from_ptr_ref(paint.mPaint.mPaintServer.as_ref());
+ ComputedUrl::from_url_value(url.clone())
+ })
}
nsStyleSVGPaintType::eStyleSVGPaintType_Color => {
unsafe { SVGPaintKind::Color(convert_nscolor_to_rgba(*paint.mPaint.mColor.as_ref())) }
@@ -967,12 +965,9 @@ def set_gecko_property(ffi_name, expr):
return UrlOrNone::none()
}
- unsafe {
- let gecko_url_value = &*self.gecko.${gecko_ffi_name}.mRawPtr;
- UrlOrNone::Url(
- ComputedUrl::from_url_value_data(&gecko_url_value._base)
- )
- }
+ UrlOrNone::Url(unsafe {
+ ComputedUrl::from_url_value(self.gecko.${gecko_ffi_name}.to_safe())
+ })
}
</%def>
@@ -4550,11 +4545,10 @@ fn static_assert() {
});
},
NS_STYLE_FILTER_URL => {
- filters.push(unsafe {
- Filter::Url(
- ComputedUrl::from_url_value_data(&(**filter.__bindgen_anon_1.mURL.as_ref())._base)
- )
- });
+ filters.push(Filter::Url(unsafe {
+ let url = RefPtr::from_ptr_ref(filter.__bindgen_anon_1.mURL.as_ref());
+ ComputedUrl::from_url_value(url.clone())
+ }));
}
_ => {},
}