Better parsing of <style>, enhanced support of @supports, SVG embedded images fix #641
Merged
poire-z merged 4 commits intokoreader:masterfrom Dec 8, 2025
Merged
Better parsing of <style>, enhanced support of @supports, SVG embedded images fix #641poire-z merged 4 commits intokoreader:masterfrom
<style>, enhanced support of @supports, SVG embedded images fix #641poire-z merged 4 commits intokoreader:masterfrom
Conversation
It doesn't seem to be necessary to set usingHarfbuzz on the first font met: the variable doesn't change, and when it's checked, there is always a valid font.
Handle content as text, but don't stop just at any '<', only at '</style>', as <style> may contain tags. Not doing that might stop embedded styles parsing prematurously, and put some of it as content text. Similarly to how we did it for <script> in 997a9a8.
We failed parsing "@supports selector(a > b)", moreover ignoring a bunch of valid CSS that follows (until we meet any '))'). Handle better the few specified functionnal syntax elements: - @supports selector(a > b): actually checking the selector - @supports font-tech(...): we don't support any - @supports font-format(...): what we support - @supports at-rule(...): what we support (not much) Also avoid crash if we end up with unbalanced closing parens.
Frenzie
approved these changes
Dec 7, 2025
This was referenced Dec 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
text: simplify measureText()'s harfbuzz check
It doesn't seem to be necessary to set usingHarfbuzz on the first font met: the variable doesn't change, and when it's checked, there is always a valid font.
Cherry-picked 3rd commit from unmerged #574 (this one just because it's some forgotten cleanup of my code).
SVG embedded images: handle %-encoded urls
Should allow closing koreader/koreader#13209.
XML parsing: slightly better parsing of <style>
Handle content as text, but don't stop just at any
<, only at</style>, as<style>may contain tags.Not doing that might stop embedded styles parsing prematurously, and put some of it as content text.
Similarly to how we did it for
<script>in 997a9a8.Should allow closing koreader/koreader#12931.
Noticed also at koreader/koreader#14686 (comment) - explained at the bottom of koreader/koreader#14686 (comment).
CSS: improve support of
@supportsWe failed parsing
@supports selector(a > b), moreover ignoring a bunch of valid CSS that follows (until we meet any))).Handle better the few specified functionnal syntax elements:
@supports selector(a > b): actually checking the selector@supports font-tech(...): we don't support any@supports font-format(...): what we support@supports at-rule(...): what we support (not much)Also avoid crash if we end up with unbalanced closing parens.
See about this crash at koreader/koreader#14686 (comment) and followups.
This change is