mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
stylo: Support counter-increment and counter-reset
MozReview-Commit-ID: DnSd8xAkidM
This commit is contained in:
parent
07723eba7a
commit
2ae317f526
3 changed files with 38 additions and 3 deletions
|
@ -717,10 +717,26 @@ extern "C" {
|
|||
pub fn Gecko_ClearAndResizeStyleContents(content: *mut nsStyleContent,
|
||||
how_many: u32);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_ClearAndResizeCounterIncrements(content: *mut nsStyleContent,
|
||||
how_many: u32);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_ClearAndResizeCounterResets(content: *mut nsStyleContent,
|
||||
how_many: u32);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_CopyStyleContentsFrom(content: *mut nsStyleContent,
|
||||
other: *const nsStyleContent);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_CopyCounterResetsFrom(content: *mut nsStyleContent,
|
||||
other: *const nsStyleContent);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_CopyCounterIncrementsFrom(content: *mut nsStyleContent,
|
||||
other: *const nsStyleContent);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_EnsureImageLayersLength(layers: *mut nsStyleImageLayers,
|
||||
len: usize,
|
||||
|
|
|
@ -3186,7 +3186,7 @@ clip-path
|
|||
</%self:impl_trait>
|
||||
|
||||
<%self:impl_trait style_struct_name="Counters"
|
||||
skip_longhands="content">
|
||||
skip_longhands="content counter-increment counter-reset">
|
||||
pub fn set_content(&mut self, v: longhands::content::computed_value::T) {
|
||||
use properties::longhands::content::computed_value::T;
|
||||
use properties::longhands::content::computed_value::ContentItem;
|
||||
|
@ -3294,6 +3294,25 @@ clip-path
|
|||
Gecko_CopyStyleContentsFrom(&mut self.gecko, &other.gecko)
|
||||
}
|
||||
}
|
||||
|
||||
% for counter_property in ["Increment", "Reset"]:
|
||||
pub fn set_counter_${counter_property.lower()}(&mut self, v: longhands::counter_increment::computed_value::T) {
|
||||
unsafe {
|
||||
bindings::Gecko_ClearAndResizeCounter${counter_property}s(&mut self.gecko,
|
||||
v.0.len() as u32);
|
||||
for (i, item) in v.0.into_iter().enumerate() {
|
||||
self.gecko.m${counter_property}s[i].mCounter.assign_utf8(&item.0);
|
||||
self.gecko.m${counter_property}s[i].mValue = item.1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn copy_counter_${counter_property.lower()}_from(&mut self, other: &Self) {
|
||||
unsafe {
|
||||
bindings::Gecko_CopyCounter${counter_property}sFrom(&mut self.gecko, &other.gecko)
|
||||
}
|
||||
}
|
||||
% endfor
|
||||
</%self:impl_trait>
|
||||
|
||||
<%self:impl_trait style_struct_name="XUL"
|
||||
|
|
|
@ -239,7 +239,7 @@
|
|||
}
|
||||
</%helpers:longhand>
|
||||
|
||||
<%helpers:longhand name="counter-increment" products="servo" animatable="False"
|
||||
<%helpers:longhand name="counter-increment" animatable="False"
|
||||
spec="https://drafts.csswg.org/css-lists/#propdef-counter-increment">
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
@ -313,7 +313,7 @@
|
|||
}
|
||||
</%helpers:longhand>
|
||||
|
||||
<%helpers:longhand name="counter-reset" products="servo" animatable="False"
|
||||
<%helpers:longhand name="counter-reset" animatable="False"
|
||||
spec="https://drafts.csswg.org/css-lists-3/#propdef-counter-reset">
|
||||
pub use super::counter_increment::{SpecifiedValue, computed_value, get_initial_value};
|
||||
use super::counter_increment::{parse_common};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue