Skip to content
Merged
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions Source/Parser/SVG/SVGParserPrimitives.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ public class SVGHelper: NSObject {
let height = SVGLengthParser.yAxis.double(string: nums[3], context: context) {
return CGRect(x: x, y: y, width: width, height: height)
}
} else if let widthAttr = attributes[ignoreCase: "width"],
let heightAttr = attributes[ignoreCase: "height"],
let width = SVGLengthParser.xAxis.double(string: widthAttr, context: context),
let height = SVGLengthParser.yAxis.double(string: heightAttr, context: context) {
Copy link
Collaborator

@khoi khoi Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SVGLengthParser parse % props to absolute values based on the parent width, height (fetched from context).

I wonder what would be the values parsed here for width and height, can u please check?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refer to the results in viewport-02.ref, if the % is used in the viewport attribute, the size will be 100x100.

return CGRect(x: 0.0, y: 0.0, width: width, height: height)
}
return nil
}
Expand Down
Loading