Backend unsets style attributes if they are no longer specified

This commit is contained in:
Sasha Koshka 2024-08-12 20:36:19 -04:00
parent e4fdde3da1
commit fa2ef954b2

View File

@ -7,6 +7,7 @@ type styleApplicator struct {
style *style.Style style *style.Style
role tomo.Role role tomo.Role
rules []style.Rule rules []style.Rule
currentSet style.AttrSet
} }
func (this *styleApplicator) apply (box anyBox) { func (this *styleApplicator) apply (box anyBox) {
@ -41,7 +42,18 @@ func (this *styleApplicator) apply (box anyBox) {
} }
} }
// reset an attribute if it is no longer specified
if this.currentSet != nil {
for kind := range this.currentSet {
_, exists := attrs[kind]
if !exists {
box.unsetAttr(kind, false)
}
}
}
// apply that list of attributes // apply that list of attributes
this.currentSet = attrs
for _, attr := range attrs { for _, attr := range attrs {
box.setAttr(attr, false) box.setAttr(attr, false)
} }