[html-style-info] compact gnc:html-style-table-fetch

This commit is contained in:
Christopher Lam 2019-10-12 13:18:02 +08:00
parent 66e5bc8a58
commit 8e64fa7f65

View File

@ -353,32 +353,26 @@
(and (gnc:html-data-style-info? s) (and (gnc:html-data-style-info? s)
(gnc:html-data-style-info-inheritable? s))) (gnc:html-data-style-info-inheritable? s)))
s #f))) s #f)))
(define (fetch-worker style antecedents) (define (fetch-worker style antecedents)
(if (null? antecedents) (cond
style ((null? antecedents) style)
(let ((parent (car antecedents))) ((not (car antecedents)) (fetch-worker style (cdr antecedents)))
(if (not parent) ((gnc:html-style-table-compiled? (car antecedents))
(fetch-worker style (cdr antecedents)) (gnc:html-style-info-merge
(if (gnc:html-style-table-compiled? parent) style (hash-ref (gnc:html-style-table-inheritable (car antecedents)) markup)))
(gnc:html-style-info-merge (else
style (fetch-worker
(hash-ref (gnc:html-style-table-inheritable parent) markup)) (gnc:html-style-info-merge
(fetch-worker style (get-inheritable-style
(gnc:html-style-info-merge (gnc:html-style-table-primary (car antecedents))))
style (get-inheritable-style (cdr antecedents)))))
(gnc:html-style-table-primary parent)))
(cdr antecedents)))))))
(if (and table (gnc:html-style-table-compiled? table)) (if (and table (gnc:html-style-table-compiled? table))
(hash-ref (gnc:html-style-table-compiled table) markup) (hash-ref (gnc:html-style-table-compiled table) markup)
(fetch-worker (fetch-worker
(and table (hash-ref (gnc:html-style-table-primary table) markup)) (and table (hash-ref (gnc:html-style-table-primary table) markup))
antecedents))) antecedents)))
(define (gnc:html-style-table-set! table markup style-info) (define (gnc:html-style-table-set! table markup style-info)
(hash-set! (gnc:html-style-table-primary table) markup style-info)) (hash-set! (gnc:html-style-table-primary table) markup style-info))