mirror of
https://github.com/servo/servo.git
synced 2025-08-13 01:15:34 +01:00
style: [css-lists-3] Make 'none' invalid as a <counter-style> in counter()/counters().
CSSWG resolution: https://github.com/w3c/csswg-drafts/issues/4163#issuecomment-521331100 Spec: https://drafts.csswg.org/css-lists-3/#counter-functions Differential Revision: https://phabricator.services.mozilla.com/D43893
This commit is contained in:
parent
1406ae7f39
commit
f7a87c49b1
7 changed files with 63 additions and 63 deletions
|
@ -2199,10 +2199,15 @@ fn static_assert() {
|
|||
}
|
||||
|
||||
pub fn set_list_style_type(&mut self, v: longhands::list_style_type::computed_value::T) {
|
||||
use crate::gecko_bindings::bindings::Gecko_SetCounterStyleToName;
|
||||
use crate::gecko_bindings::bindings::Gecko_SetCounterStyleToString;
|
||||
use nsstring::{nsACString, nsCStr};
|
||||
use self::longhands::list_style_type::computed_value::T;
|
||||
match v {
|
||||
T::None => unsafe {
|
||||
Gecko_SetCounterStyleToName(&mut self.gecko.mCounterStyle,
|
||||
atom!("none").into_addrefed());
|
||||
}
|
||||
T::CounterStyle(s) => s.to_gecko_value(&mut self.gecko.mCounterStyle),
|
||||
T::String(s) => unsafe {
|
||||
Gecko_SetCounterStyleToString(&mut self.gecko.mCounterStyle,
|
||||
|
@ -2224,9 +2229,19 @@ fn static_assert() {
|
|||
pub fn clone_list_style_type(&self) -> longhands::list_style_type::computed_value::T {
|
||||
use self::longhands::list_style_type::computed_value::T;
|
||||
use crate::values::Either;
|
||||
use crate::values::generics::CounterStyleOrNone;
|
||||
use crate::values::generics::CounterStyle;
|
||||
use crate::gecko_bindings::bindings;
|
||||
|
||||
let result = CounterStyleOrNone::from_gecko_value(&self.gecko.mCounterStyle);
|
||||
let name = unsafe {
|
||||
bindings::Gecko_CounterStyle_GetName(&self.gecko.mCounterStyle)
|
||||
};
|
||||
if !name.is_null() {
|
||||
let name = unsafe { Atom::from_raw(name) };
|
||||
if name == atom!("none") {
|
||||
return T::None;
|
||||
}
|
||||
}
|
||||
let result = CounterStyle::from_gecko_value(&self.gecko.mCounterStyle);
|
||||
match result {
|
||||
Either::First(counter_style) => T::CounterStyle(counter_style),
|
||||
Either::Second(string) => T::String(string),
|
||||
|
@ -2573,7 +2588,7 @@ clip-path
|
|||
pub fn set_content(&mut self, v: longhands::content::computed_value::T) {
|
||||
use crate::values::CustomIdent;
|
||||
use crate::values::generics::counters::{Content, ContentItem};
|
||||
use crate::values::generics::CounterStyleOrNone;
|
||||
use crate::values::generics::CounterStyle;
|
||||
use crate::gecko_bindings::structs::nsStyleContentData;
|
||||
use crate::gecko_bindings::structs::nsStyleContentAttr;
|
||||
use crate::gecko_bindings::structs::StyleContentType;
|
||||
|
@ -2594,7 +2609,7 @@ clip-path
|
|||
content_type: StyleContentType,
|
||||
name: CustomIdent,
|
||||
sep: &str,
|
||||
style: CounterStyleOrNone,
|
||||
style: CounterStyle,
|
||||
) {
|
||||
debug_assert!(content_type == StyleContentType::Counter ||
|
||||
content_type == StyleContentType::Counters);
|
||||
|
@ -2724,7 +2739,7 @@ clip-path
|
|||
use crate::gecko_bindings::structs::StyleContentType;
|
||||
use crate::values::generics::counters::{Content, ContentItem};
|
||||
use crate::values::{CustomIdent, Either};
|
||||
use crate::values::generics::CounterStyleOrNone;
|
||||
use crate::values::generics::CounterStyle;
|
||||
use crate::values::specified::Attr;
|
||||
|
||||
if self.gecko.mContents.is_empty() {
|
||||
|
@ -2769,7 +2784,7 @@ clip-path
|
|||
Atom::from_raw(gecko_function.mIdent.mRawPtr)
|
||||
});
|
||||
let style =
|
||||
CounterStyleOrNone::from_gecko_value(&gecko_function.mCounterStyle);
|
||||
CounterStyle::from_gecko_value(&gecko_function.mCounterStyle);
|
||||
let style = match style {
|
||||
Either::First(counter_style) => counter_style,
|
||||
Either::Second(_) =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue