diff options
author | bptato <nincsnevem662@gmail.com> | 2021-12-14 21:05:32 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2021-12-14 21:05:32 +0100 |
commit | 148d6ce5154c2e8c6126509f39ae0cd2f019a0c0 (patch) | |
tree | 3f9fa2cdde8ab090ce0168f15e7e84f3d49283e9 /src/css/style.nim | |
parent | fac95085e1de75e99c12ec30b2d697cf4a77d3ba (diff) | |
download | chawan-148d6ce5154c2e8c6126509f39ae0cd2f019a0c0.tar.gz |
Support all css length units
Diffstat (limited to 'src/css/style.nim')
-rw-r--r-- | src/css/style.nim | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/css/style.nim b/src/css/style.nim index c1fba752..e5b8414d 100644 --- a/src/css/style.nim +++ b/src/css/style.nim @@ -195,7 +195,12 @@ proc querySelector*(document: Document, q: string): seq[Element] = result.add(document.selectElems(sel)) proc applyProperty(elem: Element, s: CSSSpecifiedValue, pseudo: PseudoElem) = - let cval = getComputedValue(s, elem.cssvalues) + var parent: CSSComputedValues + if elem.parentElement != nil: + parent = elem.parentElement.cssvalues + else: + parent = rootProperties() + let cval = getComputedValue(s, elem.cssvalues, parent) if cval.t == PROPERTY_MARGIN: let left = CSSSpecifiedValue(t: PROPERTY_MARGIN_LEFT, v: VALUE_LENGTH, length: cval.length, globalValue: s.globalValue) let right = CSSSpecifiedValue(t: PROPERTY_MARGIN_RIGHT, v: VALUE_LENGTH, length: cval.length, globalValue: s.globalValue) |