mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
Stylo: Pass LayerImage's image_value to gecko.
This commit is contained in:
parent
2fe55e82d3
commit
f7e3c534e3
2 changed files with 5 additions and 4 deletions
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use gecko::values::{convert_rgba_to_nscolor, GeckoStyleCoordConvertible};
|
use gecko::values::{convert_rgba_to_nscolor, GeckoStyleCoordConvertible};
|
||||||
use gecko_bindings::bindings::{Gecko_CreateGradient, Gecko_SetGradientImageValue, Gecko_SetUrlImageValue};
|
use gecko_bindings::bindings::{Gecko_CreateGradient, Gecko_SetGradientImageValue, Gecko_SetLayerImageImageValue};
|
||||||
use gecko_bindings::bindings::{Gecko_InitializeImageCropRect, Gecko_SetImageElement};
|
use gecko_bindings::bindings::{Gecko_InitializeImageCropRect, Gecko_SetImageElement};
|
||||||
use gecko_bindings::structs::{nsCSSUnit, nsStyleCoord_CalcValue, nsStyleImage};
|
use gecko_bindings::structs::{nsCSSUnit, nsStyleCoord_CalcValue, nsStyleImage};
|
||||||
use gecko_bindings::structs::{nsresult, SheetType};
|
use gecko_bindings::structs::{nsresult, SheetType};
|
||||||
|
@ -144,7 +144,7 @@ impl nsStyleImage {
|
||||||
},
|
},
|
||||||
GenericImage::Url(ref url) => {
|
GenericImage::Url(ref url) => {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_SetUrlImageValue(self, url.for_ffi());
|
Gecko_SetLayerImageImageValue(self, url.image_value.clone().unwrap().get());
|
||||||
// We unfortunately must make any url() value uncacheable, since
|
// We unfortunately must make any url() value uncacheable, since
|
||||||
// the applicable declarations cache is not per document, but
|
// the applicable declarations cache is not per document, but
|
||||||
// global, and the imgRequestProxy objects we store in the style
|
// global, and the imgRequestProxy objects we store in the style
|
||||||
|
@ -157,7 +157,7 @@ impl nsStyleImage {
|
||||||
},
|
},
|
||||||
GenericImage::Rect(ref image_rect) => {
|
GenericImage::Rect(ref image_rect) => {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_SetUrlImageValue(self, image_rect.url.for_ffi());
|
Gecko_SetLayerImageImageValue(self, image_rect.url.image_value.clone().unwrap().get());
|
||||||
Gecko_InitializeImageCropRect(self);
|
Gecko_InitializeImageCropRect(self);
|
||||||
|
|
||||||
// We unfortunately must make any url() value uncacheable, since
|
// We unfortunately must make any url() value uncacheable, since
|
||||||
|
|
|
@ -1845,7 +1845,8 @@ pub extern "C" fn Servo_DeclarationBlock_SetBackgroundImage(declarations:
|
||||||
let context = ParserContext::new(Origin::Author, url_data, &error_reporter,
|
let context = ParserContext::new(Origin::Author, url_data, &error_reporter,
|
||||||
Some(CssRuleType::Style), PARSING_MODE_DEFAULT,
|
Some(CssRuleType::Style), PARSING_MODE_DEFAULT,
|
||||||
QuirksMode::NoQuirks);
|
QuirksMode::NoQuirks);
|
||||||
if let Ok(url) = SpecifiedUrl::parse_from_string(string.into(), &context) {
|
if let Ok(mut url) = SpecifiedUrl::parse_from_string(string.into(), &context) {
|
||||||
|
url.build_image_value();
|
||||||
let decl = PropertyDeclaration::BackgroundImage(BackgroundImage(
|
let decl = PropertyDeclaration::BackgroundImage(BackgroundImage(
|
||||||
vec![Either::Second(Image::Url(url))]
|
vec![Either::Second(Image::Url(url))]
|
||||||
));
|
));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue