shithub: mycel

Download patch

ref: 9a337daee1e1515e7044fd6c5d89b98c30ea3165
parent: a866b48426076fef2339047792d39ca92676103c
author: Philip Silva <philip.silva@protonmail.com>
date: Sun Sep 4 08:42:48 EDT 2022

handle auto in absolute positioning

--- a/browser/browser.go
+++ b/browser/browser.go
@@ -906,21 +906,21 @@
 				kid.R = self.R
 			} else {
 				kid.UI.Layout(dui, kid, sizeAvail, true)
-				if t, err := el.n.CssPx("top"); err == nil {
+				if t, err := el.n.CssPx("top"); err == nil && el.n.Css("top") != "auto" {
 					t = dui.Scale(t)
 					kid.R.Min.Y += t
 					kid.R.Max.Y += t
-				} else if b, err := el.n.CssPx("bottom"); err == nil {
+				} else if b, err := el.n.CssPx("bottom"); err == nil && el.n.Css("bottom") != "auto" {
 					b = dui.Scale(b)
 					h := kid.R.Max.X
 					kid.R.Min.Y = sizeAvail.Y - b
 					kid.R.Max.Y = sizeAvail.Y - h
 				}
-				if l, err := el.n.CssPx("left"); err == nil {
+				if l, err := el.n.CssPx("left"); err == nil && el.n.Css("left") != "auto" {
 					l = dui.Scale(l)
 					kid.R.Max.X += l
 					kid.R.Min.X += l
-				} else if r, err := el.n.CssPx("right"); err == nil {
+				} else if r, err := el.n.CssPx("right"); err == nil && el.n.Css("right") != "auto"  {
 					r = dui.Scale(r)
 					w := kid.R.Max.X
 					kid.R.Max.X = sizeAvail.X - r