Skip to content

Commit d2d1e3e

Browse files
committed
1 parent ec2bc09 commit d2d1e3e

File tree

9 files changed

+196
-248
lines changed

9 files changed

+196
-248
lines changed

org/w3c/css/properties/CSS3Properties.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@ word-break-wrap: org.w3c.css.properties.css3.CssTextWrap
300300
round-clip: org.w3c.css.properties.css3.CssBackgroundClip
301301

302302
filter: org.w3c.css.properties.css3.CssFilter
303-
color-interoplation-filters: org.w3c.css.properties.css3.CssColorInterpolationFilters
303+
color-interpolation-filters: org.w3c.css.properties.css3.CssColorInterpolationFilters
304+
flood-color: org.w3c.css.properties.css3.CssFloodColor
304305

305306
@page.padding-left: org.w3c.css.properties.css3.CssPaddingLeft
306307
@page.padding-right: org.w3c.css.properties.css3.CssPaddingRight

org/w3c/css/properties/SVGBasicProperties.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ fill-rule: org.w3c.css.properties.svg.FillRule
1818
fill-opacity: org.w3c.css.properties.svg.FillOpacity
1919
filter: org.w3c.css.properties.css3.CssFilter
2020
flood-opacity: org.w3c.css.properties.svg.FloodOpacity
21-
flood-color: org.w3c.css.properties.svg.FloodColor
2221
font: org.w3c.css.properties.css2.CssFont
2322
font-family: org.w3c.css.properties.css2.CssFontFamily
2423
font-size-adjust: org.w3c.css.properties.css2.CssFontSizeAdjust

org/w3c/css/properties/SVGProperties.properties

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

org/w3c/css/properties/css3/CSS3Default.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
opacity.inherited: false
44
color-profile.inherited: true
5+
color-interpolation-filters.inherited: true
6+
filter.inherited: false
7+
flood-color.inherited: false
8+
flood-opacity.inherited: false
9+
lighting-color.inherited: false
510
rendering-intent.inherited: true
611
font-effect.inherited: true
712
font-smooth.inherited: true

org/w3c/css/properties/css3/Css3Style.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import org.w3c.css.properties.css.CssFlexGrow;
5353
import org.w3c.css.properties.css.CssFlexShrink;
5454
import org.w3c.css.properties.css.CssFlexWrap;
55+
import org.w3c.css.properties.css.CssFloodColor;
5556
import org.w3c.css.properties.css.CssFontFeatureSettings;
5657
import org.w3c.css.properties.css.CssFontKerning;
5758
import org.w3c.css.properties.css.CssFontLanguageOverride;
@@ -284,6 +285,7 @@ public class Css3Style extends ATSCStyle {
284285

285286
public CssFilter cssFilter;
286287
public CssColorInterpolationFilters cssColorInterpolationFilters;
288+
public CssFloodColor cssFloodColor;
287289

288290
public org.w3c.css.properties.css.CssBorderImageSource getBorderImageSource() {
289291
if (cssBorder.borderImage.source == null) {
@@ -1589,6 +1591,13 @@ public final CssColorInterpolationFilters getColorInterpolationFilters() {
15891591
}
15901592
return cssColorInterpolationFilters;
15911593
}
1594+
1595+
public final CssFloodColor getFloodColor() {
1596+
if (cssFloodColor == null) {
1597+
cssFloodColor = (CssFloodColor) style.CascadingOrder(new CssFloodColor(), style, selector);
1598+
}
1599+
return cssFloodColor;
1600+
}
15921601
///
15931602

15941603
/**
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// $Id$
2+
// Author: Yves Lafon <ylafon@w3.org>
3+
//
4+
// (c) COPYRIGHT MIT, ERCIM, Keio, Beihang, 2015.
5+
// Please first read the full copyright statement in file COPYRIGHT.html
6+
package org.w3c.css.properties.css3;
7+
8+
import org.w3c.css.util.ApplContext;
9+
import org.w3c.css.util.InvalidParamException;
10+
import org.w3c.css.values.CssExpression;
11+
import org.w3c.css.values.CssValue;
12+
13+
/**
14+
* @spec http://www.w3.org/TR/2014/WD-filter-effects-1-20141125/#FloodColorProperty
15+
*/
16+
public class CssFloodColor extends org.w3c.css.properties.css.CssFloodColor {
17+
18+
/**
19+
* Create a new CssFloodColor
20+
*/
21+
public CssFloodColor() {
22+
value = initial;
23+
}
24+
25+
/**
26+
* Creates a new CssFloodColor
27+
*
28+
* @param expression The expression for this property
29+
* @throws org.w3c.css.util.InvalidParamException
30+
* Expressions are incorrect
31+
*/
32+
public CssFloodColor(ApplContext ac, CssExpression expression, boolean check)
33+
throws InvalidParamException {
34+
if (check && expression.getCount() > 1) {
35+
throw new InvalidParamException("unrecognize", ac);
36+
}
37+
38+
setByUser();
39+
CssValue val = expression.getValue();
40+
41+
if (inherit.equals(val)) {
42+
value = inherit;
43+
expression.next();
44+
} else {
45+
try {
46+
CssColor tcolor = new CssColor(ac, expression, check);
47+
// instead of using getColor, we get the value directly
48+
// as we can have idents
49+
value = tcolor.color;
50+
} catch (InvalidParamException e) {
51+
throw new InvalidParamException("value",
52+
expression.getValue(),
53+
getPropertyName(), ac);
54+
}
55+
}
56+
}
57+
58+
public CssFloodColor(ApplContext ac, CssExpression expression)
59+
throws InvalidParamException {
60+
this(ac, expression, false);
61+
}
62+
63+
}
64+

0 commit comments

Comments
 (0)