mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
stylo: Add auto-filled line names to mRepeatAutoLineNameListBefore.
This commit is contained in:
parent
296a215e54
commit
6fb403c396
2 changed files with 11 additions and 4 deletions
|
@ -1405,9 +1405,14 @@ fn static_assert() {
|
||||||
&mut ${self_grid}.mRepeatAutoLineNameListAfter, 0);
|
&mut ${self_grid}.mRepeatAutoLineNameListAfter, 0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
GridTemplateComponent::Subgrid(list) => {
|
GridTemplateComponent::Subgrid(mut list) => {
|
||||||
${self_grid}.set_mIsSubgrid(true);
|
${self_grid}.set_mIsSubgrid(true);
|
||||||
let num_values = cmp::min(list.names.len(), max_lines + 1);
|
let names_length = match list.fill_idx {
|
||||||
|
Some(_) => list.names.len() - 1,
|
||||||
|
None => list.names.len(),
|
||||||
|
};
|
||||||
|
let num_values = cmp::min(names_length, max_lines + 1);
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
bindings::Gecko_SetStyleGridTemplateArrayLengths(&mut ${self_grid}, 0);
|
bindings::Gecko_SetStyleGridTemplateArrayLengths(&mut ${self_grid}, 0);
|
||||||
bindings::Gecko_SetGridTemplateLineNamesLength(&mut ${self_grid}, num_values as u32);
|
bindings::Gecko_SetGridTemplateLineNamesLength(&mut ${self_grid}, num_values as u32);
|
||||||
|
@ -1420,6 +1425,8 @@ fn static_assert() {
|
||||||
if let Some(idx) = list.fill_idx {
|
if let Some(idx) = list.fill_idx {
|
||||||
${self_grid}.set_mIsAutoFill(true);
|
${self_grid}.set_mIsAutoFill(true);
|
||||||
${self_grid}.mRepeatAutoIndex = idx as i16;
|
${self_grid}.mRepeatAutoIndex = idx as i16;
|
||||||
|
set_line_names(&list.names.swap_remove(idx as usize),
|
||||||
|
&mut ${self_grid}.mRepeatAutoLineNameListBefore);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (servo_names, gecko_names) in list.names.iter().zip(${self_grid}.mLineNameLists.iter_mut()) {
|
for (servo_names, gecko_names) in list.names.iter().zip(${self_grid}.mLineNameLists.iter_mut()) {
|
||||||
|
|
|
@ -621,10 +621,10 @@ impl Parse for LineNameList {
|
||||||
.take(num.value() as usize * names_list.len())),
|
.take(num.value() as usize * names_list.len())),
|
||||||
RepeatCount::AutoFill if fill_idx.is_none() => {
|
RepeatCount::AutoFill if fill_idx.is_none() => {
|
||||||
// `repeat(autof-fill, ..)` should have just one line name.
|
// `repeat(autof-fill, ..)` should have just one line name.
|
||||||
if names_list.len() > 1 {
|
if names_list.len() != 1 {
|
||||||
return Err(StyleParseError::UnspecifiedError.into());
|
return Err(StyleParseError::UnspecifiedError.into());
|
||||||
}
|
}
|
||||||
let names = names_list.pop().expect("expected one name list for auto-fill");
|
let names = names_list.pop().unwrap();
|
||||||
|
|
||||||
line_names.push(names);
|
line_names.push(names);
|
||||||
fill_idx = Some(line_names.len() as u32 - 1);
|
fill_idx = Some(line_names.len() as u32 - 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue