Skip to content

Commit ba81909

Browse files
committed
1 parent 8576214 commit ba81909

File tree

5 files changed

+378
-1
lines changed

5 files changed

+378
-1
lines changed

org/w3c/css/properties/CSS3Properties.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ grid-template-rows: org.w3c.css.properties.css3.CssGridTempl
108108
# align
109109
row-gap: org.w3c.css.properties.css3.CssRowGap
110110
gap: org.w3c.css.properties.css3.CssGap
111+
justify-items: org.w3c.css.properties.css3.CssJustifyItems
111112
justify-self: org.w3c.css.properties.css3.CssJustifySelf
112113
place-content: org.w3c.css.properties.css3.CssPlaceContent
113114
place-self: org.w3c.css.properties.css3.CssPlaceSelf

org/w3c/css/properties/CSS3SVGProperties.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ grid-template-rows: org.w3c.css.properties.css3.CssGridTempl
165165
# align
166166
row-gap: org.w3c.css.properties.css3.CssRowGap
167167
gap: org.w3c.css.properties.css3.CssGap
168+
justify-items: org.w3c.css.properties.css3.CssJustifyItems
168169
justify-self: org.w3c.css.properties.css3.CssJustifySelf
169170
place-content: org.w3c.css.properties.css3.CssPlaceContent
170171
place-self: org.w3c.css.properties.css3.CssPlaceSelf
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
//
2+
// Author: Yves Lafon <ylafon@w3.org>
3+
//
4+
// (c) COPYRIGHT MIT, ERCIM, Keio, Beihang, 2018.
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 CssJustifyItems extends CssProperty {
19+
20+
public CssValue value;
21+
22+
/**
23+
* Create a new CssJustifyItems
24+
*/
25+
public CssJustifyItems() {
26+
}
27+
28+
/**
29+
* Creates a new CssJustifyItems
30+
*
31+
* @param expression The expression for this property
32+
* @throws org.w3c.css.util.InvalidParamException
33+
* Expressions are incorrect
34+
*/
35+
public CssJustifyItems(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 CssJustifyItems(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 "justify-items";
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.cssJustifyItems != null) {
85+
style.addRedefinitionWarning(ac, this);
86+
}
87+
s.cssJustifyItems = 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 CssJustifyItems &&
98+
value.equals(((CssJustifyItems) 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).getJustifyItems();
111+
} else {
112+
return ((Css3Style) style).cssJustifyItems;
113+
}
114+
}
115+
}
116+

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
import org.w3c.css.properties.css.CssInitialLetterWrap;
110110
import org.w3c.css.properties.css.CssIsolation;
111111
import org.w3c.css.properties.css.CssJustifyContent;
112+
import org.w3c.css.properties.css.CssJustifyItems;
112113
import org.w3c.css.properties.css.CssJustifySelf;
113114
import org.w3c.css.properties.css.CssLightingColor;
114115
import org.w3c.css.properties.css.CssLineBreak;
@@ -474,8 +475,17 @@ public class Css3Style extends ATSCStyle {
474475
public CssJustifySelf cssJustifySelf;
475476
public CssPlaceSelf cssPlaceSelf;
476477
public CssPlaceContent cssPlaceContent;
478+
public CssJustifyItems cssJustifyItems;
477479

478-
480+
public CssJustifyItems getJustifyItems() {
481+
if (cssJustifyItems == null) {
482+
cssJustifyItems =
483+
(CssJustifyItems) style.CascadingOrder(new CssJustifyItems(),
484+
style, selector);
485+
}
486+
return cssJustifyItems;
487+
}
488+
479489
public CssPlaceContent getPlaceContent() {
480490
if (cssPlaceContent == null) {
481491
cssPlaceContent =

0 commit comments

Comments
 (0)