зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #17985 - Make list-style-type animatable (from dadaa:make-list-style-type-animatable); r=hiro
<!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors <!-- Either: --> - [X] There are tests for these changes. The test is patch 3 in https://bugzilla.mozilla.org/show_bug.cgi?id=1382137 <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 10c3e2f3ac781905b43b3529253ba1bc9926d9e8 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : e7402194c82e4973541feec2da3f793e8f9d7171
This commit is contained in:
Родитель
97f29a6cfb
Коммит
9f072ee949
|
@ -967,6 +967,31 @@ extern "C" {
|
|||
pub fn Gecko_CopyCounterStyle(dst: *mut CounterStylePtr,
|
||||
src: *const CounterStylePtr);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_CounterStyle_IsNone(ptr: *const CounterStylePtr) -> bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_CounterStyle_IsName(ptr: *const CounterStylePtr) -> bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_CounterStyle_GetName(ptr: *const CounterStylePtr,
|
||||
result: *mut nsAString);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_CounterStyle_GetSymbols(ptr: *const CounterStylePtr)
|
||||
-> *const nsTArray<nsStringRepr>;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_CounterStyle_GetSystem(ptr: *const CounterStylePtr) -> u8;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_CounterStyle_IsSingleString(ptr: *const CounterStylePtr)
|
||||
-> bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_CounterStyle_GetSingleString(ptr: *const CounterStylePtr,
|
||||
result: *mut nsAString);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_SetNullImageValue(image: *mut nsStyleImage);
|
||||
}
|
||||
|
@ -1865,9 +1890,6 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn Gecko_Destroy_nsStyleEffects(ptr: *mut nsStyleEffects);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_Construct_nsStyleVariables(ptr: *mut nsStyleVariables);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_RegisterProfilerThread(name: *const ::std::os::raw::c_char);
|
||||
}
|
||||
|
|
|
@ -477,4 +477,34 @@ impl CounterStyleOrNone {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert Gecko CounterStylePtr to CounterStyleOrNone.
|
||||
pub fn from_gecko_value(gecko_value: &CounterStylePtr) -> Self {
|
||||
use counter_style::{Symbol, Symbols};
|
||||
use gecko_bindings::bindings::Gecko_CounterStyle_GetName;
|
||||
use gecko_bindings::bindings::Gecko_CounterStyle_GetSymbols;
|
||||
use gecko_bindings::bindings::Gecko_CounterStyle_GetSystem;
|
||||
use gecko_bindings::bindings::Gecko_CounterStyle_IsName;
|
||||
use gecko_bindings::bindings::Gecko_CounterStyle_IsNone;
|
||||
use values::CustomIdent;
|
||||
use values::generics::SymbolsType;
|
||||
|
||||
if unsafe { Gecko_CounterStyle_IsNone(gecko_value) } {
|
||||
CounterStyleOrNone::None
|
||||
} else if unsafe { Gecko_CounterStyle_IsName(gecko_value) } {
|
||||
ns_auto_string!(name);
|
||||
unsafe { Gecko_CounterStyle_GetName(gecko_value, &mut *name) };
|
||||
CounterStyleOrNone::Name(CustomIdent((&*name).into()))
|
||||
} else {
|
||||
let system = unsafe { Gecko_CounterStyle_GetSystem(gecko_value) };
|
||||
let symbol_type = SymbolsType::from_gecko_keyword(system as u32);
|
||||
let symbols = unsafe {
|
||||
let ref gecko_symbols = *Gecko_CounterStyle_GetSymbols(gecko_value);
|
||||
gecko_symbols.iter().map(|gecko_symbol| {
|
||||
Symbol::String(gecko_symbol.to_string())
|
||||
}).collect()
|
||||
};
|
||||
CounterStyleOrNone::Symbols(symbol_type, Symbols(symbols))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4149,6 +4149,23 @@ fn static_assert() {
|
|||
self.copy_list_style_type_from(other)
|
||||
}
|
||||
|
||||
pub fn clone_list_style_type(&self) -> longhands::list_style_type::computed_value::T {
|
||||
use gecko_bindings::bindings::Gecko_CounterStyle_IsSingleString;
|
||||
use gecko_bindings::bindings::Gecko_CounterStyle_GetSingleString;
|
||||
use self::longhands::list_style_type::computed_value::T;
|
||||
use values::generics::CounterStyleOrNone;
|
||||
|
||||
if unsafe { Gecko_CounterStyle_IsSingleString(&self.gecko.mCounterStyle) } {
|
||||
ns_auto_string!(single_string);
|
||||
unsafe {
|
||||
Gecko_CounterStyle_GetSingleString(&self.gecko.mCounterStyle, &mut *single_string)
|
||||
};
|
||||
T::String(single_string.to_string())
|
||||
} else {
|
||||
T::CounterStyle(CounterStyleOrNone::from_gecko_value(&self.gecko.mCounterStyle))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_quotes(&mut self, other: longhands::quotes::computed_value::T) {
|
||||
use gecko_bindings::bindings::Gecko_NewStyleQuoteValues;
|
||||
use gecko_bindings::sugar::refptr::UniqueRefPtr;
|
||||
|
|
|
@ -27,8 +27,7 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu
|
|||
arabic-indic bengali cambodian cjk-decimal devanagari gujarati gurmukhi kannada khmer lao
|
||||
malayalam mongolian myanmar oriya persian telugu thai tibetan cjk-earthly-branch
|
||||
cjk-heavenly-stem lower-greek hiragana hiragana-iroha katakana katakana-iroha""",
|
||||
needs_conversion="True",
|
||||
animation_value_type="none",
|
||||
animation_value_type="discrete",
|
||||
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-type")}
|
||||
% else:
|
||||
<%helpers:longhand name="list-style-type" animation_value_type="none" boxed="True"
|
||||
|
|
|
@ -50,6 +50,19 @@ impl SymbolsType {
|
|||
SymbolsType::Fixed => structs::NS_STYLE_COUNTER_SYSTEM_FIXED as u8,
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert Gecko value to symbol type.
|
||||
pub fn from_gecko_keyword(gecko_value: u32) -> SymbolsType {
|
||||
use gecko_bindings::structs;
|
||||
match gecko_value {
|
||||
structs::NS_STYLE_COUNTER_SYSTEM_CYCLIC => SymbolsType::Cyclic,
|
||||
structs::NS_STYLE_COUNTER_SYSTEM_NUMERIC => SymbolsType::Numeric,
|
||||
structs::NS_STYLE_COUNTER_SYSTEM_ALPHABETIC => SymbolsType::Alphabetic,
|
||||
structs::NS_STYLE_COUNTER_SYSTEM_SYMBOLIC => SymbolsType::Symbolic,
|
||||
structs::NS_STYLE_COUNTER_SYSTEM_FIXED => SymbolsType::Fixed,
|
||||
x => panic!("Unexpected value for symbol type {}", x)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#typedef-counter-style
|
||||
|
|
Загрузка…
Ссылка в новой задаче