style: Support break-inside: avoid-{page,column}

break-before/after: page|column seem harder because you need to deal
with nested breaks, I think, but this should be straight-forward.

Differential Revision: https://phabricator.services.mozilla.com/D121206
This commit is contained in:
Emilio Cobos Álvarez 2023-05-22 13:21:38 +02:00 committed by Oriol Brufau
parent cf44eb3e77
commit 5530f7e90c
3 changed files with 66 additions and 21 deletions

View file

@ -503,7 +503,6 @@ ${helpers.predefined_type(
"BreakWithin",
"computed::BreakWithin::Auto",
engines="gecko",
aliases="page-break-inside",
spec="https://drafts.csswg.org/css-break/#propdef-break-inside",
animation_value_type="discrete",
)}

View file

@ -316,15 +316,15 @@ ${helpers.two_properties_shorthand(
name="page-break-before"
flags="SHORTHAND_IN_GETCS IS_LEGACY_SHORTHAND"
sub_properties="break-before"
spec="https://drafts.csswg.org/css2/page.html#propdef-page-break-before"
spec="https://drafts.csswg.org/css-break-3/#page-break-properties"
>
pub fn parse_value<'i>(
_: &ParserContext,
context: &ParserContext,
input: &mut Parser<'i, '_>,
) -> Result<Longhands, ParseError<'i>> {
use crate::values::specified::box_::BreakBetween;
Ok(expanded! {
break_before: BreakBetween::parse_legacy(input)?,
break_before: BreakBetween::parse_legacy(context, input)?,
})
}
@ -340,15 +340,15 @@ ${helpers.two_properties_shorthand(
name="page-break-after"
flags="SHORTHAND_IN_GETCS IS_LEGACY_SHORTHAND"
sub_properties="break-after"
spec="https://drafts.csswg.org/css2/page.html#propdef-page-break-after"
spec="https://drafts.csswg.org/css-break-3/#page-break-properties"
>
pub fn parse_value<'i>(
_: &ParserContext,
context: &ParserContext,
input: &mut Parser<'i, '_>,
) -> Result<Longhands, ParseError<'i>> {
use crate::values::specified::box_::BreakBetween;
Ok(expanded! {
break_after: BreakBetween::parse_legacy(input)?,
break_after: BreakBetween::parse_legacy(context, input)?,
})
}
@ -359,6 +359,30 @@ ${helpers.two_properties_shorthand(
}
</%helpers:shorthand>
<%helpers:shorthand
engines="gecko"
name="page-break-inside"
flags="SHORTHAND_IN_GETCS IS_LEGACY_SHORTHAND"
sub_properties="break-inside"
spec="https://drafts.csswg.org/css-break-3/#page-break-properties"
>
pub fn parse_value<'i>(
context: &ParserContext,
input: &mut Parser<'i, '_>,
) -> Result<Longhands, ParseError<'i>> {
use crate::values::specified::box_::BreakWithin;
Ok(expanded! {
break_inside: BreakWithin::parse_legacy(context, input)?,
})
}
impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
self.break_inside.to_css_legacy(dest)
}
}
</%helpers:shorthand>
<%helpers:shorthand name="offset"
engines="gecko"
sub_properties="offset-path offset-distance offset-rotate offset-anchor"