mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #16274 - CarlosMcs:negative-flex-basis, r=emilio
Reject negative values of flex-basis. Fixes #15902 <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #15902 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/16274) <!-- Reviewable:end -->
This commit is contained in:
commit
be35f564bd
2 changed files with 19 additions and 0 deletions
|
@ -142,6 +142,7 @@ ${helpers.predefined_type("flex-basis",
|
||||||
"LengthOrPercentageOrAutoOrContent",
|
"LengthOrPercentageOrAutoOrContent",
|
||||||
"computed::LengthOrPercentageOrAuto::Auto" if product == "gecko" else
|
"computed::LengthOrPercentageOrAuto::Auto" if product == "gecko" else
|
||||||
"computed::LengthOrPercentageOrAutoOrContent::Auto",
|
"computed::LengthOrPercentageOrAutoOrContent::Auto",
|
||||||
|
"parse_non_negative_with_context",
|
||||||
spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property",
|
spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property",
|
||||||
extra_prefixes="webkit",
|
extra_prefixes="webkit",
|
||||||
animatable=True if product == "gecko" else False)}
|
animatable=True if product == "gecko" else False)}
|
||||||
|
|
|
@ -1170,6 +1170,14 @@ impl LengthOrPercentageOrAuto {
|
||||||
pub fn parse_non_negative(input: &mut Parser) -> Result<LengthOrPercentageOrAuto, ()> {
|
pub fn parse_non_negative(input: &mut Parser) -> Result<LengthOrPercentageOrAuto, ()> {
|
||||||
LengthOrPercentageOrAuto::parse_internal(input, AllowedNumericType::NonNegative)
|
LengthOrPercentageOrAuto::parse_internal(input, AllowedNumericType::NonNegative)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Parse a non-negative length, percentage, or auto.
|
||||||
|
#[inline]
|
||||||
|
pub fn parse_non_negative_with_context(_context: &ParserContext,
|
||||||
|
input: &mut Parser)
|
||||||
|
-> Result<LengthOrPercentageOrAuto, ()> {
|
||||||
|
LengthOrPercentageOrAuto::parse_non_negative(input)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Parse for LengthOrPercentageOrAuto {
|
impl Parse for LengthOrPercentageOrAuto {
|
||||||
|
@ -1273,6 +1281,16 @@ pub enum LengthOrPercentageOrAutoOrContent {
|
||||||
Content
|
Content
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl LengthOrPercentageOrAutoOrContent {
|
||||||
|
/// Alias to `parse` so that Gecko and Servo can use the same method name for
|
||||||
|
/// both `LengthOrPercentageOrAuto` and `LengthOrPercentageOrAutoOrContent`.
|
||||||
|
///
|
||||||
|
/// NOTE: `parse` already only accepts non-negative values.
|
||||||
|
pub fn parse_non_negative_with_context(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||||
|
Self::parse(context, input)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl HasViewportPercentage for LengthOrPercentageOrAutoOrContent {
|
impl HasViewportPercentage for LengthOrPercentageOrAutoOrContent {
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
fn has_viewport_percentage(&self) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue