Skip to content

Commit

Permalink
Cascade inherited attributes for use tags
Browse files Browse the repository at this point in the history
Fix #1365.
  • Loading branch information
liZe committed May 27, 2021
1 parent 3b59df3 commit 41ab0f8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion weasyprint/svg/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

def use(svg, node, font_size):
"""Draw use tags."""
from . import SVG
from . import NOT_INHERITED_ATTRIBUTES, SVG

svg.stream.push_state()

Expand Down Expand Up @@ -48,6 +48,12 @@ def use(svg, node, font_size):
tree.attrib['width'] = node['width']
tree.attrib['height'] = node['height']

# Cascade
for key, value in node.attrib.items():
if key not in NOT_INHERITED_ATTRIBUTES:
if key not in tree.attrib:
tree.attrib[key] = value

svg.draw_node(tree, font_size)
svg.stream.pop_state()

Expand Down

0 comments on commit 41ab0f8

Please sign in to comment.