diff options
| author | bptato <nincsnevem662@gmail.com> | 2025-01-12 18:16:49 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2025-01-12 18:21:15 +0100 |
| commit | 7b005123a364660f8ea8d801f84bf7a5f746d654 (patch) | |
| tree | 0b3da54e5ea7b44b64ca121849d8670f1ee92da1 /src/html | |
| parent | c3065fad6dcf831b055a6b8d23d47fa3acb1326f (diff) | |
| download | chawan-7b005123a364660f8ea8d801f84bf7a5f746d654.tar.gz | |
cssvalues: reduce CSSValues size
* switch from float64 -> float32; other browsers use 32-bit floats too
* specify integer size as 32-bit
* use NetworkBitmap for background-image value (currently just an
invalid dummy value)
* remove "none" property & value types
CSSValue's payload is always one word (plus another for the type tag).
CSSValues keeps its size, but no longer has to heap-alloc + refcount
word-sized CSSValues.
(On 32-bit systems, CSSValues might actually be larger than before,
but I expect it's still a net benefit with the removal of refcounting
and the switch to 32-bit floats.)
Diffstat (limited to 'src/html')
| -rw-r--r-- | src/html/dom.nim | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim index 17f32890..b06a1d04 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -3871,13 +3871,9 @@ proc getComputedStyle*(element: Element): CSSStyleDeclaration = if element.cachedComputedStyle == nil: var s = "" for p in CSSPropertyType: - if p != cptNone: - s &= $p & ':' - if p.isBit: - s &= element.computed.bits[p].serialize(valueType(p)) - else: - s &= element.computed.objs[p].serialize() - s &= ';' + s &= $p & ':' + s &= element.computed.serialize(p) + s &= ';' element.cachedComputedStyle = newCSSStyleDeclaration(element, move(s)) element.cachedComputedStyle.computed = true element.cachedComputedStyle.readonly = true |