diff options
author | bptato <nincsnevem662@gmail.com> | 2022-07-16 14:14:06 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-07-16 14:15:52 +0200 |
commit | 8cd503c88693171f9887716440cdc110fdca2bb3 (patch) | |
tree | 7416b86ab677b8bf38c0bd89009991899e516660 /src/css/stylednode.nim | |
parent | 368794ad19514deb7397d4eb2f0e5b72862d28e5 (diff) | |
download | chawan-8cd503c88693171f9887716440cdc110fdca2bb3.tar.gz |
Use StyledNodes instead of passing the entire DOM to the layout engine
This moves pseudo element generation to the cascading phase. For now it also breaks style caching.
Diffstat (limited to 'src/css/stylednode.nim')
-rw-r--r-- | src/css/stylednode.nim | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/css/stylednode.nim b/src/css/stylednode.nim new file mode 100644 index 00000000..d6293187 --- /dev/null +++ b/src/css/stylednode.nim @@ -0,0 +1,18 @@ +import css/values +import html/dom + +# Container to hold a style and a node. +# Pseudo elements are implemented using StyledNode objects without nodes. +type + StyledType* = enum + STYLED_ELEMENT, STYLED_TEXT + + StyledNode* = ref object + case t*: StyledType + of STYLED_ELEMENT: + pseudo*: PseudoElem + computed*: CSSComputedValues + of STYLED_TEXT: + text*: string + node*: Node + children*: seq[StyledNode] |