mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
style: Treat empty root margin as zero as per spec
Differential Revision: https://phabricator.services.mozilla.com/D130131
This commit is contained in:
parent
285c645b78
commit
04776cd116
1 changed files with 5 additions and 0 deletions
|
@ -49,6 +49,11 @@ impl Parse for IntersectionObserverRootMargin {
|
||||||
context: &ParserContext,
|
context: &ParserContext,
|
||||||
input: &mut Parser<'i, 't>,
|
input: &mut Parser<'i, 't>,
|
||||||
) -> Result<Self, ParseError<'i>> {
|
) -> Result<Self, ParseError<'i>> {
|
||||||
|
use crate::Zero;
|
||||||
|
if input.is_exhausted() {
|
||||||
|
// If there are zero elements in tokens, set tokens to ["0px"].
|
||||||
|
return Ok(IntersectionObserverRootMargin(Rect::all(LengthPercentage::zero())));
|
||||||
|
}
|
||||||
let rect = Rect::parse_with(context, input, parse_pixel_or_percent)?;
|
let rect = Rect::parse_with(context, input, parse_pixel_or_percent)?;
|
||||||
Ok(IntersectionObserverRootMargin(rect))
|
Ok(IntersectionObserverRootMargin(rect))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue