mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Auto merge of #18320 - upsuper:counter-style-clone, r=heycam
Rewrite CounterStyleOrNone::from_gecko_value to use fewer binding functions This is the Servo side change of [bug 1393189](https://bugzilla.mozilla.org/show_bug.cgi?id=1393189). <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18320) <!-- Reviewable:end -->
This commit is contained in:
commit
12ca7d9e96
6 changed files with 1442 additions and 1329 deletions
|
@ -4159,19 +4159,14 @@ fn static_assert() {
|
|||
}
|
||||
|
||||
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::Either;
|
||||
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))
|
||||
let result = CounterStyleOrNone::from_gecko_value(&self.gecko.mCounterStyle);
|
||||
match result {
|
||||
Either::First(counter_style) => T::CounterStyle(counter_style),
|
||||
Either::Second(string) => T::String(string),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5617,6 +5612,7 @@ clip-path
|
|||
use gecko::conversions::string_from_chars_pointer;
|
||||
use gecko_bindings::structs::nsStyleContentType::*;
|
||||
use properties::longhands::content::computed_value::{T, ContentItem};
|
||||
use values::Either;
|
||||
use values::generics::CounterStyleOrNone;
|
||||
use values::specified::url::SpecifiedUrl;
|
||||
use values::specified::Attr;
|
||||
|
@ -5664,6 +5660,11 @@ clip-path
|
|||
let ident = gecko_function.mIdent.to_string();
|
||||
let style =
|
||||
CounterStyleOrNone::from_gecko_value(&gecko_function.mCounterStyle);
|
||||
let style = match style {
|
||||
Either::First(counter_style) => counter_style,
|
||||
Either::Second(_) =>
|
||||
unreachable!("counter function shouldn't have single string type"),
|
||||
};
|
||||
if gecko_content.mType == eStyleContentType_Counter {
|
||||
ContentItem::Counter(ident, style)
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue