Improved svg support#118
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #118 +/- ##
==========================================
+ Coverage 78.79% 78.91% +0.11%
==========================================
Files 627 628 +1
Lines 61533 61870 +337
==========================================
+ Hits 48487 48823 +336
- Misses 13046 13047 +1
... and 10 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
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.
This pull request introduces a range of improvements and fixes to the SVG parsing and rendering code, with a focus on more accurate style inheritance, improved handling of SVG attributes (such as
preserveAspectRatio,stroke-dasharray, andstroke-miterlimit), and a significant refactor of SVG filter primitive support. The changes also include bug fixes in XML entity handling and bounds calculation, as well as enhancements to code clarity and maintainability.The most important changes are:
SVG Style and Attribute Handling Improvements
SVGParser::parseElement, ensuring child elements correctly inherit all relevant style properties from their parents unless explicitly overridden. This includes fill, stroke, opacity, dash array, join/cap, miter limit, and marker/clip attributes.stroke-dasharrayandstroke-dashoffsetparsing in both CSS and attribute styles, with correct handling of the"none"value and negative dash values being ignored. Added astrokeDashArrayNoneflag toSVGElementto track explicit disabling of dashes. [1] [2] [3]stroke-miterlimitinSVGElementfrom a default value tostd::optional, so it is only set if specified, and added support for inheriting it from parent elements. [1] [2]preserveAspectRatioon the root SVG element, including fitting and justification, and storing these inSVGData. [1] [2]SVG Filter Refactor
SVGFilterPrimitiveclass and specific primitives such asSVGFEBlendandSVGFEGaussianBlur, allowing for more extensible and accurate representation of SVG filter chains. TheSVGFilterstruct now contains a list of filter primitives instead of a single blur parameter.SVG Parsing and Calculation Fixes
SVGDocument::calculateBoundsto recursively visit all elements and apply transforms, ensuring accurate document bounds.pointsattributes for polyline and polygon elements by removing empty strings from coordinate arrays. [1] [2]XML Entity Handling Bug Fixes
Code Quality and Maintenance
These changes collectively improve SVG rendering fidelity, code extensibility, and robustness.