mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1551991 - Remove nsCSSValue usage from GetPad. r=jwatt
Depends on D31315 Differential Revision: https://phabricator.services.mozilla.com/D31316 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
c8338578d2
commit
854582f70f
@ -1242,16 +1242,13 @@ bool CustomCounterStyle::IsOrdinalInAutoRange(CounterValue aOrdinal) {
|
||||
void CustomCounterStyle::GetPad(PadType& aResult) {
|
||||
if (!(mFlags & FLAG_PAD_INITED)) {
|
||||
mFlags |= FLAG_PAD_INITED;
|
||||
nsCSSValue value = GetDesc(eCSSCounterDesc_Pad);
|
||||
if (value.GetUnit() == eCSSUnit_Pair) {
|
||||
const nsCSSValuePair& pair = value.GetPairValue();
|
||||
mPad.width = pair.mXValue.GetIntValue();
|
||||
pair.mYValue.GetStringValue(mPad.symbol);
|
||||
} else if (IsExtendsSystem()) {
|
||||
GetExtends()->GetPad(mPad);
|
||||
} else {
|
||||
mPad.width = 0;
|
||||
mPad.symbol.Truncate();
|
||||
if (!Servo_CounterStyleRule_GetPad(mRule, &mPad.width, &mPad.symbol)) {
|
||||
if (IsExtendsSystem()) {
|
||||
GetExtends()->GetPad(mPad);
|
||||
} else {
|
||||
mPad.width = 0;
|
||||
mPad.symbol.Truncate();
|
||||
}
|
||||
}
|
||||
}
|
||||
aResult = mPad;
|
||||
|
@ -2959,6 +2959,30 @@ pub unsafe extern "C" fn Servo_CounterStyleRule_GetGeneration(
|
||||
read_locked_arc(rule, |rule: &CounterStyleRule| rule.generation())
|
||||
}
|
||||
|
||||
fn symbol_to_string(s: &counter_style::Symbol) -> nsString {
|
||||
match *s {
|
||||
counter_style::Symbol::String(ref s) => nsString::from(&**s),
|
||||
counter_style::Symbol::Ident(ref i) => nsString::from(i.0.as_slice())
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn Servo_CounterStyleRule_GetPad(
|
||||
rule: &RawServoCounterStyleRule,
|
||||
width: &mut i32,
|
||||
symbol: &mut nsString,
|
||||
) -> bool {
|
||||
read_locked_arc(rule, |rule: &CounterStyleRule| {
|
||||
let pad = match rule.pad() {
|
||||
Some(pad) => pad,
|
||||
None => return false,
|
||||
};
|
||||
*width = pad.0.value();
|
||||
*symbol = symbol_to_string(&pad.1);
|
||||
true
|
||||
})
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn Servo_CounterStyleRule_GetSystem(
|
||||
rule: &RawServoCounterStyleRule,
|
||||
|
Loading…
Reference in New Issue
Block a user