-
Notifications
You must be signed in to change notification settings - Fork 917
Switch SVG loading from the Batik library to JSVG #7941
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2021-2024 Jannis Weis | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
|
|
||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
|
|
||
| --> | ||
|
|
||
| <!-- You may freely edit this file. See harness/README in the NetBeans platform --> | ||
| <!-- for some information on what you could do (e.g. targets to override). --> | ||
| <!-- If you delete this file and reopen the project it will be recreated. --> | ||
| <project name="platform/libs.jsvg" default="build" basedir="."> | ||
| <description>Builds the JSVG library wrapper module.</description> | ||
| <import file="../../nbbuild/templates/projectized.xml"/> | ||
| </project> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| A84D34480044DB51A1448E9C0E32BD284B797288 com.github.weisj:jsvg:1.6.1 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| Name: JSVG | ||
| Version: 1.6.1 | ||
| Description: JSVG - A Java SVG implementation | ||
| License: MIT-jsvg | ||
| Origin: JSVG | ||
| URL: https://github.com/weisJ/jsvg | ||
| Files: jsvg-1.6.1.jar | ||
|
|
||
| MIT License | ||
|
|
||
| Copyright (c) 2021-2024 Jannis Weis | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Manifest-Version: 1.0 | ||
| OpenIDE-Module: org.netbeans.libs.jsvg | ||
| OpenIDE-Module-Implementation-Version: 1 | ||
| OpenIDE-Module-Localizing-Bundle: org/netbeans/libs/jsvg/Bundle.properties | ||
| AutoUpdate-Show-In-Client: false |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| file.reference.jsvg-1.6.1.jar=external/jsvg-1.6.1.jar | ||
| release.external/jsvg-1.6.1.jar=modules/ext/jsvg-1.6.1.jar | ||
|
|
||
| is.autoload=true | ||
| javac.source=1.8 | ||
|
|
||
| nbm.homepage=https://github.com/weisJ/jsvg | ||
| sigtest.gen.fail.on.error=false | ||
| spec.version.base=1.22.0 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
|
|
||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
|
|
||
| --> | ||
| <project xmlns="http://www.netbeans.org/ns/project/1"> | ||
| <type>org.netbeans.modules.apisupport.project</type> | ||
| <configuration> | ||
| <data xmlns="http://www.netbeans.org/ns/nb-module-project/2"> | ||
| <code-name-base>org.netbeans.libs.jsvg</code-name-base> | ||
| <module-dependencies/> | ||
| <public-packages> | ||
| <package>com.github.weisj.jsvg</package> | ||
| <package>com.github.weisj.jsvg.attributes</package> | ||
| <package>com.github.weisj.jsvg.attributes.filter</package> | ||
| <package>com.github.weisj.jsvg.attributes.font</package> | ||
| <package>com.github.weisj.jsvg.attributes.paint</package> | ||
| <package>com.github.weisj.jsvg.attributes.stroke</package> | ||
| <package>com.github.weisj.jsvg.attributes.text</package> | ||
| <package>com.github.weisj.jsvg.geometry</package> | ||
| <package>com.github.weisj.jsvg.geometry.mesh</package> | ||
| <package>com.github.weisj.jsvg.geometry.noise</package> | ||
| <package>com.github.weisj.jsvg.geometry.path</package> | ||
| <package>com.github.weisj.jsvg.geometry.size</package> | ||
| <package>com.github.weisj.jsvg.geometry.util</package> | ||
| <package>com.github.weisj.jsvg.nodes</package> | ||
| <package>com.github.weisj.jsvg.nodes.animation</package> | ||
| <package>com.github.weisj.jsvg.nodes.container</package> | ||
| <package>com.github.weisj.jsvg.nodes.filter</package> | ||
| <package>com.github.weisj.jsvg.nodes.mesh</package> | ||
| <package>com.github.weisj.jsvg.nodes.prototype</package> | ||
| <package>com.github.weisj.jsvg.nodes.prototype.spec</package> | ||
| <package>com.github.weisj.jsvg.nodes.text</package> | ||
| <package>com.github.weisj.jsvg.parser</package> | ||
| <package>com.github.weisj.jsvg.parser.css</package> | ||
| <package>com.github.weisj.jsvg.parser.resources</package> | ||
| <package>com.github.weisj.jsvg.renderer</package> | ||
| <package>com.github.weisj.jsvg.renderer.awt</package> | ||
| <package>com.github.weisj.jsvg.renderer.jdk</package> | ||
| <package>com.github.weisj.jsvg.util</package> | ||
| </public-packages> | ||
| <class-path-extension> | ||
| <runtime-relative-path>ext/jsvg-1.6.1.jar</runtime-relative-path> | ||
| <binary-origin>external/jsvg-1.6.1.jar</binary-origin> | ||
| </class-path-extension> | ||
| </data> | ||
| </configuration> | ||
| </project> |
22 changes: 22 additions & 0 deletions
22
platform/libs.jsvg/src/org/netbeans/libs/jsvg/Bundle.properties
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
|
|
||
| OpenIDE-Module-Name=JSVG Library | ||
| OpenIDE-Module-Short-Description=JSVG Library | ||
| OpenIDE-Module-Long-Description=Contains the JSVG library, for reading and painting SVG files. | ||
| OpenIDE-Module-Display-Category=Libraries |
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
59 changes: 59 additions & 0 deletions
59
platform/openide.util.ui.svg/src/org/openide/util/svg/DenyingElementLoader.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.openide.util.svg; | ||
|
|
||
| import com.github.weisj.jsvg.attributes.AttributeParser; | ||
| import com.github.weisj.jsvg.parser.ElementLoader; | ||
| import com.github.weisj.jsvg.parser.ParsedDocument; | ||
| import java.util.Collections; | ||
| import java.util.LinkedHashSet; | ||
| import java.util.Set; | ||
|
|
||
| class DenyingElementLoader implements ElementLoader { | ||
| private final Set<String> attemptedExternalURLsLoaded = new LinkedHashSet<>(); | ||
|
|
||
| public Set<String> getAttemptedExternalURLsLoaded() { | ||
| return Collections.unmodifiableSet(attemptedExternalURLsLoaded); | ||
| } | ||
|
|
||
| @Override | ||
| public <T> T loadElement(Class<T> type, String value, | ||
| ParsedDocument document, AttributeParser attributeParser) | ||
| { | ||
| /* Same logic as in com.github.weisj.jsvg.parser.DefaultElementLoader for the | ||
| AllowExternalResources.DENY case, but gathering up the attempted externally loaded URLs so | ||
| we can make the whole loading operation fail and make testLoadImageWithExternalUseXlinkHref | ||
| pass. */ | ||
| String url = attributeParser.parseUrl(value); | ||
| if (url == null) { | ||
| return null; | ||
| } | ||
| if (url.contains("#")) { | ||
| String[] parts = url.split("#", 2); | ||
| String name = parts[0]; | ||
| if (!name.isEmpty()) { | ||
| attemptedExternalURLsLoaded.add(value); | ||
| return null; | ||
| } | ||
| return document.getElementById(type, parts[1]); | ||
| } else { | ||
| return document.getElementById(type, url); | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.