diff options
author | bptato <nincsnevem662@gmail.com> | 2023-06-07 19:30:55 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-06-07 19:30:55 +0200 |
commit | 578df008d0e2e6ac2d8ee2ad84ccf640f8d07c55 (patch) | |
tree | 216e69d75300e241508194b3ed61221e98c5f1c6 /src/buffer | |
parent | 724f196225b5351724f0018b2fc78d744891fb17 (diff) | |
download | chawan-578df008d0e2e6ac2d8ee2ad84ccf640f8d07c55.tar.gz |
Add support for width, height media query
Diffstat (limited to 'src/buffer')
-rw-r--r-- | src/buffer/buffer.nim | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/buffer/buffer.nim b/src/buffer/buffer.nim index 77772532..8775e0e6 100644 --- a/src/buffer/buffer.nim +++ b/src/buffer/buffer.nim @@ -558,7 +558,7 @@ proc loadResource(buffer: Buffer, document: Document, elem: HTMLLinkElement): Em let media = elem.media if media != "": let media = parseMediaQueryList(parseListOfComponentValues(newStringStream(media))) - if not media.applies(): return + if not media.applies(document.window): return return buffer.loader.fetch(newRequest(url)).then(proc(res: Response) = if res.contenttype == "text/css": elem.sheet = parseStylesheet(res.body)) @@ -652,7 +652,8 @@ proc finishLoad(buffer: Buffer): EmptyPromise = buffer.sstream.setPosition(0) buffer.available = 0 if buffer.window == nil: - buffer.window = newWindow(buffer.config.scripting, buffer.selector) + buffer.window = newWindow(buffer.config.scripting, buffer.selector, + buffer.attrs) let doc = parseHTML(buffer.sstream, charsets = buffer.charsets, window = buffer.window, url = buffer.url) buffer.document = doc @@ -745,7 +746,8 @@ proc cancel*(buffer: Buffer): int {.proxy.} = buffer.sstream.setPosition(0) buffer.available = 0 if buffer.window == nil: - buffer.window = newWindow(buffer.config.scripting, buffer.selector) + buffer.window = newWindow(buffer.config.scripting, buffer.selector, + buffer.attrs) buffer.document = parseHTML(buffer.sstream, charsets = buffer.charsets, window = buffer.window, url = buffer.url, canReinterpret = false) @@ -1195,7 +1197,7 @@ proc launchBuffer*(config: BufferConfig, source: BufferSource, buffer.srenderer = newStreamRenderer(buffer.sstream, buffer.charsets) if buffer.config.scripting: buffer.window = newWindow(buffer.config.scripting, buffer.selector, - some(buffer.loader)) + buffer.attrs, some(buffer.loader)) let socks = connectSocketStream(mainproc, false) socks.swrite(getpid()) buffer.pstream = socks |