Fix percentage based stroke-width in SVG shapes upon viewbox change #51652
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.
When svg elements are rendered with relative (percentage based)
stroke-width, it isn't being recalculated on viewbox change.
This poses an issue when the size of the viewbox changes such that
the size of new viewbox differs from the original viewbox. In this
scenario, the paint isn't invalidated and thus stroke is scaled
wrongly and not adjusting well with the viewport.
We have implemented a
bool ComputeHasRelativeLengths()
and used itin the LayoutSVGShape such that it uses the stroke-width data to
determine if the current SVG element Layout has relative values and
uses the same to trigger paint recalculation upon viewbox update.
Bug: 384605094
Change-Id: I095c3d927af99e2b9ff1bf4acf086b61ed6d980a
Reviewed-on: https://chromium-review.googlesource.com/6388735
WPT-Export-Revision: a9f610f06742e4a79234265e8b348ac52f25a1dc