Skip to content

Commit c128033

Browse files
committed
CSS Typed OM Java binding, initial draft
1 parent c448355 commit c128033

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2394
-0
lines changed

cssom-api/build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
plugins {
2+
id 'web-apis.java-conventions'
3+
}
4+
5+
description = 'io.sf.carte:cssom-api'
6+
7+
version = '0.1'
8+
9+
publishing.publications.maven(MavenPublication).pom {
10+
description = "CSS OM 1.0-pre API Java binding"
11+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) 2018-2023 World Wide Web Consortium,
3+
*
4+
* (Massachusetts Institute of Technology, European Research Consortium for
5+
* Informatics and Mathematics, Keio University). All Rights Reserved. This
6+
* work is distributed under the W3C(r) Software License [1] in the hope that
7+
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
8+
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9+
*
10+
* [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
11+
*
12+
* Other copyrights:
13+
* Copyright (c) 2020-2024, Carlos Amengual
14+
*/
15+
16+
/**
17+
* CSS Typed OM Java binding.
18+
*/
19+
module org.w3c.css.om {
20+
21+
exports org.w3c.api;
22+
exports org.w3c.css.om;
23+
exports org.w3c.css.om.typed;
24+
exports org.w3c.css.om.unit;
25+
exports org.w3c.css.om.view;
26+
27+
requires jdk.xml.dom;
28+
requires transitive java.xml;
29+
30+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Interfaces defined by CSS Typed Object Model draft
3+
* (https://www.w3.org/TR/css-typed-om-1/).
4+
* Copyright © 2018-2023 W3C® (MIT, ERCIM, Keio, Beihang).
5+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
6+
*/
7+
/*
8+
* SPDX-License-Identifier: W3C-20150513
9+
*/
10+
package org.w3c.api;
11+
12+
import org.w3c.dom.DOMException;
13+
14+
/**
15+
* Abstract DOM exception in Web APIs.
16+
*/
17+
public class AbstractDOMException extends DOMException {
18+
19+
private static final long serialVersionUID = 1L;
20+
21+
protected AbstractDOMException(short code, String message) {
22+
super(code, message);
23+
}
24+
25+
protected AbstractDOMException(short code, Throwable cause) {
26+
super(code, null);
27+
initCause(cause);
28+
}
29+
30+
protected AbstractDOMException(short code, String message, Throwable cause) {
31+
super(code, message);
32+
initCause(cause);
33+
}
34+
35+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Interfaces defined by CSS Typed Object Model draft
3+
* (https://www.w3.org/TR/css-typed-om-1/).
4+
* Copyright © 2018-2023 W3C® (MIT, ERCIM, Keio, Beihang).
5+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
6+
*/
7+
/*
8+
* SPDX-License-Identifier: W3C-20150513
9+
*/
10+
package org.w3c.api;
11+
12+
import org.w3c.dom.DOMException;
13+
14+
/**
15+
* Syntax exception in Web APIs.
16+
*/
17+
public class DOMSyntaxException extends AbstractDOMException {
18+
19+
private static final long serialVersionUID = 1L;
20+
21+
public DOMSyntaxException(String message) {
22+
super(DOMException.SYNTAX_ERR, message);
23+
}
24+
25+
public DOMSyntaxException(Throwable cause) {
26+
super(DOMException.SYNTAX_ERR, cause);
27+
}
28+
29+
public DOMSyntaxException(String message, Throwable cause) {
30+
super(DOMException.SYNTAX_ERR, message, cause);
31+
}
32+
33+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Interfaces defined by CSS Typed Object Model draft
3+
* (https://www.w3.org/TR/css-typed-om-1/).
4+
* Copyright © 2018-2023 W3C® (MIT, ERCIM, Keio, Beihang).
5+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
6+
*/
7+
/*
8+
* SPDX-License-Identifier: W3C-20150513
9+
*/
10+
package org.w3c.api;
11+
12+
import org.w3c.dom.DOMException;
13+
14+
/**
15+
* Type exception in Web APIs.
16+
*/
17+
public class DOMTypeException extends AbstractDOMException {
18+
19+
private static final long serialVersionUID = 1L;
20+
21+
public DOMTypeException(String message) {
22+
super(DOMException.TYPE_MISMATCH_ERR, message);
23+
}
24+
25+
public DOMTypeException(Throwable cause) {
26+
super(DOMException.TYPE_MISMATCH_ERR, cause);
27+
}
28+
29+
public DOMTypeException(String message, Throwable cause) {
30+
super(DOMException.TYPE_MISMATCH_ERR, message);
31+
}
32+
33+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Classes used by all the W3C APIs.
3+
*/
4+
package org.w3c.api;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* This software extends interfaces defined by CSS Conditional Rules Module Level 3
3+
* (https://www.w3.org/TR/css3-conditional/).
4+
* Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang).
5+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
6+
*/
7+
/*
8+
* SPDX-License-Identifier: W3C-20150513
9+
*/
10+
11+
package org.w3c.css.om;
12+
13+
import org.w3c.dom.DOMException;
14+
15+
/**
16+
* Represents all the "conditional" at-rules, which consist of a condition and a statement
17+
* block.
18+
*/
19+
public interface CSSConditionRule extends CSSGroupingRule {
20+
21+
/**
22+
* Gets the serialization of the condition of this rule.
23+
*
24+
* @return the serialization of the condition of this rule.
25+
*/
26+
String getConditionText();
27+
28+
/**
29+
* Sets the condition associated to this rule.
30+
*
31+
* @param conditionText
32+
* the condition text.
33+
* @throws DOMException if the condition could not be parsed.
34+
*/
35+
void setConditionText(String conditionText) throws DOMException;
36+
37+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* This software includes interfaces defined by CSS Counter Styles Level 3
3+
* (https://www.w3.org/TR/css-counter-styles-3/).
4+
* Copyright © 2017 W3C® (MIT, ERCIM, Keio, Beihang).
5+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
6+
*/
7+
/*
8+
* SPDX-License-Identifier: W3C-20150513
9+
*/
10+
11+
package org.w3c.css.om;
12+
13+
/**
14+
* Counter-style rule. @see <a href="https://www.w3.org/TR/css-counter-styles-3/">CSS Counter Styles Level 3</a>.
15+
*/
16+
public interface CSSCounterStyleRule extends CSSRule {
17+
18+
/**
19+
* Gets the counter-style name.
20+
*
21+
* @return the counter-style name.
22+
*/
23+
String getName();
24+
25+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* This software extends interfaces defined by CSS Object Model draft
3+
* (https://www.w3.org/TR/cssom-1/).
4+
* Copyright © 2016 W3C® (MIT, ERCIM, Keio, Beihang).
5+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
6+
*/
7+
/*
8+
* SPDX-License-Identifier: W3C-20150513
9+
*/
10+
11+
package org.w3c.css.om;
12+
13+
/**
14+
* A CSS font-face rule.
15+
*
16+
*/
17+
public interface CSSFontFaceRule extends CSSRule {
18+
19+
/**
20+
* Get the style that is declared by this rule.
21+
*
22+
* @return the style declaration.
23+
*/
24+
CSSStyleDeclaration getStyle();
25+
26+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* This software extends interfaces defined by CSS Conditional Rules Module Level 3
3+
* (https://www.w3.org/TR/css3-conditional/).
4+
* Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang).
5+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
6+
*/
7+
/*
8+
* SPDX-License-Identifier: W3C-20150513
9+
*/
10+
11+
package org.w3c.css.om;
12+
13+
import org.w3c.dom.DOMException;
14+
15+
/**
16+
* Represents an at-rule that contains other rules nested inside itself.
17+
*/
18+
public interface CSSGroupingRule extends CSSRule {
19+
20+
/**
21+
* Get the list of CSS rules nested inside the grouping rule.
22+
*
23+
* @return a CSSRuleList object for the list of CSS rules nested inside the grouping rule.
24+
*/
25+
CSSRuleList getCssRules();
26+
27+
/**
28+
* Inserts a new rule into this grouping rule collection.
29+
*
30+
* @param rule
31+
* The parsable text representing the rule.
32+
* @param index
33+
* The index within the collection of the rule before which to insert the
34+
* specified rule. If the specified index is equal to the length of the rule
35+
* collection, the rule will be added to its end.
36+
* @return the index at which the rule was inserted.
37+
* @throws DOMException
38+
* if the index is out of bounds or there was a problem parsing the rule.
39+
*/
40+
int insertRule(String rule, int index) throws DOMException;
41+
42+
/**
43+
* Removes a CSS rule from the CSS rule list returned by {@link #getCssRules()} at
44+
* <code>index</code>.
45+
*
46+
* @param index the rule list index at which the rule must be removed.
47+
* @throws DOMException
48+
* INDEX_SIZE_ERR if <code>index</code> is greater than or equal to
49+
* {@link #getCssRules()}.getLength().
50+
*/
51+
void deleteRule(int index) throws DOMException;
52+
53+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* This software extends interfaces defined by CSS Animations Level 1
3+
* (https://drafts.csswg.org/css-animations/).
4+
* Copyright © 2018 W3C® (MIT, ERCIM, Keio, Beihang).
5+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
6+
*/
7+
/*
8+
* SPDX-License-Identifier: W3C-20150513
9+
*/
10+
11+
package org.w3c.css.om;
12+
13+
/**
14+
* The CSSKeyframeRule interface represents the style rule for a single key.
15+
*
16+
*/
17+
public interface CSSKeyframeRule extends CSSRule {
18+
19+
/**
20+
* Gets the keyframe selector as a comma-separated list of percentage values.
21+
*
22+
* @return the keyframe selector.
23+
*/
24+
String getKeyText();
25+
26+
/**
27+
* Get the style that is declared by this rule.
28+
*
29+
* @return the style declaration.
30+
*/
31+
CSSStyleDeclaration getStyle();
32+
33+
}

0 commit comments

Comments
 (0)