Skip to content

Commit

Permalink
Fix #500: Mask attributes ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
ystrot committed Oct 30, 2018
1 parent 1018b76 commit bbb9a60
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Source/svg/SVGParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,7 @@ open class SVGParser {

fileprivate func parseMask(_ mask: XMLIndexer) throws -> UserSpaceNode? {
var userSpace = true
let styles = getStyleAttributes([:], element: mask.element!)
if let units = mask.element?.allAttributes["maskContentUnits"]?.text, units == "objectBoundingBox" {
userSpace = false
}
Expand All @@ -1019,16 +1020,16 @@ open class SVGParser {
}

if mask.children.count == 1 {
let node = try parseNode(mask.children.first!)!
let node = try parseNode(mask.children.first!, groupStyle: styles)!
return UserSpaceNode(node: node, userSpace: userSpace)
}

var nodes = [Node]()
try mask.children.forEach { indexer in
let position = getPosition(indexer.element!)
if let useNode = try parseUse(indexer, place: position) {
if let useNode = try parseUse(indexer, groupStyle: styles, place: position) {
nodes.append(useNode)
} else if let contentNode = try parseNode(indexer) {
} else if let contentNode = try parseNode(indexer, groupStyle: styles) {
nodes.append(contentNode)
}
}
Expand Down

0 comments on commit bbb9a60

Please sign in to comment.