about summary refs log tree commit diff stats
path: root/src/css/match.nim
Commit message (Collapse)AuthorAgeFilesLines
* catom: make factory globalbptato2025-02-131-3/+2
| | | | | This isn't great, but neither was passing around a pointer that pointed to a single object.
* Add annotations for move semanticsbptato2025-01-221-6/+7
| | | | | | | | | Supposedly they aren't broken in refc after 2.0.0, so we can do this now that 1.6.14 is dropped. I've confirmed lent to work as advertised; it indeed reduces copies. sink doesn't seem to help much, but I guess it will be useful once we switch to ORC.
* cascade: collapse StyledNode tree into DOMbptato2025-01-201-1/+1
| | | | | We now compute styles on-demand, which is both more efficient and simpler than the convoluted tree diffing logic we previously used.
* dom, stylednode: move more fields, handle pseudo-element getComputedStylebptato2025-01-181-1/+0
|
* dom: DOMTokenList fixes/improvementsbptato2025-01-051-1/+1
|
* dom: standard querySelector/All; type erase childrenbptato2024-12-271-15/+4
|
* match: fix nested hover selectorbptato2024-12-181-1/+2
| | | | | | | I didn't get it right :( true is the default return value, and true + continue should resolve to false.
* match: optimize dependency trackingbptato2024-12-171-36/+72
| | | | | | | | | | | | | | | | | | | This is a bit tricky, but it seems to work. It optimizes selectors in the line of "div :hover" (note the space.) Previously such selectors would add a hover dependency to pretty much every element, and trigger a re-style for all elements that changed their hover status. After this patch, when :hover and friends would return false, they first try to match the element *without* pseudo selectors, and only add their dependencies if the element would match like that. (Notably, it only does this for when :hover is false. Probably it would help somewhat if we checked for the opposite with true too, but I'm not sure how much. For now, I'll keep it like this, and maybe try to further optimize it later.)
* css: add :target pseudo classbptato2024-12-171-0/+3
|
* match: refactor a bitbptato2024-12-171-62/+46
| | | | | Now we use the node index to optimize next/subsequent sibling combinators.
* dom, match: optimize :nth-child, :nth-last-childbptato2024-12-171-33/+42
| | | | | | I want to use it in the UA sheet, so the loop won't cut it. (Also fix a parsing bug that prevented "of" from working.)
* dom, css: fix case-insensitive class/id/attr matchingbptato2024-12-151-2/+6
| | | | Uses an additional lower-case map for O(1) case-insensitive comparisons.
* css: align h[1-6] behavior with w3mbptato2024-12-141-0/+2
| | | | | | | | | | | Implemented using proprietary selectors -cha-first-node and -cha-last-node, modeled after -moz-first-node and -moz-last-node. I think they are compatible. That does mean this is more limited than w3m's trimming, e.g. it can't really deal with nesting or empty tags. I think this is fine, as it's mainly meant for unstyled documents in the first place (which are unlikely to have e.g. MAIN tags).
* buffer: optimize hover switchingbptato2024-11-261-0/+6
| | | | | Fixed a bug that would lead to styles unnecessarily being recalculated if the root element had a :hover dependency.
* match, stylednode: remove generics, refactorbptato2024-11-191-91/+71
| | | | | | Turns out the generics weren't really needed in the first place. Also, StyledNode is now 16 bytes smaller.
* Clean up forward declarations a bitbptato2024-10-271-2/+2
|
* dom: html -> documentElementbptato2024-10-101-1/+1
| | | | it's effectively a dupe, except html wouldn't work in XML
* dom, match, event: small cleanupbptato2024-07-171-6/+6
|
* misc cleanupsbptato2024-06-221-2/+1
|
* stylednode: move invalidation data to DOMbptato2024-05-271-3/+3
| | | | this way, we do not refer to nodes of previous cascade passes
* cssparser: refactorbptato2024-05-011-3/+2
| | | | | | | | | * factor out skipWhitespace * remove streams dependency (cssparser could never stream without blocking the event loop, so we were just passing a StringStream in all cases, which made the whole streaming pointless.)
* Update code stylebptato2024-04-171-69/+84
| | | | | | * separate params with ; (semicolon) instead of , (colon) * reduce screaming snake case use * wrap long lines
* catom: at -> satbptato2024-03-211-1/+1
| | | | just for consistency
* catom: merge TagType with AttrTypebptato2024-03-041-1/+0
| | | | | it's inefficient and pointless to treat them differently, so just derive a new enum from TagType with a macro
* dom: enumize attribute namesbptato2024-02-081-1/+2
|
* Update chamebptato2024-02-071-5/+4
| | | | | | | | * Update chame to the latest version * Get rid of nodeType usage * Add atoms * Re-implement DOM attributes * document.write
* Use std/* imports everywherebptato2024-01-071-4/+4
|
* css: add case-insensitive matchingbptato2023-12-111-7/+44
| | | | Also case-sensitive, but for now that is the same as normal matching...
* selectorparser: enum-ize relbptato2023-12-091-8/+7
|
* Move HTML parsing into Chamebptato2023-08-151-1/+2
| | | | Operation "modularize Chawan somewhat" part 2
* Fixes & workarounds to compile on Nim 2.0.0bptato2023-08-011-1/+1
| | | | | | | | | | | | | | * Import punycode, as it has been removed from stdlib. * Fix some syntax errors * Apparently you can no longer compare distinct pointers with nil. Add explicit comparisons with typeof(nil) instead. * htmlparser: rename _ to other, as semantics of _ have changed. (Quite a shame, it looked better with _. Oh well.) * Explicitly specify mm:refc, as the browser OOMs with orc for some reason. Confirmed to compile & run on 2.0.0, 1.6.14, 1.6.12, 1.6.10 and 1.6.8. (<1.6.8 it's broken & wontfix.)
* css: handle unknown tag names correctlybptato2023-07-251-0/+2
| | | | | | Instead of grouping all of them into TAG_UNKNOWN, match their tag names. To-do: this implementation is not very efficient.
* css/match: fix next sibling selector (+)bptato2023-02-131-2/+2
|
* WIP selector rewritebptato2023-01-271-86/+69
| | | | pretty slow for some reason
* selectorparser: support :link, :visitedbptato2023-01-011-0/+4
| | | | I say "support", but :visited is never matched.
* css: fix some bugs and improve cascading a bitbptato2022-12-291-0/+2
|
* More DOM workbptato2022-12-191-4/+4
|
* Add JS support to documentsbptato2022-12-181-1/+1
|
* More JS bindingsbptato2022-09-131-4/+6
|
* Fix combinator bugs + reimplement querySelectorAllbptato2022-09-011-77/+31
|
* Fix :nth-last-childbptato2022-08-231-3/+9
|
* Use more accurate selector terminologybptato2022-08-231-3/+3
|
* Fix nth-child bugs, rename select to matchbptato2022-08-231-0/+257