• R/O
  • SSH
  • HTTPS

copper: Commit


Commit MetaInfo

Revision1624 (tree)
Time2022-05-02 17:59:55
Authormiyabe

Log Message

(empty log message)

Change Summary

Incremental Difference

--- copper/trunk/homare/src/main/java/jp/cssj/homare/css/html/HTMLStyle.java (revision 1623)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/css/html/HTMLStyle.java (revision 1624)
@@ -1379,8 +1379,8 @@
13791379 style.set(MarginTop.INFO, _EM_1);
13801380 CSSStyle parent = style;
13811381 for (;;) {
1382- ColorValue color = BackgroundColor.get(parent);
1383- if (color != null) {
1382+ Value color = parent.get(BackgroundColor.INFO);
1383+ if (color.getValueType() != Value.TYPE_TRANSPARENT) {
13841384 style.set(BackgroundColor.INFO, color);
13851385 break;
13861386 }
--- copper/trunk/homare/src/main/java/jp/cssj/homare/css/util/ColorValueUtils.java (revision 1623)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/css/util/ColorValueUtils.java (revision 1624)
@@ -7,13 +7,12 @@
77
88 import jp.cssj.homare.css.value.BackgroundAttachmentValue;
99 import jp.cssj.homare.css.value.BackgroundRepeatValue;
10-import jp.cssj.homare.css.value.CMYKColorValue;
1110 import jp.cssj.homare.css.value.ColorValue;
12-import jp.cssj.homare.css.value.GrayColorValue;
13-import jp.cssj.homare.css.value.RGBColorValue;
14-import jp.cssj.homare.css.value.css3.RGBAColorValue;
1511 import jp.cssj.homare.ua.UserAgent;
1612 import jp.cssj.sakae.gc.paint.CMYKColor;
13+import jp.cssj.sakae.gc.paint.GrayColor;
14+import jp.cssj.sakae.gc.paint.RGBAColor;
15+import jp.cssj.sakae.gc.paint.RGBColor;
1716 import jp.cssj.sakae.sac.css.LexicalUnit;
1817
1918 /**
@@ -821,7 +820,7 @@
821820
822821 public static final ColorValue WINDOWTEXT = toColorValue(SystemColor.windowText);
823822
824- public static final ColorValue TRANSPARENT = RGBAColorValue.createValue(0, 0, 0, 0);
823+ public static final ColorValue TRANSPARENT = new ColorValue(RGBAColor.create(0, 0, 0, 0));
825824
826825 static {
827826 Map<String, ColorValue> map = new HashMap<String, ColorValue>();
@@ -1017,16 +1016,16 @@
10171016 }
10181017
10191018 public static ColorValue fromRGBOctets(int red, int green, int blue) {
1020- return RGBColorValue.createValue((float) red / 255f, (float) green / 255f, (float) blue / 255f);
1019+ return new ColorValue(RGBColor.create((float) red / 255f, (float) green / 255f, (float) blue / 255f));
10211020 }
10221021
10231022 public static ColorValue fromCMYKOctets(int cyan, int yellow, int magenta, int black) {
1024- return new CMYKColorValue((float) cyan / 255f, (float) yellow / 255f, (float) magenta / 255f,
1025- (float) black / 255f);
1023+ return new ColorValue(CMYKColor.create((float) cyan / 255f, (float) yellow / 255f, (float) magenta / 255f,
1024+ (float) black / 255f));
10261025 }
10271026
10281027 public static ColorValue fromGrayValue(float g) {
1029- return new GrayColorValue(g);
1028+ return new ColorValue(GrayColor.create(g));
10301029 }
10311030
10321031 public static ColorValue parseRGBHexColor(String color) {
@@ -1057,7 +1056,7 @@
10571056 * @param value
10581057 * @return
10591058 */
1060- private static RGBColorValue toRGBColorValue(LexicalUnit value) {
1059+ private static ColorValue toRGBColorValue(LexicalUnit value) {
10611060 try {
10621061 float red = toColorComponent(value);
10631062
@@ -1067,7 +1066,7 @@
10671066 value = value.getNextLexicalUnit().getNextLexicalUnit();
10681067 float blue = toColorComponent(value);
10691068
1070- return RGBColorValue.createValue(red, green, blue);
1069+ return new ColorValue(RGBColor.create(red, green, blue));
10711070 } catch (IllegalArgumentException e) {
10721071 return null;
10731072 }
@@ -1079,7 +1078,7 @@
10791078 * @param value
10801079 * @return
10811080 */
1082- private static RGBAColorValue toRGBAColorValue(LexicalUnit value) {
1081+ private static ColorValue toRGBAColorValue(LexicalUnit value) {
10831082 try {
10841083 float red = toColorComponent(value);
10851084
@@ -1092,7 +1091,7 @@
10921091 value = value.getNextLexicalUnit().getNextLexicalUnit();
10931092 float alpha = toColorComponent(value);
10941093
1095- return RGBAColorValue.createValue(red, green, blue, alpha);
1094+ return new ColorValue(RGBAColor.create(red, green, blue, alpha));
10961095 } catch (IllegalArgumentException e) {
10971096 return null;
10981097 }
@@ -1104,7 +1103,7 @@
11041103 * @param value
11051104 * @return
11061105 */
1107- private static CMYKColorValue toCMYKColorValue(LexicalUnit value) {
1106+ private static ColorValue toCMYKColorValue(LexicalUnit value) {
11081107 try {
11091108 float cyan = toColorComponent(value);
11101109
@@ -1131,15 +1130,15 @@
11311130 }
11321131 }
11331132
1134- return new CMYKColorValue(cyan, magenta, yellow, black, overprint);
1133+ return new ColorValue(CMYKColor.create(cyan, magenta, yellow, black, overprint));
11351134 } catch (IllegalArgumentException e) {
11361135 return null;
11371136 }
11381137 }
11391138
1140- private static GrayColorValue toGrayColorValue(LexicalUnit value) {
1139+ private static ColorValue toGrayColorValue(LexicalUnit value) {
11411140 try {
1142- return new GrayColorValue(toColorComponent(value));
1141+ return fromGrayValue(toColorComponent(value));
11431142 } catch (IllegalArgumentException e) {
11441143 return null;
11451144 }
--- copper/trunk/homare/src/main/java/jp/cssj/homare/css/value/ColorValue.java (revision 1623)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/css/value/ColorValue.java (revision 1624)
@@ -6,6 +6,28 @@
66 * @author MIYABE Tatsuhiko
77 * @version $Id$
88 */
9-public interface ColorValue extends Color, Value {
10- // empty
9+public class ColorValue implements Value {
10+ protected final Color color;
11+
12+ public ColorValue(Color color) {
13+ this.color = color;
14+ }
15+
16+ public Color getColor() {
17+ return this.color;
18+ }
19+
20+ public short getValueType() {
21+ return Value.TYPE_COLOR;
22+ }
23+
24+ public boolean equals(Object o) {
25+ if (o instanceof ColorValue) {
26+ return ((ColorValue)o).getColor().equals(this.color);
27+ }
28+ if (o instanceof Color) {
29+ return ((Color)o).equals(this.color);
30+ }
31+ return false;
32+ }
1133 }
\ No newline at end of file
--- copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/BackgroundColor.java (revision 1623)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/BackgroundColor.java (revision 1624)
@@ -11,6 +11,7 @@
1111 import jp.cssj.homare.css.value.TransparentValue;
1212 import jp.cssj.homare.css.value.Value;
1313 import jp.cssj.homare.ua.UserAgent;
14+import jp.cssj.sakae.gc.paint.Color;
1415 import jp.cssj.sakae.sac.css.LexicalUnit;
1516
1617 /**
@@ -20,12 +21,12 @@
2021 public class BackgroundColor extends AbstractPrimitivePropertyInfo {
2122 public static final PrimitivePropertyInfo INFO = new BackgroundColor();
2223
23- public static ColorValue get(CSSStyle style) {
24+ public static Color get(CSSStyle style) {
2425 Value value = style.get(INFO);
2526 if (value.getValueType() == Value.TYPE_TRANSPARENT) {
2627 return null;
2728 }
28- return (ColorValue) value;
29+ return ((ColorValue) value).getColor();
2930 }
3031
3132 protected BackgroundColor() {
--- copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/BorderBottomColor.java (revision 1623)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/BorderBottomColor.java (revision 1624)
@@ -60,7 +60,7 @@
6060 if (value.getValueType() == Value.TYPE_TRANSPARENT) {
6161 return null;
6262 }
63- return (ColorValue) value;
63+ return ((ColorValue) value).getColor();
6464 }
6565
6666 protected BorderBottomColor() {
--- copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/BorderLeftColor.java (revision 1623)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/BorderLeftColor.java (revision 1624)
@@ -62,7 +62,7 @@
6262 if (value.getValueType() == Value.TYPE_TRANSPARENT) {
6363 return null;
6464 }
65- return (ColorValue) value;
65+ return ((ColorValue) value).getColor();
6666 }
6767
6868 protected BorderLeftColor() {
--- copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/BorderRightColor.java (revision 1623)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/BorderRightColor.java (revision 1624)
@@ -62,7 +62,7 @@
6262 if (value.getValueType() == Value.TYPE_TRANSPARENT) {
6363 return null;
6464 }
65- return (ColorValue) value;
65+ return ((ColorValue) value).getColor();
6666 }
6767
6868 protected BorderRightColor() {
--- copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/BorderTopColor.java (revision 1623)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/BorderTopColor.java (revision 1624)
@@ -59,7 +59,7 @@
5959 if (value.getValueType() == Value.TYPE_TRANSPARENT) {
6060 return null;
6161 }
62- return (ColorValue) value;
62+ return ((ColorValue) value).getColor();
6363 }
6464
6565 protected BorderTopColor() {
--- copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/CSSColor.java (revision 1623)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/CSSColor.java (revision 1624)
@@ -22,7 +22,7 @@
2222
2323 public static Color get(CSSStyle style) {
2424 Value value = style.get(INFO);
25- return (ColorValue) value;
25+ return ((ColorValue) value).getColor();
2626 }
2727
2828 protected CSSColor() {
--- copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/css3/ColumnRuleColor.java (revision 1623)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/css3/ColumnRuleColor.java (revision 1624)
@@ -27,7 +27,7 @@
2727 if (value.getValueType() == Value.TYPE_TRANSPARENT) {
2828 return null;
2929 }
30- return (ColorValue) value;
30+ return ((ColorValue) value).getColor();
3131 }
3232
3333 protected ColumnRuleColor() {
--- copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/css3/TextEmphasisColor.java (revision 1623)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/css3/TextEmphasisColor.java (revision 1624)
@@ -27,7 +27,7 @@
2727 if (value == DefaultValue.DEFAULT_VALUE) {
2828 value = style.get(CSSColor.INFO);
2929 }
30- return (ColorValue) value;
30+ return ((ColorValue) value).getColor();
3131 }
3232
3333 protected TextEmphasisColor() {
--- copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/css3/TextFillColor.java (revision 1623)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/css3/TextFillColor.java (revision 1624)
@@ -30,7 +30,7 @@
3030 if (value == DefaultValue.DEFAULT_VALUE) {
3131 return CSSColor.get(style);
3232 }
33- return (ColorValue) value;
33+ return ((ColorValue) value).getColor();
3434 }
3535
3636 protected TextFillColor() {
--- copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/css3/TextShadow.java (revision 1623)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/css3/TextShadow.java (revision 1624)
@@ -53,7 +53,7 @@
5353 if (src[i].color == null) {
5454 color = CSSColor.get(style);
5555 } else {
56- color = src[i].color;
56+ color = src[i].color.getColor();
5757 }
5858 shadows[i] = new jp.cssj.homare.style.box.params.TextShadow(x, y, color);
5959 }
--- copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/css3/TextStrokeColor.java (revision 1623)
+++ copper/trunk/homare/src/main/java/jp/cssj/homare/impl/css/property/css3/TextStrokeColor.java (revision 1624)
@@ -30,7 +30,7 @@
3030 if (value == DefaultValue.DEFAULT_VALUE) {
3131 return CSSColor.get(style);
3232 }
33- return (ColorValue) value;
33+ return ((ColorValue) value).getColor();
3434 }
3535
3636 protected TextStrokeColor() {
Show on old repository browser