mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 11:26:09 +00:00
Bug 1461858 part 3 - Have from_image_request reuse ImageValue from image request directly. r=emilio
And also remove ComputedImageUrl::from_url_value_data. MozReview-Commit-ID: 5zifQlU7tOz --HG-- extra : rebase_source : 23631ad2e9144cf30951a3d07421a8e5ae0ba8ec
This commit is contained in:
parent
9886a02dbd
commit
07df897bae
@ -1668,11 +1668,11 @@ Gecko_CreateGradient(uint8_t aShape,
|
||||
return result;
|
||||
}
|
||||
|
||||
const mozilla::css::URLValueData*
|
||||
Gecko_GetURLValue(const nsStyleImage* aImage)
|
||||
const nsStyleImageRequest*
|
||||
Gecko_GetImageRequest(const nsStyleImage* aImage)
|
||||
{
|
||||
MOZ_ASSERT(aImage && aImage->GetType() == eStyleImageType_Image);
|
||||
return aImage->GetURLValue();
|
||||
MOZ_ASSERT(aImage);
|
||||
return aImage->GetImageRequest();
|
||||
}
|
||||
|
||||
nsAtom*
|
||||
|
@ -371,7 +371,7 @@ nsStyleGradient* Gecko_CreateGradient(uint8_t shape,
|
||||
bool moz_legacy_syntax,
|
||||
uint32_t stops);
|
||||
|
||||
const mozilla::css::URLValueData* Gecko_GetURLValue(const nsStyleImage* image);
|
||||
const nsStyleImageRequest* Gecko_GetImageRequest(const nsStyleImage* image);
|
||||
nsAtom* Gecko_GetImageElement(const nsStyleImage* image);
|
||||
const nsStyleGradient* Gecko_GetGradientImageValue(const nsStyleImage* image);
|
||||
|
||||
|
@ -426,9 +426,10 @@ impl nsStyleImage {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn get_image_url(self: &nsStyleImage) -> ComputedImageUrl {
|
||||
let url_value = bindings::Gecko_GetURLValue(self);
|
||||
ComputedImageUrl::from_url_value_data(url_value.as_ref().unwrap())
|
||||
unsafe fn get_image_url(&self) -> ComputedImageUrl {
|
||||
let image_request = bindings::Gecko_GetImageRequest(self)
|
||||
.as_ref().expect("Null image request?");
|
||||
ComputedImageUrl::from_image_request(image_request)
|
||||
}
|
||||
|
||||
unsafe fn get_gradient(self: &nsStyleImage) -> Box<Gradient> {
|
||||
|
@ -309,18 +309,10 @@ impl ToCss for ComputedImageUrl {
|
||||
}
|
||||
|
||||
impl ComputedImageUrl {
|
||||
/// Convert from URLValueData to SpecifiedUrl.
|
||||
pub unsafe fn from_url_value_data(url: &URLValueData) -> Self {
|
||||
ComputedImageUrl(
|
||||
SpecifiedImageUrl::from_css_url(CssUrl::from_url_value_data(url))
|
||||
)
|
||||
}
|
||||
|
||||
/// Convert from nsStyleImageReques to ComputedImageUrl.
|
||||
pub unsafe fn from_image_request(image_request: &nsStyleImageRequest) -> Self {
|
||||
let image_value = image_request.mImageValue.mRawPtr
|
||||
.as_ref().expect("mImageValue is null");
|
||||
let url_value_data = &image_value._base;
|
||||
Self::from_url_value_data(url_value_data)
|
||||
let image_value = image_request.mImageValue.to_safe();
|
||||
let url = CssUrl::from_url_value_data(&image_value._base);
|
||||
ComputedImageUrl(SpecifiedImageUrl { url, image_value })
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user