Skip to content

Modify svgom-api to be compatible with Houdini's Typed OM #3

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 2 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions cssom-api/src/main/java/org/w3c/css/om/CSSRule.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
/*
* Interfaces defined by CSS Typed Object Model draft
* (https://www.w3.org/TR/css-typed-om-1/).
* Copyright © 2018-2023 W3C® (MIT, ERCIM, Keio, Beihang).
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*/
/*
* SPDX-License-Identifier: W3C-20150513
*/
package org.w3c.css.om;
/*
* This software extends interfaces defined by CSS Object Model draft
* (https://www.w3.org/TR/cssom-1/).
Expand All @@ -17,6 +7,7 @@
/*
* SPDX-License-Identifier: W3C-20150513
*/
package org.w3c.css.om;

/**
* A CSS rule.
Expand Down
34 changes: 33 additions & 1 deletion cssom-api/src/main/java/org/w3c/css/om/CSSStyleDeclaration.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@

import org.w3c.css.om.typed.CSSStyleValue;
import org.w3c.dom.DOMException;
import org.w3c.dom.css.CSSValue;

/**
* CSS style declaration.
*/
public interface CSSStyleDeclaration {
public interface CSSStyleDeclaration extends org.w3c.dom.css.CSSStyleDeclaration {

/**
* A parsable serialization of the declaration.
*
* @return the textual representation of the declaration.
*/
@Override
String getCssText();

/**
Expand All @@ -31,6 +33,7 @@ public interface CSSStyleDeclaration {
*
* @param cssText the serialized style declaration.
*/
@Override
void setCssText(String cssText) throws DOMException;

/**
Expand All @@ -40,6 +43,7 @@ public interface CSSStyleDeclaration {
* @return the value of the removed property, or the empty string if that
* property was not explicitly set in this declaration.
*/
@Override
String removeProperty(String propertyName) throws DOMException;

/**
Expand All @@ -48,6 +52,7 @@ public interface CSSStyleDeclaration {
* @param propertyName the name of the property.
* @return the priority string, or the empty string if no priority was set.
*/
@Override
String getPropertyPriority(String propertyName);

/**
Expand All @@ -57,13 +62,15 @@ public interface CSSStyleDeclaration {
* @param value the property value.
* @param priority the priority.
*/
@Override
void setProperty(String propertyName, String value, String priority) throws DOMException;

/**
* The number of properties in this declaration.
*
* @return the number of properties in this declaration.
*/
@Override
int getLength();

/**
Expand All @@ -74,8 +81,31 @@ public interface CSSStyleDeclaration {
* less than zero, or greater or equal to the length of this
* declaration.
*/
@Override
String item(int index);

/**
* Gives the legacy object representation of the value of a CSS property if it
* has been explicitly set within this declaration block.
* <p>
* This method returns <code>null</code> if the property is a shorthand
* property. Shorthand property values can only be accessed and modified as
* strings, using the <code>getPropertyValue</code> and <code>setProperty</code>
* methods.
* </p>
*
* @param propertyName The name of the CSS property.
* @return the value of the property if it has been explicitly set for this
* declaration block. Returns <code>null</code> if the property has not
* been set, or the implementation does not support legacy object
* values.
*/
@SuppressWarnings("exports")
@Override
default CSSValue getPropertyCSSValue(String propertyName) {
return null;
}

/**
* Gets the object representation of the value of a CSS property if it has been
* explicitly set for this declaration block.
Expand Down Expand Up @@ -109,6 +139,7 @@ default CSSStyleValue getCSSStyleValue(String propertyName) {
* block, or the empty string if the property has not been set or is a shorthand
* that could not be serialized.
*/
@Override
String getPropertyValue(String propertyName);

/**
Expand All @@ -117,6 +148,7 @@ default CSSStyleValue getCSSStyleValue(String propertyName) {
* @return the CSS rule that contains this declaration block or <code>null</code> if this
* <code>CSSStyleDeclaration</code> is not attached to a <code>CSSRule</code>.
*/
@Override
CSSRule getParentRule();

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ enum CSSNumericBaseType {
flex,
/** &lt;percentage&gt; */
percent
};
}

/**
* A "map" from types to powers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public interface CSSStyleValue {
*
* @return a parsable representation of this value.
*/
@Override
String toString();

}
1 change: 1 addition & 0 deletions svgom-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {

dependencies {
api project(':smil-api')
api project(':cssom-api')
}

description = 'io.sf.carte:svgom-api'
Expand Down
11 changes: 7 additions & 4 deletions svgom-api/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
* [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
*
* Later modifications:
* Copyright (c) 2020-2021 Carlos Amengual
* Copyright (c) 2020-2024 Carlos Amengual
*/

/**
* Scalable Vector Graphics (SVG) Java binding.
* <p>
* This is a Java binding for an old version of the SVG DOM API (SVGOM). It is
* compatible with the SVGOM API used by Apache Batik (which uses the SVGOM
* packages at the <a href=
* compatible with modern Typed OM but also with the legacy SVGOM API used by
* Apache Batik (which uses the SVGOM packages at the <a href=
* "http://archive.apache.org/dist/xml/commons/xml-commons-external-1.3.04-src.zip">{@code xml-apis-ext-1.3.04}</a>
* package), that seem to be a mixture of the
* <a href="http://www.w3.org/TR/2000/CR-SVG-20000802/java-binding.zip">SVG
Expand All @@ -28,12 +28,15 @@
* </p>
* <p>
* Some method signatures were modified so they match the implementations in
* Apache Batik/EchoSVG.
* Apache Batik.
* </p>
*/
module org.w3c.dom.svg {

exports org.w3c.dom.svg;

requires transitive jdk.xml.dom;
requires transitive org.w3c.dom.smil;
requires transitive org.w3c.css.om;

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
import org.w3c.dom.DOMException;

public interface GetSVGDocument {
public SVGDocument getSVGDocument() throws DOMException;
SVGDocument getSVGDocument() throws DOMException;
}
2 changes: 1 addition & 1 deletion svgom-api/src/main/java/org/w3c/dom/svg/SVGAElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@

public interface SVGAElement extends SVGElement, SVGURIReference, SVGTests, SVGLangSpace, SVGExternalResourcesRequired,
SVGStylable, SVGTransformable, EventTarget {
public SVGAnimatedString getTarget();
SVGAnimatedString getTarget();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
import org.w3c.dom.DOMException;

public interface SVGAltGlyphElement extends SVGTextPositioningElement, SVGURIReference {
public String getGlyphRef();
String getGlyphRef();

public void setGlyphRef(String glyphRef) throws DOMException;
void setGlyphRef(String glyphRef) throws DOMException;

public String getFormat();
String getFormat();

public void setFormat(String format) throws DOMException;
void setFormat(String format) throws DOMException;
}
28 changes: 14 additions & 14 deletions svgom-api/src/main/java/org/w3c/dom/svg/SVGAngle.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@

public interface SVGAngle {
// Angle Unit Types
public static final short SVG_ANGLETYPE_UNKNOWN = 0;
public static final short SVG_ANGLETYPE_UNSPECIFIED = 1;
public static final short SVG_ANGLETYPE_DEG = 2;
public static final short SVG_ANGLETYPE_RAD = 3;
public static final short SVG_ANGLETYPE_GRAD = 4;
short SVG_ANGLETYPE_UNKNOWN = 0;
short SVG_ANGLETYPE_UNSPECIFIED = 1;
short SVG_ANGLETYPE_DEG = 2;
short SVG_ANGLETYPE_RAD = 3;
short SVG_ANGLETYPE_GRAD = 4;

public short getUnitType();
short getUnitType();

public float getValue();
float getValue();

public void setValue(float value) throws DOMException;
void setValue(float value) throws DOMException;

public float getValueInSpecifiedUnits();
float getValueInSpecifiedUnits();

public void setValueInSpecifiedUnits(float valueInSpecifiedUnits) throws DOMException;
void setValueInSpecifiedUnits(float valueInSpecifiedUnits) throws DOMException;

public String getValueAsString();
String getValueAsString();

public void setValueAsString(String valueAsString) throws DOMException;
void setValueAsString(String valueAsString) throws DOMException;

public void newValueSpecifiedUnits(short unitType, float valueInSpecifiedUnits);
void newValueSpecifiedUnits(short unitType, float valueInSpecifiedUnits);

public void convertToSpecifiedUnits(short unitType);
void convertToSpecifiedUnits(short unitType);
}
4 changes: 2 additions & 2 deletions svgom-api/src/main/java/org/w3c/dom/svg/SVGAnimatedAngle.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
package org.w3c.dom.svg;

public interface SVGAnimatedAngle {
public SVGAngle getBaseVal();
SVGAngle getBaseVal();

public SVGAngle getAnimVal();
SVGAngle getAnimVal();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import org.w3c.dom.DOMException;

public interface SVGAnimatedBoolean {
public boolean getBaseVal();
boolean getBaseVal();

public void setBaseVal(boolean baseVal) throws DOMException;
void setBaseVal(boolean baseVal) throws DOMException;

public boolean getAnimVal();
boolean getAnimVal();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import org.w3c.dom.DOMException;

public interface SVGAnimatedEnumeration {
public short getBaseVal();
short getBaseVal();

public void setBaseVal(short baseVal) throws DOMException;
void setBaseVal(short baseVal) throws DOMException;

public short getAnimVal();
short getAnimVal();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import org.w3c.dom.DOMException;

public interface SVGAnimatedInteger {
public int getBaseVal();
int getBaseVal();

public void setBaseVal(int baseVal) throws DOMException;
void setBaseVal(int baseVal) throws DOMException;

public int getAnimVal();
int getAnimVal();
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
package org.w3c.dom.svg;

public interface SVGAnimatedLength {
public SVGLength getBaseVal();
SVGLength getBaseVal();

public SVGLength getAnimVal();
SVGLength getAnimVal();
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
package org.w3c.dom.svg;

public interface SVGAnimatedLengthList {
public SVGLengthList getBaseVal();
SVGLengthList getBaseVal();

public SVGLengthList getAnimVal();
SVGLengthList getAnimVal();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import org.w3c.dom.DOMException;

public interface SVGAnimatedNumber {
public float getBaseVal();
float getBaseVal();

public void setBaseVal(float baseVal) throws DOMException;
void setBaseVal(float baseVal) throws DOMException;

public float getAnimVal();
float getAnimVal();
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
package org.w3c.dom.svg;

public interface SVGAnimatedNumberList {
public SVGNumberList getBaseVal();
SVGNumberList getBaseVal();

public SVGNumberList getAnimVal();
SVGNumberList getAnimVal();
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public interface SVGAnimatedPathData {
*
* @return the base contents of the {@code d} attribute.
*/
public SVGPathSegList getPathSegList();
SVGPathSegList getPathSegList();

/**
* Gets the normalized contents of the {@code d} attribute.
Expand Down Expand Up @@ -62,7 +62,7 @@ public interface SVGAnimatedPathData {
*
* @return the normalized contents of the {@code d} attribute.
*/
public SVGPathSegList getNormalizedPathSegList();
SVGPathSegList getNormalizedPathSegList();

/**
* Gets the current animated contents of the {@code d} attribute.
Expand All @@ -77,7 +77,7 @@ public interface SVGAnimatedPathData {
*
* @return the current animated contents of the {@code d} attribute.
*/
public SVGPathSegList getAnimatedPathSegList();
SVGPathSegList getAnimatedPathSegList();

/**
* Gets the normalized current animated contents of the {@code d} attribute.
Expand All @@ -100,6 +100,6 @@ public interface SVGAnimatedPathData {
*
* @return the normalized current animated contents of the {@code d} attribute.
*/
public SVGPathSegList getAnimatedNormalizedPathSegList();
SVGPathSegList getAnimatedNormalizedPathSegList();

}
Loading
Loading