Skip to content

Instanceof Check Before Cast #387

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

Closed

Conversation

RichardCox09
Copy link

I tested it on the following example:

#foo {border-width: 0; image-rendering: auto; vertical-align: bottom; }

Without setting the ApplContext to css3svg, the image-rendring: auto; property is a CSS3Style. That will be tried to be cast to SVGBasicStyle without even checking if that's possible. This caused ClassCastException.

Can be recreated on the online validator too, if you set the options from CSS3 + SVG to only CSS3.

@ylafon
Copy link
Member

ylafon commented Nov 10, 2022

Thanks for this, however the issue is that the old inheritance tree is no longer the right one, and it is part of the few properties that have not been fixed properly.

ylafon added a commit that referenced this pull request Nov 10, 2022
As SVGTinyStyle inherit from CSS3 and as image-rendering is present in CSS3
it is better to define it in Css3Style, and move all the casts from SVGBasicStyle
to Css3Style
@ylafon
Copy link
Member

ylafon commented Nov 10, 2022

b7153af fixed it.
Thanks again!

@ylafon ylafon closed this Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants