Fix some segfaults
This commit is contained in:
parent
a62dff4236
commit
5864c74691
@ -69,6 +69,7 @@ func (this *System) newBox (outer anyBox) *box {
|
||||
system: this,
|
||||
outer: outer,
|
||||
drawer: outer,
|
||||
tags: make(util.Set[string]),
|
||||
}
|
||||
box.canvas = util.NewMemo (func () canvas.Canvas {
|
||||
if box.parent == nil { return nil }
|
||||
@ -614,7 +615,8 @@ func (this *box) propagateAlt (callback func (anyBox) bool) bool {
|
||||
func (this *box) transparent () bool {
|
||||
// TODO uncomment once we have
|
||||
// a way to detect texture transparency
|
||||
return util.Transparent(this.attrColor.Value()) /*&&
|
||||
col := this.attrColor.Value().Color
|
||||
return col == nil || util.Transparent(col) /*&&
|
||||
(this.texture == nil || !this.texture.Opaque())*/
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ type styleApplicator struct {
|
||||
func (this *styleApplicator) apply (box anyBox) {
|
||||
if box.Role() != this.role {
|
||||
// the role has changed, so re-cache the list of rules
|
||||
this.rules = make([]*tomo.Rule, 4)
|
||||
this.rules = make([]*tomo.Rule, 0, 4)
|
||||
for _, rule := range this.style.Rules {
|
||||
role := box.Role()
|
||||
// blank fields match anything
|
||||
@ -27,10 +27,12 @@ func (this *styleApplicator) apply (box anyBox) {
|
||||
attrs := make(tomo.AttrSet)
|
||||
for _, rule := range this.rules {
|
||||
satisifed := true
|
||||
for _, tag := range rule.Tags {
|
||||
if !box.Tag(tag) {
|
||||
satisifed = false
|
||||
break
|
||||
if rule.Tags != nil {
|
||||
for _, tag := range rule.Tags {
|
||||
if !box.Tag(tag) {
|
||||
satisifed = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user