mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
style: Make the empty svg path valid.
Per SVG2 spec, the EBNF allows the path data string to be empty. An empty path data string disables rendering of the path. Therefore, we should make path('') a valid path string. The related spec issue: https://github.com/w3c/fxtf-drafts/issues/392. Now we serialize `path("")` as `path("")` for offset-path and clip-path. Differential Revision: https://phabricator.services.mozilla.com/D60771
This commit is contained in:
parent
3991ab9999
commit
9aed1de6a5
1 changed files with 0 additions and 5 deletions
|
@ -42,7 +42,6 @@ impl SVGPathData {
|
|||
/// Get the array of PathCommand.
|
||||
#[inline]
|
||||
pub fn commands(&self) -> &[PathCommand] {
|
||||
debug_assert!(!self.0.is_empty());
|
||||
&self.0
|
||||
}
|
||||
|
||||
|
@ -92,10 +91,6 @@ impl Parse for SVGPathData {
|
|||
) -> Result<Self, ParseError<'i>> {
|
||||
let location = input.current_source_location();
|
||||
let path_string = input.expect_string()?.as_ref();
|
||||
if path_string.is_empty() {
|
||||
// Treat an empty string as invalid, so we will not set it.
|
||||
return Err(location.new_custom_error(StyleParseErrorKind::UnspecifiedError));
|
||||
}
|
||||
|
||||
// Parse the svg path string as multiple sub-paths.
|
||||
let mut path_parser = PathParser::new(path_string);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue