Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
0d31406
Revert "no need to care about inherit in css3 anymore"
ylafon Sep 6, 2021
0329205
more casting issues fixed
ylafon Sep 6, 2021
0ea7224
revert defaults, how can this be fixed properly...
ylafon Sep 6, 2021
4c5ecd4
add way to access the stylesheet from the main context
ylafon Sep 6, 2021
e1dacb0
fix size when expression is not set
ylafon Sep 6, 2021
2772a7e
redo variable resolution, moved to a more global place for all variab…
ylafon Sep 6, 2021
abee1f9
added relevant check functions to delegate value check, proper fix of…
ylafon Sep 6, 2021
8bd4837
more casting issues
ylafon Sep 6, 2021
7e6e994
casting issue + use proper value instead of ident (might use getRawTy…
ylafon Sep 6, 2021
d969b44
cast issue+ updated ref
ylafon Sep 6, 2021
809ab35
cast issue (continuing...) + updated per https://www.w3.org/TR/2020/W…
ylafon Sep 6, 2021
939efde
cast issue (cont.) + ref
ylafon Sep 6, 2021
f088576
casting issue + use proper value instead of ident (might use getRawTy…
ylafon Sep 6, 2021
77b2e24
check based on resolved value
ylafon Sep 6, 2021
d32e2c5
casting issue (cont)
ylafon Sep 6, 2021
31c357f
updated to https://www.w3.org/TR/2020/WD-css-overflow-3-20200603/#pro…
ylafon Sep 6, 2021
2e2cc50
casting issue (cont)
ylafon Sep 6, 2021
f415054
casting issue (cont)
ylafon Sep 6, 2021
e9ac19a
internalize idents at parsing time
ylafon Sep 6, 2021
6c30f3f
regen
ylafon Sep 6, 2021
c89caf4
casting issue (cont)
ylafon Sep 6, 2021
37305d0
casting issue (cont)
ylafon Sep 6, 2021
1eacc41
updated per https://www.w3.org/TR/2021/WD-css-ruby-1-20210310/#propde…
ylafon Sep 6, 2021
0cf06af
cast+ref
ylafon Sep 6, 2021
165b843
updated per https://www.w3.org/TR/2021/WD-css-ruby-1-20210310/#propde…
ylafon Sep 6, 2021
9057e1f
rewrote entirely ruby-overhang per https://www.w3.org/TR/2021/WD-css-…
ylafon Sep 7, 2021
7f6f00e
cast+ref
ylafon Sep 7, 2021
4b9dfb7
don't forget the value
ylafon Sep 7, 2021
f42b36b
cast+ref
ylafon Sep 7, 2021
c0cee83
cast+ref (on deprecated classes)
ylafon Sep 7, 2021
0693abf
cast+ref
ylafon Sep 7, 2021
1ebfe9c
fix equality when 2nd val is null
ylafon Sep 7, 2021
fa5b752
redid content per https://www.w3.org/TR/2019/WD-css-content-3-2019080…
ylafon Sep 7, 2021
f9d8c09
cast+ref
ylafon Sep 8, 2021
153f369
refs+cast + added 'text' value as obsolete from webcompat spec
ylafon Sep 8, 2021
5a65845
typo in test
ylafon Sep 8, 2021
b06bfa3
getting ident without testing type first is not right
ylafon Sep 8, 2021
018565f
same as b06bfa3a17ddd49946026a314ccdc6d5106d5868
ylafon Sep 8, 2021
905f675
cast (cont)
ylafon Sep 8, 2021
3be827a
use original value
ylafon Sep 8, 2021
a5f7863
cast (cont)
ylafon Sep 8, 2021
3f837bf
cast+mark as deprecated (should be removed at some point)
ylafon Sep 8, 2021
49ef87d
redone font src parsing per https://www.w3.org/TR/2021/WD-css-fonts-4…
ylafon Sep 8, 2021
2c06677
refs+cast (cont)
ylafon Sep 8, 2021
f686ded
handle both css3 and svg based on the profile used, as the css3 versi…
ylafon Sep 8, 2021
665eff8
cast (cont) on deprecated property
ylafon Sep 8, 2021
30b3c3d
cast (cont) + small updates
ylafon Sep 8, 2021
a9a0aaf
ref+cast and mark deprecated
ylafon Sep 8, 2021
dff56ac
ref+cast (cont)
ylafon Sep 8, 2021
7b5a795
updated refs + cast issue (cont)
ylafon Sep 8, 2021
3b182a8
print-color-adjust per https://www.w3.org/TR/2021/WD-css-color-adjust…
ylafon Sep 8, 2021
a736b1a
updated + cast (cont)
ylafon Sep 8, 2021
24ae446
updated per https://www.w3.org/TR/2021/WD-css-color-adjust-1-20210616…
ylafon Sep 8, 2021
499c27a
cast (cont)
ylafon Sep 8, 2021
64a6db6
cast (cont)
ylafon Sep 9, 2021
7908e4c
cast + refs (cont)
ylafon Sep 9, 2021
e63f951
refs+cast (cont)
ylafon Sep 9, 2021
c7eee2f
cast (cont)
ylafon Sep 9, 2021
e1250b6
cast (cont) + marked as deprecated
ylafon Sep 9, 2021
7c590b0
inline-sizing per https://www.w3.org/TR/2020/WD-css-inline-3-20200827…
ylafon Sep 9, 2021
a3e71f3
baseline-source per https://www.w3.org/TR/2020/WD-css-inline-3-202008…
ylafon Sep 9, 2021
f8dcfc7
cast+refs (cont.)
ylafon Sep 9, 2021
c87ee82
cast+refs (cont.)
ylafon Sep 9, 2021
25254da
mark as deprecated
ylafon Sep 9, 2021
f1143be
cast+refs (cont.) + a few updates
ylafon Sep 9, 2021
ecaa943
cast+ref (cont.)
ylafon Sep 9, 2021
f427cbe
cast+ref (cont.)
ylafon Sep 9, 2021
4458367
mark as deprecated
ylafon Sep 9, 2021
39aef5d
cast (cont.)
ylafon Sep 9, 2021
79d2c06
cast (cont.)
ylafon Sep 9, 2021
17f8130
refs+cast (cont.)
ylafon Sep 9, 2021
84c59cb
refs+cast (cont.)
ylafon Sep 9, 2021
dd4fb2e
column now use row to parse, updated ref+cast
ylafon Sep 10, 2021
3023126
aligned all refs
ylafon Sep 10, 2021
f646100
refs+cast (cont.)
ylafon Sep 10, 2021
9ffdf7e
removed overloaded value
ylafon Sep 10, 2021
bbed863
cast+refs (cont.)
ylafon Sep 10, 2021
7931fe1
color accessor
ylafon Sep 10, 2021
d6feb0a
cast+refs (cont.)
ylafon Sep 10, 2021
8247284
Updated all font properties to https://www.w3.org/TR/2021/WD-css-font…
ylafon Sep 12, 2021
10f25a1
remove redundant check
ylafon Sep 12, 2021
f44bf1d
fix remaining CssIdent casts
ylafon Sep 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions org/w3c/css/css/DocumentParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public DocumentParser(ApplContext ac, Reader reader, String urlString, MimeType
mediatype = MimeType.TEXT_CSS;
}
if (mediatype.match(MimeType.TEXT_CSS) == MimeType.MATCH_SPECIFIC_SUBTYPE) {
StyleSheetParser csshandler = new StyleSheetParser();
StyleSheetParser csshandler = new StyleSheetParser(ac);
csshandler.parseStyleSheet(ac, reader, htmlURL);
style = csshandler.getStyleSheet();
} else if (mediatype.match(MimeType.TEXT_HTML) == MimeType.MATCH_SPECIFIC_SUBTYPE) {
Expand Down Expand Up @@ -88,7 +88,7 @@ public DocumentParser(ApplContext ac, String urlString) throws Exception {

if (!"http".equals(urlProtocol) && !"https".equals(urlProtocol)) {
if (urlLower.endsWith(".css")) {
StyleSheetParser parser = new StyleSheetParser();
StyleSheetParser parser = new StyleSheetParser(ac);
parser.parseURL(ac, htmlURL, null, null, media, StyleSheetOrigin.AUTHOR);
style = parser.getStyleSheet();
} else if (urlLower.endsWith(".html") || urlLower.endsWith(".htm") ||
Expand Down Expand Up @@ -157,7 +157,7 @@ public DocumentParser(ApplContext ac, String urlString) throws Exception {
style.setType("text/html");
}
} else if (contentType.match(MimeType.TEXT_CSS) == MimeType.MATCH_SPECIFIC_SUBTYPE) {
StyleSheetParser parser = new StyleSheetParser();
StyleSheetParser parser = new StyleSheetParser(ac);
parser.parseURL(ac, htmlURL, null, null, media, StyleSheetOrigin.AUTHOR);
style = parser.getStyleSheet();
} else if ((contentType.match(MimeType.TEXT_XML) == MimeType.MATCH_SPECIFIC_SUBTYPE)
Expand Down
3 changes: 2 additions & 1 deletion org/w3c/css/css/HTMLParserStyleSheetHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class HTMLParserStyleSheetHandler implements ContentHandler, LexicalHandl
boolean isHTML5;

// StyleSheet styleSheet = new StyleSheet();
StyleSheetParser styleSheetParser = new StyleSheetParser();
StyleSheetParser styleSheetParser = null;

boolean inStyle = false;
String media = null;
Expand All @@ -88,6 +88,7 @@ public HTMLParserStyleSheetHandler(URL baseURI, ApplContext ac) {
this.documentURI = baseURI;
this.baseURI = baseURI;
this.ac = ac;
this.styleSheetParser = new StyleSheetParser(ac);
}

public void setDocumentLocator(Locator locator) {
Expand Down
24 changes: 22 additions & 2 deletions org/w3c/css/css/StyleSheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.w3c.css.parser.CssSelectors;
import org.w3c.css.parser.CssStyle;
import org.w3c.css.parser.Errors;
import org.w3c.css.properties.css.CssCustomProperty;
import org.w3c.css.properties.css.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.Util;
Expand All @@ -37,16 +38,18 @@ public class StyleSheet {
private boolean doNotAddRule;
private boolean doNotAddAtRule;
private static final boolean debug = false;
private HashMap<String, CssCustomProperty> customProperties;

/**
* Create a new StyleSheet.
*/
public StyleSheet() {
rules = new HashMap<String, CssSelectors>();
rules = new HashMap<>();
errors = new Errors();
warnings = new Warnings();
cascading = new CssCascadingOrder();
atRuleList = new ArrayList<CssRuleList>();
atRuleList = new ArrayList<>();
customProperties = new HashMap<>();
}

public void setWarningLevel(int warningLevel) {
Expand Down Expand Up @@ -94,6 +97,23 @@ public void addProperty(CssSelectors selector, CssProperty property) {
getContext(selector).addProperty(property, warnings);
}

/**
* lookup a custom property
* @param s, the name of the property
* @return a CssCustomProperty or null if not found
*/
public CssCustomProperty getCustomProperty(String s) {
return customProperties.get(s);
}

// we are not adding custom property in addProperty, as we want to be
public CssCustomProperty addCustomProperty(String s, CssCustomProperty p, boolean force) {
if (force) {
return customProperties.put(s, p);
}
return customProperties.putIfAbsent(s, p);
}

public void remove(CssSelectors selector) {
rules.remove(selector);
}
Expand Down
4 changes: 4 additions & 0 deletions org/w3c/css/css/StyleSheetParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public final class StyleSheetParser
CssFouffa cssFouffa;
StyleSheet style = new StyleSheet();

public StyleSheetParser(ApplContext ac) {
ac.setStyleSheet(getStyleSheet());
}

public void reInit() {
style = new StyleSheet();
}
Expand Down
4 changes: 2 additions & 2 deletions org/w3c/css/css/TagSoupStyleSheetHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ public class TagSoupStyleSheetHandler implements ContentHandler, LexicalHandler,
URL documentURI = null;
URL baseURI = null;

// StyleSheet styleSheet = new StyleSheet();
StyleSheetParser styleSheetParser = new StyleSheetParser();
StyleSheetParser styleSheetParser = null;

boolean inStyle = false;
String media = null;
Expand All @@ -85,6 +84,7 @@ public TagSoupStyleSheetHandler(URL baseURI, ApplContext ac) {
this.documentURI = baseURI;
this.baseURI = baseURI;
this.ac = ac;
this.styleSheetParser = new StyleSheetParser(ac);
}

public void setDocumentLocator(Locator locator) {
Expand Down
3 changes: 2 additions & 1 deletion org/w3c/css/css/XMLStyleSheetHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class XMLStyleSheetHandler implements ContentHandler, LexicalHandler,
URL baseURI = null;

// StyleSheet styleSheet = new StyleSheet();
StyleSheetParser styleSheetParser = new StyleSheetParser();
StyleSheetParser styleSheetParser = null;

boolean inStyle = false;

Expand All @@ -90,6 +90,7 @@ public XMLStyleSheetHandler(URL baseURI, ApplContext ac) {
this.documentURI = baseURI;
this.baseURI = baseURI;
this.ac = ac;
this.styleSheetParser = new StyleSheetParser(ac);
}

public void setDocumentLocator(Locator locator) {
Expand Down
28 changes: 16 additions & 12 deletions org/w3c/css/parser/analyzer/CssParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,14 @@ private void setValue(CssValue v, CssExpression expr,

if (n.kind == CssParserConstants.IDENT) {
String s = convertIdent(val);
if ('-' == s.charAt(0)) {
expr.markVendorExtension();
}
v.set(convertIdent(val), ac);
if ('-' == s.charAt(0)) {
expr.markVendorExtension();
}
if (v.getRawType() == CssTypes.CSS_IDENT) {
v = CssIdent.getIdent(s); // might be in the setValue call
} else {
v.set(s, ac);
}
} else if (n.kind == CssParserConstants.STRING) {
v.set(val, ac);
} else {
Expand Down Expand Up @@ -7940,14 +7944,6 @@ private boolean jj_2_15(int xla)
finally { jj_save(14, xla); }
}

private boolean jj_3R_320()
{
if (jj_3R_195()) return true;
if (jj_scan_token(EQ)) return true;
if (jj_scan_token(NUMBER)) return true;
return false;
}

private boolean jj_3R_205()
{
if (jj_3R_222()) return true;
Expand Down Expand Up @@ -9663,6 +9659,14 @@ private boolean jj_3R_292()
return false;
}

private boolean jj_3R_320()
{
if (jj_3R_195()) return true;
if (jj_scan_token(EQ)) return true;
if (jj_scan_token(NUMBER)) return true;
return false;
}

/** Generated Token Manager. */
public CssParserTokenManager token_source;
SimpleCharStream jj_input_stream;
Expand Down
12 changes: 8 additions & 4 deletions org/w3c/css/parser/analyzer/CssParser.jj
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,14 @@ public abstract class CssParser {

if (n.kind == CssParserConstants.IDENT) {
String s = convertIdent(val);
if ('-' == s.charAt(0)) {
expr.markVendorExtension();
}
v.set(convertIdent(val), ac);
if ('-' == s.charAt(0)) {
expr.markVendorExtension();
}
if (v.getRawType() == CssTypes.CSS_IDENT) {
v = CssIdent.getIdent(s); // might be in the setValue call
} else {
v.set(s, ac);
}
} else if (n.kind == CssParserConstants.STRING) {
v.set(val, ac);
} else {
Expand Down
9 changes: 8 additions & 1 deletion org/w3c/css/properties/CSS3Properties.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,22 @@ font-feature-settings: org.w3c.css.properties.css3.CssFontFeatu
font-kerning: org.w3c.css.properties.css3.CssFontKerning
font-language-override: org.w3c.css.properties.css3.CssFontLanguageOverride
font-synthesis: org.w3c.css.properties.css3.CssFontSynthesis
font-synthesis-small-caps: org.w3c.css.properties.css3.CssFontSynthesisSmallCaps
font-synthesis-style: org.w3c.css.properties.css3.CssFontSynthesisStyle
font-synthesis-weight: org.w3c.css.properties.css3.CssFontSynthesisWeight
font-variant-caps: org.w3c.css.properties.css3.CssFontVariantCaps
font-variant-position: org.w3c.css.properties.css3.CssFontVariantPosition
font-variant-east-asian: org.w3c.css.properties.css3.CssFontVariantEastAsian
font-variant-emoji: org.w3c.css.properties.css3.CssFontVariantEmoji
font-variant-ligatures: org.w3c.css.properties.css3.CssFontVariantLigatures
font-variant-numeric: org.w3c.css.properties.css3.CssFontVariantNumeric
font-variant-alternates: org.w3c.css.properties.css3.CssFontVariantAlternates
font-variation-settings: org.w3c.css.properties.css3.CssFontVariationSettings

color: org.w3c.css.properties.css3.CssColor

color-adjust: org.w3c.css.properties.css3.CssColorAdjust
print-color-adjust: org.w3c.css.properties.css3.CssPrintColorAdjust
forced-color-adjust: org.w3c.css.properties.css3.CssForcedColorAdjust
color-scheme: org.w3c.css.properties.css3.CssColorScheme

Expand Down Expand Up @@ -449,12 +455,13 @@ handheld.background-clip: org.w3c.css.properties.css3.CssBackgroun

# CSS Inline
baseline-shift: org.w3c.css.properties.css3.CssBaselineShift
baseline-source: org.w3c.css.properties.css3.CssBaselineSource
dominant-baseline: org.w3c.css.properties.css3.CssDominantBaseline
alignment-baseline: org.w3c.css.properties.css3.CssAlignmentBaseline
initial-letter: org.w3c.css.properties.css3.CssInitialLetter
initial-letter-align: org.w3c.css.properties.css3.CssInitialLetterAlign
initial-letter-wrap: org.w3c.css.properties.css3.CssInitialLetterWrap

inline-sizing: org.w3c.css.properties.css3.CssInlineSizing

# CSS Multi-column Layout Module
# http://www.w3.org/TR/css3-multicol/
Expand Down
4 changes: 2 additions & 2 deletions org/w3c/css/properties/CSS3SVGProperties.properties
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ enable-background: org.w3c.css.properties.svg.CssEnableBack
baseline-shift: org.w3c.css.properties.svg.CssBaselineShift
dominant-baseline: org.w3c.css.properties.svg.CssDominantBaseline

# The SVG version handle SVG and CSS3+SVG
alignment-baseline: org.w3c.css.properties.svg.CssAlignmentBaseline
# The CSS3 version handle CSS3+SVG
alignment-baseline: org.w3c.css.properties.css3.CssAlignmentBaseline
113 changes: 113 additions & 0 deletions org/w3c/css/properties/css/CssBaselineSource.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
//
// Author: Yves Lafon <ylafon@w3.org>
//
// (c) COPYRIGHT MIT, ERCIM, Keio, Beihang, 2021.
// 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;

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

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

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

public CssBaselineSource(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 "baseline-source";
}

/**
* 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.cssBaselineSource != null) {
style.addRedefinitionWarning(ac, this);
}
s.cssBaselineSource = this;
}


/**
* Compares two properties for equality.
*
* @param property The other property.
*/
public boolean equals(CssProperty property) {
return (property instanceof CssBaselineSource &&
value.equals(((CssBaselineSource) 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).getBaselineSource();
} else {
return ((Css3Style) style).cssBaselineSource;
}
}
}

7 changes: 3 additions & 4 deletions org/w3c/css/properties/css/CssColumnRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public class CssColumnRule extends CssProperty {

private static final String propertyName = "column-rule";

CssColumnRuleWidth rule_width;
CssColumnRuleStyle rule_style;
CssColumnRuleColor rule_color;
public CssColumnRuleWidth rule_width;
public CssColumnRuleStyle rule_style;
public CssColumnRuleColor rule_color;

/**
* Create a new CssColumnRule
Expand Down Expand Up @@ -109,7 +109,6 @@ public Object get() {
* Returns a string representation of the object
*/
public String toString() {

return value.toString();
}
}
Loading