Skip to content

Commit 192f994

Browse files
committed
1 parent 1153935 commit 192f994

File tree

6 files changed

+249
-195
lines changed

6 files changed

+249
-195
lines changed

org/w3c/css/properties/CSS3SVGProperties.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ color-profile: org.w3c.css.properties.svg.CssColorProfi
2929

3030
@color-profile.rendering-intent org.w3c.css.properties.svg.colorprofile.CssRenderingIntent
3131
@color-profile.name org.w3c.css.properties.svg.colorprofile.CssName
32+
@color-profile.src org.w3c.css.properties.svg.colorprofile.CssSrc
3233

3334

3435

org/w3c/css/properties/SVGProperties.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ fill: org.w3c.css.properties.svg.CssFill
6060
font-size: org.w3c.css.properties.css21.CssFontSize
6161
solid-color: org.w3c.css.properties.svg.SolidColor
6262
solid-opacity: org.w3c.css.properties.svg.SolidOpacity
63-
@color-profile.rendering-intent org.w3c.css.properties.svg.colorprofile.CssRenderingIntent
6463
@color-profile.name org.w3c.css.properties.svg.colorprofile.CssName
64+
@color-profile.rendering-intent org.w3c.css.properties.svg.colorprofile.CssRenderingIntent
65+
@color-profile.src org.w3c.css.properties.svg.colorprofile.CssSrc
6566

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
//
2+
// Author: Yves Lafon <ylafon@w3.org>
3+
//
4+
// (c) COPYRIGHT MIT, ERCIM, Keio, Beihang, 2016.
5+
// Please first read the full copyright statement in file COPYRIGHT.html
6+
package org.w3c.css.properties.css.colorprofile;
7+
8+
import org.w3c.css.parser.CssStyle;
9+
import org.w3c.css.properties.css.CssProperty;
10+
import org.w3c.css.properties.svg.SVGStyle;
11+
import org.w3c.css.util.ApplContext;
12+
import org.w3c.css.util.InvalidParamException;
13+
import org.w3c.css.values.CssExpression;
14+
import org.w3c.css.values.CssValue;
15+
16+
/**
17+
* @since SVG
18+
*/
19+
public class CssSrc extends CssProperty {
20+
21+
public CssValue value;
22+
23+
/**
24+
* Create a new CssSrc
25+
*/
26+
public CssSrc() {
27+
}
28+
29+
/**
30+
* Creates a new CssSrc
31+
*
32+
* @param expression The expression for this property
33+
* @throws org.w3c.css.util.InvalidParamException
34+
* Expressions are incorrect
35+
*/
36+
public CssSrc(ApplContext ac, CssExpression expression, boolean check)
37+
throws InvalidParamException {
38+
throw new InvalidParamException("value",
39+
expression.getValue().toString(),
40+
getPropertyName(), ac);
41+
}
42+
43+
public CssSrc(ApplContext ac, CssExpression expression)
44+
throws InvalidParamException {
45+
this(ac, expression, false);
46+
}
47+
48+
/**
49+
* Returns the value of this property
50+
*/
51+
public Object get() {
52+
return value;
53+
}
54+
55+
56+
/**
57+
* Returns the name of this property
58+
*/
59+
public final String getPropertyName() {
60+
return "src";
61+
}
62+
63+
/**
64+
* Returns true if this property is "softly" inherited
65+
* e.g. his value is equals to inherit
66+
*/
67+
public boolean isSoftlyInherited() {
68+
return value.equals(inherit);
69+
}
70+
71+
/**
72+
* Returns a string representation of the object.
73+
*/
74+
public String toString() {
75+
return value.toString();
76+
}
77+
78+
/**
79+
* Add this property to the CssStyle.
80+
*
81+
* @param style The CssStyle
82+
*/
83+
public void addToStyle(ApplContext ac, CssStyle style) {
84+
SVGStyle s = (SVGStyle) style;
85+
if (s.colorProfileCssSrc != null) {
86+
style.addRedefinitionWarning(ac, this);
87+
}
88+
s.colorProfileCssSrc = this;
89+
}
90+
91+
92+
/**
93+
* Compares two properties for equality.
94+
*
95+
* @param property The other property.
96+
*/
97+
public boolean equals(CssProperty property) {
98+
return (property instanceof CssSrc &&
99+
value.equals(((CssSrc) property).value));
100+
}
101+
102+
103+
/**
104+
* Get this property in the style.
105+
*
106+
* @param style The style where the property is
107+
* @param resolve if true, resolve the style to find this property
108+
*/
109+
public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
110+
if (resolve) {
111+
return ((SVGStyle) style).getColorProfileSrc();
112+
} else {
113+
return ((SVGStyle) style).colorProfileCssSrc;
114+
}
115+
}
116+
}
117+

org/w3c/css/properties/svg/ColorProfileSrc.java

Lines changed: 0 additions & 185 deletions
This file was deleted.

org/w3c/css/properties/svg/SVGStyle.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414
import org.w3c.css.properties.css.CssMarkerStart;
1515
import org.w3c.css.properties.css.colorprofile.CssName;
1616
import org.w3c.css.properties.css.colorprofile.CssRenderingIntent;
17+
import org.w3c.css.properties.css.colorprofile.CssSrc;
1718

1819
public class SVGStyle extends SVGBasicStyle {
1920

20-
public
21-
ColorProfileSrc cpSrc;
22-
2321
public CssMarkerStart cssMarkerStart;
2422
public CssMarkerMid cssMarkerMid;
2523
public CssMarkerEnd cssMarkerEnd;
@@ -28,7 +26,10 @@ public class SVGStyle extends SVGBasicStyle {
2826
// @color-profile
2927
public CssRenderingIntent colorProfileCssRenderingIntent;
3028
public CssName colorProfileCssName;
29+
public CssSrc colorProfileCssSrc;
3130

31+
32+
3233
public CssMarkerStart getMarkerStart() {
3334
if (cssMarkerStart == null) {
3435
cssMarkerStart = (CssMarkerStart) style.CascadingOrder(new CssMarkerStart(),
@@ -79,12 +80,11 @@ public CssName getColorProfileName() {
7980
return colorProfileCssName;
8081
}
8182

82-
public ColorProfileSrc getColorProfileSrc() {
83-
if (cpSrc == null) {
84-
cpSrc =
85-
(ColorProfileSrc) style.CascadingOrder(
86-
new ColorProfileSrc(), style, selector);
83+
public CssSrc getColorProfileSrc() {
84+
if (colorProfileCssSrc == null) {
85+
colorProfileCssSrc = (CssSrc) style.CascadingOrder(new CssSrc(),
86+
style, selector);
8787
}
88-
return cpSrc;
88+
return colorProfileCssSrc;
8989
}
9090
}

0 commit comments

Comments
 (0)