Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix percentage based stroke-width in SVG shapes upon viewbox change #51652

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Mar 27, 2025

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 it
in 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

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 it
in 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant