Skip to content

Commit

Permalink
Merge pull request #196 from w3c/css-writing-mode-3
Browse files Browse the repository at this point in the history
Css writing mode
  • Loading branch information
ylafon authored May 29, 2018
2 parents d5a03ec + 329ae51 commit d84a4d7
Show file tree
Hide file tree
Showing 12 changed files with 604 additions and 12 deletions.
5 changes: 5 additions & 0 deletions org/w3c/css/properties/CSS3Properties.properties
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ text-underline-position: org.w3c.css.properties.css3.CssTextUnder
tab-size: org.w3c.css.properties.css3.CssTabSize
hanging-punctuation: org.w3c.css.properties.css3.CssHangingPunctuation

text-combine-upright: org.w3c.css.properties.css3.CssTextCombineUpright
text-orientation: org.w3c.css.properties.css3.CssTextOrientation
glyph-orientation-vertical: org.w3c.css.properties.css3.CssGlyphOrientationVertical


# marquee

marquee-direction: org.w3c.css.properties.css3.CssMarqueeDirection
Expand Down
6 changes: 5 additions & 1 deletion org/w3c/css/properties/CSS3SVGProperties.properties
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pointer-events: org.w3c.css.properties.svg.CssPointerEve
stop-opacity: org.w3c.css.properties.svg.CssStopOpacity
stop-color: org.w3c.css.properties.svg.CssStopColor
glyph-orientation-horizontal: org.w3c.css.properties.svg.CssGlyphOrientationHorizontal
glyph-orientation-vertical: org.w3c.css.properties.svg.CssGlyphOrientationVertical
glyph-orientation-vertical: org.w3c.css.properties.css3.CssGlyphOrientationVertical
enable-background: org.w3c.css.properties.svg.CssEnableBackground

@color-profile.rendering-intent org.w3c.css.properties.svg.colorprofile.CssRenderingIntent
Expand Down Expand Up @@ -183,6 +183,10 @@ text-underline-position: org.w3c.css.properties.css3.CssTextUnder
tab-size: org.w3c.css.properties.css3.CssTabSize
hanging-punctuation: org.w3c.css.properties.css3.CssHangingPunctuation

text-combine-upright: org.w3c.css.properties.css3.CssTextCombineUpright
text-orientation: org.w3c.css.properties.css3.CssTextOrientation


# marquee

marquee-direction: org.w3c.css.properties.css3.CssMarqueeDirection
Expand Down
116 changes: 116 additions & 0 deletions org/w3c/css/properties/css/CssTextCombineUpright.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
//
// Author: Yves Lafon <[email protected]>
//
// (c) COPYRIGHT MIT, ERCIM, Keio and Beihang University, 2018.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.properties.css;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css3.Css3Style;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssValue;

/**
* @since CSS3
*/
public class CssTextCombineUpright extends CssProperty {

public CssValue value;

/**
* Create a new CssTextCombineUpright
*/
public CssTextCombineUpright() {
}

/**
* Creates a new CssTextCombineUpright
*
* @param expression The expression for this property
* @throws org.w3c.css.util.InvalidParamException
* Expressions are incorrect
*/
public CssTextCombineUpright(ApplContext ac, CssExpression expression, boolean check)
throws InvalidParamException {
throw new InvalidParamException("value",
expression.getValue().toString(),
getPropertyName(), ac);
}

public CssTextCombineUpright(ApplContext ac, CssExpression expression)
throws InvalidParamException {
this(ac, expression, false);
}

/**
* Returns the value of this property
*/
public Object get() {
return value;
}


/**
* Returns the name of this property
*/
public final String getPropertyName() {
return "text-combine-upright";
}

/**
* Returns true if this property is "softly" inherited
* e.g. his value is equals to inherit
*/
public boolean isSoftlyInherited() {
return value.equals(inherit);
}

/**
* Returns a string representation of the object.
*/
public String toString() {
return value.toString();
}

/**
* Add this property to the CssStyle.
*
* @param style The CssStyle
*/
public void addToStyle(ApplContext ac, CssStyle style) {
Css3Style s = (Css3Style) style;
if (s.cssTextCombineUpright != null) {
style.addRedefinitionWarning(ac, this);
}
s.cssTextCombineUpright = this;
}


/**
* Compares two properties for equality.
*
* @param property The other property.
*/
public boolean equals(CssProperty property) {
return (property instanceof CssTextCombineUpright &&
value.equals(((CssTextCombineUpright) property).value));
}


/**
* Get this property in the style.
*
* @param style The style where the property is
* @param resolve if true, resolve the style to find this property
*/
public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
if (resolve) {
return ((Css3Style) style).getTextCombineUpright();
} else {
return ((Css3Style) style).cssTextCombineUpright;
}
}
}

116 changes: 116 additions & 0 deletions org/w3c/css/properties/css/CssTextOrientation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
//
// Author: Yves Lafon <[email protected]>
//
// (c) COPYRIGHT MIT, ERCIM, Keio and Beihang University, 2018.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.properties.css;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css3.Css3Style;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssValue;

/**
* @since CSS3
*/
public class CssTextOrientation extends CssProperty {

public CssValue value;

/**
* Create a new CssTextOrientation
*/
public CssTextOrientation() {
}

/**
* Creates a new CssTextOrientation
*
* @param expression The expression for this property
* @throws org.w3c.css.util.InvalidParamException
* Expressions are incorrect
*/
public CssTextOrientation(ApplContext ac, CssExpression expression, boolean check)
throws InvalidParamException {
throw new InvalidParamException("value",
expression.getValue().toString(),
getPropertyName(), ac);
}

public CssTextOrientation(ApplContext ac, CssExpression expression)
throws InvalidParamException {
this(ac, expression, false);
}

/**
* Returns the value of this property
*/
public Object get() {
return value;
}


/**
* Returns the name of this property
*/
public final String getPropertyName() {
return "text-orientation";
}

/**
* Returns true if this property is "softly" inherited
* e.g. his value is equals to inherit
*/
public boolean isSoftlyInherited() {
return value.equals(inherit);
}

/**
* Returns a string representation of the object.
*/
public String toString() {
return value.toString();
}

/**
* Add this property to the CssStyle.
*
* @param style The CssStyle
*/
public void addToStyle(ApplContext ac, CssStyle style) {
Css3Style s = (Css3Style) style;
if (s.cssTextOrientation != null) {
style.addRedefinitionWarning(ac, this);
}
s.cssTextOrientation = this;
}


/**
* Compares two properties for equality.
*
* @param property The other property.
*/
public boolean equals(CssProperty property) {
return (property instanceof CssTextOrientation &&
value.equals(((CssTextOrientation) property).value));
}


/**
* Get this property in the style.
*
* @param style The style where the property is
* @param resolve if true, resolve the style to find this property
*/
public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
if (resolve) {
return ((Css3Style) style).getTextOrientation();
} else {
return ((Css3Style) style).cssTextOrientation;
}
}
}

39 changes: 31 additions & 8 deletions org/w3c/css/properties/css3/Css3Style.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
import org.w3c.css.properties.css.CssTabSize;
import org.w3c.css.properties.css.CssTextAlignAll;
import org.w3c.css.properties.css.CssTextAlignLast;
import org.w3c.css.properties.css.CssTextCombineUpright;
import org.w3c.css.properties.css.CssTextDecorationColor;
import org.w3c.css.properties.css.CssTextDecorationLine;
import org.w3c.css.properties.css.CssTextDecorationSkip;
Expand All @@ -177,6 +178,7 @@
import org.w3c.css.properties.css.CssTextEmphasisPosition;
import org.w3c.css.properties.css.CssTextEmphasisStyle;
import org.w3c.css.properties.css.CssTextJustify;
import org.w3c.css.properties.css.CssTextOrientation;
import org.w3c.css.properties.css.CssTextOverflow;
import org.w3c.css.properties.css.CssTextSizeAdjust;
import org.w3c.css.properties.css.CssTextUnderlinePosition;
Expand Down Expand Up @@ -459,6 +461,27 @@ public class Css3Style extends ATSCStyle {
public CssFloatOffset cssFloatOffset;
public CssFloatDefer cssFloatDefer;

public CssTextCombineUpright cssTextCombineUpright;
public CssTextOrientation cssTextOrientation;

public CssTextCombineUpright getTextCombineUpright() {
if (cssTextCombineUpright == null) {
cssTextCombineUpright =
(CssTextCombineUpright) style.CascadingOrder(new CssTextCombineUpright(),
style, selector);
}
return cssTextCombineUpright;
}

public CssTextOrientation getTextOrientation() {
if (cssTextOrientation == null) {
cssTextOrientation =
(CssTextOrientation) style.CascadingOrder(new CssTextOrientation(),
style, selector);
}
return cssTextOrientation;
}

public org.w3c.css.properties.css.viewport.CssWidth getViewportWidth() {
if (viewportCssWidth == null) {
viewportCssWidth =
Expand All @@ -467,7 +490,7 @@ public org.w3c.css.properties.css.viewport.CssWidth getViewportWidth() {
}
return viewportCssWidth;
}

public org.w3c.css.properties.css.viewport.CssHeight getViewportHeight() {
if (viewportCssHeight == null) {
viewportCssHeight =
Expand All @@ -476,7 +499,7 @@ public org.w3c.css.properties.css.viewport.CssHeight getViewportHeight() {
}
return viewportCssHeight;
}

public CssOrientation getViewportOrientation() {
if (viewportCssOrientation == null) {
viewportCssOrientation =
Expand All @@ -485,7 +508,7 @@ public CssOrientation getViewportOrientation() {
}
return viewportCssOrientation;
}

public CssUserZoom getViewportUserZoom() {
if (viewportCssUserZoom == null) {
viewportCssUserZoom =
Expand All @@ -494,7 +517,7 @@ public CssUserZoom getViewportUserZoom() {
}
return viewportCssUserZoom;
}

public CssMaxZoom getViewportMaxZoom() {
if (viewportCssMaxZoom == null) {
viewportCssMaxZoom =
Expand All @@ -503,7 +526,7 @@ public CssMaxZoom getViewportMaxZoom() {
}
return viewportCssMaxZoom;
}

public CssMinZoom getViewportMinZoom() {
if (viewportCssMinZoom == null) {
viewportCssMinZoom =
Expand All @@ -521,7 +544,7 @@ public CssZoom getViewportZoom() {
}
return viewportCssZoom;
}

public org.w3c.css.properties.css.viewport.CssMaxHeight getViewportMaxHeight() {
if (viewportCssMaxHeight == null) {
viewportCssMaxHeight =
Expand All @@ -530,7 +553,7 @@ public org.w3c.css.properties.css.viewport.CssMaxHeight getViewportMaxHeight() {
}
return viewportCssMaxHeight;
}

public org.w3c.css.properties.css.viewport.CssMinHeight getViewportMinHeight() {
if (viewportCssMinHeight == null) {
viewportCssMinHeight =
Expand All @@ -557,7 +580,7 @@ public org.w3c.css.properties.css.viewport.CssMinWidth getViewportMinWidth() {
}
return viewportCssMinWidth;
}

public CssBackgroundPositionY getBackgroundPositionY() {
if (cssBackgroundPositionY == null) {
cssBackgroundPositionY =
Expand Down
2 changes: 1 addition & 1 deletion org/w3c/css/properties/css3/CssDirection.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.w3c.css.values.CssValue;

/**
* @spec http://www.w3.org/TR/2012/WD-css3-writing-modes-20120501/#direction
* @spec https://www.w3.org/TR/2018/CR-css-writing-modes-3-20180524/#propdef-direction
*/
public class CssDirection extends org.w3c.css.properties.css.CssDirection {

Expand Down
Loading

0 comments on commit d84a4d7

Please sign in to comment.