about summary refs log tree commit diff stats
path: root/src/css
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-12-31 15:13:02 +0100
committerbptato <nincsnevem662@gmail.com>2022-12-31 15:13:02 +0100
commitc8863aaa9c27480bf7577beeb514f9a216390e13 (patch)
treeb4d8b683e6ec4ea41d6b2fbbe050149c6b63f693 /src/css
parent362e934deb77ae12e2a26d88f597c046eb13be3d (diff)
downloadchawan-c8863aaa9c27480bf7577beeb514f9a216390e13.tar.gz
css/cascade: fix stylesheets not being copied in <head>
Diffstat (limited to 'src/css')
-rw-r--r--src/css/cascade.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/css/cascade.nim b/src/css/cascade.nim
index 0b85addd..07ff5e9a 100644
--- a/src/css/cascade.nim
+++ b/src/css/cascade.nim
@@ -367,7 +367,7 @@ proc applyRules(document: Document, ua, user: CSSStylesheet, cachedTree: StyledN
       if cachedChild != nil and result != styledChild:
         styledChild.sheets = cachedChild.sheets
       else:
-        if unlikely(result == styledChild):
+        if result == styledChild:
           #TODO this is ugly. we should cache head sheets separately.
           let head = document.head
           if head != nil:
@@ -375,6 +375,8 @@ proc applyRules(document: Document, ua, user: CSSStylesheet, cachedTree: StyledN
               let sheets = head.sheets()
               for sheet in sheets:
                 styledChild.sheets.add(sheet.applyMediaQuery())
+            else:
+              styledChild.sheets = cachedChild.sheets
         else:
           let sheets = elem.sheets()
           if sheets.len > 0: