Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions crates/resvg/tests/integration/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,11 @@ use crate::render;
#[test] fn structure_style_iD_selector() { assert_eq!(render("tests/structure/style/iD-selector"), 0); }
#[test] fn structure_style_important() { assert_eq!(render("tests/structure/style/important"), 0); }
#[test] fn structure_style_invalid_type() { assert_eq!(render("tests/structure/style/invalid-type"), 0); }
#[test] fn structure_style_non_presentational_attribute() { assert_eq!(render("tests/structure/style/non-presentational-attribute"), 0); }
#[test] fn structure_style_presentation_attributes() { assert_eq!(render("tests/structure/style/presentation-attributes"), 0); }
#[test] fn structure_style_presentation_attributes_2() { assert_eq!(render("tests/structure/style/presentation-attributes-2"), 0); }
#[test] fn structure_style_presentation_attributes_3() { assert_eq!(render("tests/structure/style/presentation-attributes-3"), 0); }
#[test] fn structure_style_presentation_attributes_4() { assert_eq!(render("tests/structure/style/presentation-attributes-4"), 0); }
#[test] fn structure_style_presentation_attributes_5() { assert_eq!(render("tests/structure/style/presentation-attributes-5"), 0); }
#[test] fn structure_style_resolve_order() { assert_eq!(render("tests/structure/style/resolve-order"), 0); }
#[test] fn structure_style_rule_specificity() { assert_eq!(render("tests/structure/style/rule-specificity"), 0); }
#[test] fn structure_style_style_after_usage() { assert_eq!(render("tests/structure/style/style-after-usage"), 0); }
Expand All @@ -1171,7 +1175,7 @@ use crate::render;
#[test] fn structure_style_universal_selector() { assert_eq!(render("tests/structure/style/universal-selector"), 0); }
#[test] fn structure_style_unresolved_class_selector() { assert_eq!(render("tests/structure/style/unresolved-class-selector"), 0); }
#[test] fn structure_style_attribute_comments() { assert_eq!(render("tests/structure/style-attribute/comments"), 0); }
#[test] fn structure_style_attribute_non_presentational_attribute() { assert_eq!(render("tests/structure/style-attribute/non-presentational-attribute"), 0); }
#[test] fn structure_style_attribute_presentation_attributes() { assert_eq!(render("tests/structure/style-attribute/presentation-attributes"), 0); }
#[test] fn structure_style_attribute_simple_case() { assert_eq!(render("tests/structure/style-attribute/simple-case"), 0); }
#[test] fn structure_style_attribute_transform() { assert_eq!(render("tests/structure/style-attribute/transform"), 0); }
#[test] fn structure_svg_attribute_value_via_ENTITY_reference() { assert_eq!(render("tests/structure/svg/attribute-value-via-ENTITY-reference"), 0); }
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions crates/usvg/src/parser/svgtree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,14 @@ impl AId {
| AId::WhiteSpace
| AId::WordSpacing
| AId::WritingMode
| AId::X
| AId::Y
| AId::Cx
| AId::Cy
| AId::R
| AId::D
| AId::Width
| AId::Height
)
}

Expand Down
13 changes: 13 additions & 0 deletions crates/usvg/src/parser/svgtree/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,19 @@ pub(crate) fn parse_svg_element<'input>(
}

let mut insert_attribute = |aid, value: &str, important: bool| {
// Height and width CSS styling should not happen for the
// following elements (see https://github.com/w3c/svgwg/pull/1059):
// - "svg", unless it's the outermost one
// - "use"
// - "symbol"
match aid {
AId::Height | AId::Width => match tag_name {
EId::Svg if parent_id.get() != 0 => return,
EId::Use | EId::Symbol => return,
_ => (),
},
_ => (),
}
// Check that attribute already exists.
let idx = doc.attrs[attrs_start_idx..]
.iter_mut()
Expand Down
4 changes: 4 additions & 0 deletions docs/svg2-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ NOTE: This list is not final. This just things I was able to find so far. Patche

## Styling

### Changed

- `height`, `width`, `x`, `y`, `cx`, `cy`, `r` and `d` are presentation attributes now. Which means that they can be resolved from CSS now.

### Deprecated

- A [`clip`](https://www.w3.org/TR/css-masking-1/#clip-property) property.
Expand Down
Loading