Bug 1551991 - followup: Give up on passing CounterSpeakAs by value since the previous patch busted non-Windows platforms.

CLOSED TREE
This commit is contained in:
Emilio Cobos Álvarez 2019-05-17 06:43:39 +02:00
Родитель 5436d3561e
Коммит 659be28594
2 изменённых файлов: 6 добавлений и 8 удалений

Просмотреть файл

@ -1338,7 +1338,8 @@ void CustomCounterStyle::ComputeRawSpeakAs(uint8_t& aSpeakAs,
NS_ASSERTION(!(mFlags & FLAG_SPEAKAS_INITED), NS_ASSERTION(!(mFlags & FLAG_SPEAKAS_INITED),
"ComputeRawSpeakAs is called with speak-as inited."); "ComputeRawSpeakAs is called with speak-as inited.");
auto speakAs = Servo_CounterStyleRule_GetSpeakAs(mRule); auto speakAs = StyleCounterSpeakAs::None();
Servo_CounterStyleRule_GetSpeakAs(mRule, &speakAs);
switch (speakAs.tag) { switch (speakAs.tag) {
case StyleCounterSpeakAs::Tag::Auto: case StyleCounterSpeakAs::Tag::Auto:
aSpeakAs = GetSpeakAsAutoValue(); aSpeakAs = GetSpeakAsAutoValue();

Просмотреть файл

@ -3118,10 +3118,6 @@ pub unsafe extern "C" fn Servo_CounterStyleRule_GetAdditiveSymbols(
}) })
} }
/// Don't derive destructors so that it's POD and we can pass it by value
/// without issues.
///
/// cbindgen:derive-tagged-enum-destructor=false
#[repr(C, u8)] #[repr(C, u8)]
pub enum CounterSpeakAs { pub enum CounterSpeakAs {
None, None,
@ -3135,9 +3131,10 @@ pub enum CounterSpeakAs {
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn Servo_CounterStyleRule_GetSpeakAs( pub unsafe extern "C" fn Servo_CounterStyleRule_GetSpeakAs(
rule: &RawServoCounterStyleRule, rule: &RawServoCounterStyleRule,
) -> CounterSpeakAs { out: &mut CounterSpeakAs,
) {
use style::counter_style::SpeakAs; use style::counter_style::SpeakAs;
read_locked_arc(rule, |rule: &CounterStyleRule| { *out = read_locked_arc(rule, |rule: &CounterStyleRule| {
let speak_as = match rule.speak_as() { let speak_as = match rule.speak_as() {
Some(s) => s, Some(s) => s,
None => return CounterSpeakAs::None, None => return CounterSpeakAs::None,
@ -3149,7 +3146,7 @@ pub unsafe extern "C" fn Servo_CounterStyleRule_GetSpeakAs(
SpeakAs::Words => CounterSpeakAs::Words, SpeakAs::Words => CounterSpeakAs::Words,
SpeakAs::Other(ref other) => CounterSpeakAs::Ident(other.0.as_ptr()), SpeakAs::Other(ref other) => CounterSpeakAs::Ident(other.0.as_ptr()),
} }
}) });
} }
#[no_mangle] #[no_mangle]