style: [css-properties-values-api] Share PropertyRule instance when cloning CssRule::Property

Differential Revision: https://phabricator.services.mozilla.com/D178892
This commit is contained in:
Zach Hoffman 2023-05-25 08:32:41 +00:00 committed by Martin Robinson
parent 48f2f475c6
commit 5c0897c8eb

View file

@ -556,8 +556,9 @@ impl DeepCloneWithLock for CssRule {
)) ))
}, },
CssRule::Property(ref arc) => { CssRule::Property(ref arc) => {
let rule = arc.read_with(guard); // @property rules are immutable, so we don't need any of the `Locked`
CssRule::Property(Arc::new(lock.wrap(rule.clone()))) // shenanigans, actually, and can just share the rule.
CssRule::Property(arc.clone())
}, },
CssRule::Document(ref arc) => { CssRule::Document(ref arc) => {
let rule = arc.read_with(guard); let rule = arc.read_with(guard);