about summary refs log tree commit diff stats
path: root/src/css
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-01-10 02:34:34 +0100
committerbptato <nincsnevem662@gmail.com>2024-01-10 02:34:34 +0100
commit90b647f8d31f335b158f98e6be63fd56a8c68fd2 (patch)
tree25ca99d3f3a9d94ecc696f91b78e47336ec37ef5 /src/css
parent7e77bced54d29e5e909c0e587fbf9a0c689043dc (diff)
downloadchawan-90b647f8d31f335b158f98e6be63fd56a8c68fd2.tar.gz
Fix windowChange not refreshing valid media queries
* css/cascade: copy stylesheet in applyMediaQuery (so that changes
  are reverted on re-style)
* buffer: clear prevstyled in windowChange (to avoid using cached
  results from previous cascading passes); set window.attrs
* pager: avoid windowChange if new attrs are identical to the old ones
Diffstat (limited to 'src/css')
-rw-r--r--src/css/cascade.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/css/cascade.nim b/src/css/cascade.nim
index 173b2af3..f9422a19 100644
--- a/src/css/cascade.nim
+++ b/src/css/cascade.nim
@@ -276,7 +276,8 @@ proc applyDeclarations(pseudo: PseudoElem, styledParent: StyledNode,
 
 func applyMediaQuery(ss: CSSStylesheet, window: Window): CSSStylesheet =
   if ss == nil: return nil
-  result = ss
+  new(result)
+  result[] = ss[]
   for mq in ss.mqList:
     if mq.query.applies(window):
       result.add(mq.children.applyMediaQuery(window))