ref: a687c85de1959516bcd1c881a5a40a0078c81325
parent: 1ed39a3b5cabe073caf56302a1cfc21b11767653
author: Philip Silva <[email protected]>
date: Tue Jan 12 17:00:01 EST 2021
bg and css important handled
--- a/browser/browser.go
+++ b/browser/browser.go
@@ -248,8 +248,7 @@
return NewElement(ui, n)
}
if bg, err := n.BoxBackground(); err == nil {
- _=bg
- //i = bg
+ i = bg
} else {
log.Printf("box background: %f", err)
}
--- a/style/stylesheets.go
+++ b/style/stylesheets.go
@@ -120,6 +120,9 @@
ds := make(map[string]css.Declaration)
for _, r := range rs {
for _, d := range r.Declarations {
+ if exist, ok := ds[d.Property]; ok && smaller(*d, exist) {
+ continue
+ }
ds[d.Property] = *d
}
}
@@ -126,6 +129,10 @@
m[n] = Map{ds}
}
return
+}
+
+func smaller(d, dd css.Declaration) bool {
+ return dd.Important
}
func FetchNodeRules(doc *html.Node, cssText string, windowWidth int) (m map[*html.Node][]*css.Rule, err error) {