diff options
| author | bptato <nincsnevem662@gmail.com> | 2025-01-14 18:59:17 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2025-01-14 21:48:20 +0100 |
| commit | 99b72030569ae2f688002bd71d1fb58ad6daec90 (patch) | |
| tree | 07846b88ac6016cca4f0ae3638c91f48ad40e7a7 /src/html | |
| parent | b88ff4a313e04632c41d7ef90370599484a6f0bc (diff) | |
| download | chawan-99b72030569ae2f688002bd71d1fb58ad6daec90.tar.gz | |
css: refactor selector parsing & cascading, some work on variables
Untangled some nested arrays to reduce the number of intermediary seqs
in cascade, and collapsed the two rule def sorts into just one (per
pseudo element). This should make cascading somewhat faster.
Also, we now parse variables, but they aren't resolved yet.
Probably a seq won't cut it for var lookup...
Diffstat (limited to 'src/html')
| -rw-r--r-- | src/html/dom.nim | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim index 49233e87..83ad9025 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -3796,8 +3796,9 @@ proc setValue(this: CSSStyleDeclaration; i: int; cvals: seq[CSSComponentValue]): if i notin 0 .. this.decls.high: return err() # dummyAttrs can be safely used because the result is discarded. - var dummy: seq[CSSComputedEntry] - ?parseComputedValues(dummy, this.decls[i].name, cvals, dummyAttrs) + var dummy: seq[CSSComputedEntry] = @[] + ?dummy.parseComputedValues(this.decls[i].name, cvals, dummyAttrs, + this.element.document.factory) this.decls[i].value = cvals return ok() @@ -3831,8 +3832,9 @@ proc setProperty(this: CSSStyleDeclaration; name, value: string): # not err! this does not throw. return ok() else: - var dummy: seq[CSSComputedEntry] - let val0 = parseComputedValues(dummy, name, cvals, dummyAttrs) + var dummy: seq[CSSComputedEntry] = @[] + let val0 = dummy.parseComputedValues(name, cvals, dummyAttrs, + this.element.document.factory) if val0.isNone: return ok() this.decls.add(CSSDeclaration(name: name, value: cvals)) |