Skip to content

Commit 3afae29

Browse files
committed
1 parent ee3093c commit 3afae29

File tree

6 files changed

+228
-169
lines changed

6 files changed

+228
-169
lines changed

org/w3c/css/properties/CSS3SVGProperties.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ fill: org.w3c.css.properties.svg.CssFill
2727
stroke: org.w3c.css.properties.svg.CssStroke
2828
color-profile: org.w3c.css.properties.svg.CssColorProfile
2929

30+
@color-profile.rendering-intent org.w3c.css.properties.svg.colorprofile.CssRenderingIntent
31+
32+
3033

3134
# CSS3 Properties
3235
font-style: org.w3c.css.properties.css3.CssFontStyle

org/w3c/css/properties/SVGProperties.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,5 @@ 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
64+
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 CssRenderingIntent extends CssProperty {
20+
21+
public CssValue value;
22+
23+
/**
24+
* Create a new CssStrokeDashoffset
25+
*/
26+
public CssRenderingIntent() {
27+
}
28+
29+
/**
30+
* Creates a new CssStrokeDashoffset
31+
*
32+
* @param expression The expression for this property
33+
* @throws org.w3c.css.util.InvalidParamException
34+
* Expressions are incorrect
35+
*/
36+
public CssRenderingIntent(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 CssRenderingIntent(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 "rendering-intent";
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.colorProfileCssRenderingIntent != null) {
86+
style.addRedefinitionWarning(ac, this);
87+
}
88+
s.colorProfileCssRenderingIntent = 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 CssRenderingIntent &&
99+
value.equals(((CssRenderingIntent) 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).getColorProfileRenderingIntent();
112+
} else {
113+
return ((SVGStyle) style).colorProfileCssRenderingIntent;
114+
}
115+
}
116+
}
117+

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

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

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,22 @@
1212
import org.w3c.css.properties.css.CssMarkerEnd;
1313
import org.w3c.css.properties.css.CssMarkerMid;
1414
import org.w3c.css.properties.css.CssMarkerStart;
15+
import org.w3c.css.properties.css.colorprofile.CssRenderingIntent;
1516

1617
public class SVGStyle extends SVGBasicStyle {
1718

19+
public
1820
ColorProfileSrc cpSrc;
1921
ColorProfileName cpName;
20-
CssRenderIntent cssRenderIntent;
2122

2223
public CssMarkerStart cssMarkerStart;
2324
public CssMarkerMid cssMarkerMid;
2425
public CssMarkerEnd cssMarkerEnd;
2526
public CssMarker cssMarker;
2627

28+
// @color-profile
29+
public CssRenderingIntent colorProfileCssRenderingIntent;
30+
2731
public CssMarkerStart getMarkerStart() {
2832
if (cssMarkerStart == null) {
2933
cssMarkerStart = (CssMarkerStart) style.CascadingOrder(new CssMarkerStart(),
@@ -56,6 +60,16 @@ public CssMarker getMarker() {
5660
return cssMarker;
5761
}
5862

63+
// @color-profile
64+
65+
public CssRenderingIntent getColorProfileRenderingIntent() {
66+
if (colorProfileCssRenderingIntent == null) {
67+
colorProfileCssRenderingIntent = (CssRenderingIntent) style.CascadingOrder(new CssRenderingIntent(),
68+
style, selector);
69+
}
70+
return colorProfileCssRenderingIntent;
71+
}
72+
5973

6074
public ColorProfileSrc getColorProfileSrc() {
6175
if (cpSrc == null) {
@@ -75,13 +89,5 @@ public ColorProfileName getColorProfileName() {
7589
return cpName;
7690
}
7791

78-
public CssRenderIntent getRenderIntent() {
79-
if (cssRenderIntent == null) {
80-
cssRenderIntent =
81-
(CssRenderIntent) style.CascadingOrder(
82-
new CssRenderIntent(), style, selector);
83-
}
84-
return cssRenderIntent;
85-
}
8692

8793
}

0 commit comments

Comments
 (0)