mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Support full <image> syntax in list-style-image as per spec.
This allows supporting image-set(), etc, and simplifies the bullet frame code significantly, too thanks to two changes: * Instead of manually managing the image request, use the CSS image loader, with the `REQUEST_REQUIRES_REFLOW` flag, to handle image loads correctly. This didn't exist when this code was initially implemented, but we can nicely use it now. * Instead of re-implementing another WebRender command-builder thing, we can just reuse the nsImageRenderer code. Differential Revision: https://phabricator.services.mozilla.com/D100774
This commit is contained in:
parent
a4506d94ec
commit
65a06d5003
4 changed files with 7 additions and 13 deletions
|
@ -54,10 +54,10 @@ ${helpers.single_keyword(
|
||||||
|
|
||||||
${helpers.predefined_type(
|
${helpers.predefined_type(
|
||||||
"list-style-image",
|
"list-style-image",
|
||||||
"url::ImageUrlOrNone",
|
"Image",
|
||||||
engines="gecko servo-2013 servo-2020",
|
engines="gecko servo-2013 servo-2020",
|
||||||
initial_value="computed::url::ImageUrlOrNone::none()",
|
initial_value="computed::Image::None",
|
||||||
initial_specified_value="specified::url::ImageUrlOrNone::none()",
|
initial_specified_value="specified::Image::None",
|
||||||
animation_value_type="discrete",
|
animation_value_type="discrete",
|
||||||
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-image",
|
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-image",
|
||||||
servo_restyle_damage="rebuild_and_reflow",
|
servo_restyle_damage="rebuild_and_reflow",
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
derive_serialize="True"
|
derive_serialize="True"
|
||||||
spec="https://drafts.csswg.org/css-lists/#propdef-list-style">
|
spec="https://drafts.csswg.org/css-lists/#propdef-list-style">
|
||||||
use crate::properties::longhands::{list_style_image, list_style_position, list_style_type};
|
use crate::properties::longhands::{list_style_image, list_style_position, list_style_type};
|
||||||
use crate::values::specified::url::ImageUrlOrNone;
|
use crate::values::specified::Image;
|
||||||
|
|
||||||
pub fn parse_value<'i, 't>(
|
pub fn parse_value<'i, 't>(
|
||||||
context: &ParserContext,
|
context: &ParserContext,
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
(true, 2, None, None) => {
|
(true, 2, None, None) => {
|
||||||
Ok(expanded! {
|
Ok(expanded! {
|
||||||
list_style_position: position,
|
list_style_position: position,
|
||||||
list_style_image: ImageUrlOrNone::none(),
|
list_style_image: Image::None,
|
||||||
list_style_type: ListStyleType::None,
|
list_style_type: ListStyleType::None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -83,14 +83,14 @@
|
||||||
(true, 1, Some(list_style_type), None) => {
|
(true, 1, Some(list_style_type), None) => {
|
||||||
Ok(expanded! {
|
Ok(expanded! {
|
||||||
list_style_position: position,
|
list_style_position: position,
|
||||||
list_style_image: ImageUrlOrNone::none(),
|
list_style_image: Image::None,
|
||||||
list_style_type: list_style_type,
|
list_style_type: list_style_type,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
(true, 1, None, None) => {
|
(true, 1, None, None) => {
|
||||||
Ok(expanded! {
|
Ok(expanded! {
|
||||||
list_style_position: position,
|
list_style_position: position,
|
||||||
list_style_image: ImageUrlOrNone::none(),
|
list_style_image: Image::None,
|
||||||
list_style_type: ListStyleType::None,
|
list_style_type: ListStyleType::None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,3 @@ pub use crate::servo::url::{ComputedImageUrl, ComputedUrl};
|
||||||
|
|
||||||
/// Computed <url> | <none>
|
/// Computed <url> | <none>
|
||||||
pub type UrlOrNone = GenericUrlOrNone<ComputedUrl>;
|
pub type UrlOrNone = GenericUrlOrNone<ComputedUrl>;
|
||||||
|
|
||||||
/// Computed image <url> | <none>
|
|
||||||
pub type ImageUrlOrNone = GenericUrlOrNone<ComputedImageUrl>;
|
|
||||||
|
|
|
@ -13,6 +13,3 @@ pub use crate::servo::url::{SpecifiedImageUrl, SpecifiedUrl};
|
||||||
|
|
||||||
/// Specified <url> | <none>
|
/// Specified <url> | <none>
|
||||||
pub type UrlOrNone = GenericUrlOrNone<SpecifiedUrl>;
|
pub type UrlOrNone = GenericUrlOrNone<SpecifiedUrl>;
|
||||||
|
|
||||||
/// Specified image <url> | <none>
|
|
||||||
pub type ImageUrlOrNone = GenericUrlOrNone<SpecifiedImageUrl>;
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue