Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d86844e
lexical units for 'supports' atrule
ylafon Dec 10, 2015
34831ec
regen after d86844e
ylafon Dec 10, 2015
ddaa032
moved some classes around to allow more atRules using the same hierar…
ylafon Dec 15, 2015
b220604
remove unnecessary declarations
ylafon Jan 12, 2016
63fc465
revamped Makefile to filter the unnecessary \ escaping of javacc
ylafon Jan 12, 2016
51c5605
lexical units for 'supports' atrule
ylafon Dec 10, 2015
8572c7c
regen after d86844e
ylafon Dec 10, 2015
c3bd37b
moved some classes around to allow more atRules using the same hierar…
ylafon Dec 15, 2015
77f7f30
remove unnecessary declarations
ylafon Jan 12, 2016
ddc540d
revamped Makefile to filter the unnecessary \ escaping of javacc
ylafon Jan 12, 2016
8180ff7
regen
ylafon Apr 25, 2016
6c0aca4
lexical units for 'supports' atrule
ylafon Dec 10, 2015
11f21ee
moved some classes around to allow more atRules using the same hierar…
ylafon Dec 15, 2015
b0a7b43
revamped Makefile to filter the unnecessary \ escaping of javacc
ylafon Jan 12, 2016
e962ef0
regen
ylafon Apr 28, 2016
117ec55
lexical units for 'supports' atrule
ylafon Dec 10, 2015
3762a08
regen after d86844e
ylafon Dec 10, 2015
12c8019
moved some classes around to allow more atRules using the same hierar…
ylafon Dec 15, 2015
1e8fa77
remove unnecessary declarations
ylafon Jan 12, 2016
956e940
Merge branch 'supports' of https://github.com/w3c/css-validator into …
ylafon Apr 28, 2016
a8055f4
lexical units for 'supports' atrule
ylafon Dec 10, 2015
7623935
regen after d86844e
ylafon Dec 10, 2015
853c8ee
moved some classes around to allow more atRules using the same hierar…
ylafon Dec 15, 2015
5eee8d5
remove unnecessary declarations
ylafon Jan 12, 2016
1bedfb2
Merge branch 'supports' of https://github.com/w3c/css-validator into …
ylafon May 4, 2016
6bb7930
lexical units for 'supports' atrule
ylafon Dec 10, 2015
1085d17
regen after d86844e
ylafon Dec 10, 2015
d197054
moved some classes around to allow more atRules using the same hierar…
ylafon Dec 15, 2015
fda9018
remove unnecessary declarations
ylafon Jan 12, 2016
14af691
Merge branch 'supports' of https://github.com/w3c/css-validator into …
ylafon May 10, 2016
06041ae
lexical units for 'supports' atrule
ylafon Dec 10, 2015
d14750d
regen
ylafon Feb 27, 2017
ac77610
fixed imports
ylafon Feb 27, 2017
c9cea6d
regen
ylafon Feb 27, 2017
94d1aee
moved some classes around to allow more atRules using the same hierar…
ylafon Dec 15, 2015
e9c72b0
remove unnecessary declarations
ylafon Jan 12, 2016
170fa0f
merging
ylafon Feb 27, 2017
f7ebf89
removed now unused imports
ylafon Feb 27, 2017
3abaf5d
regen
ylafon Feb 27, 2017
92eb6bc
lexical units for 'supports' atrule
ylafon Dec 10, 2015
923b33b
moved some classes around to allow more atRules using the same hierar…
ylafon Dec 15, 2015
1ceec9e
remove unnecessary declarations
ylafon Jan 12, 2016
cd8e45c
moved some classes around to allow more atRules using the same hierar…
ylafon Dec 15, 2015
babea70
revamped Makefile to filter the unnecessary \ escaping of javacc
ylafon Jan 12, 2016
07994c5
sync
ylafon Mar 22, 2018
b9c66c5
align CSS3SVG properties after 94d1aee71cdb5a4686569e4a3ea782c0209c7a29
ylafon Mar 22, 2018
639e8ae
moved the import atrule
ylafon Mar 22, 2018
64c10f6
move all atrules in the proper directory structure
ylafon Mar 22, 2018
b911479
initial support for the supports atrule
ylafon Mar 24, 2018
09adc48
regen
ylafon Mar 24, 2018
6fbd8d2
missing return
ylafon Mar 24, 2018
9305d01
regen
ylafon Mar 24, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
//
// (c) COPYRIGHT MIT, ERCIM, Keio, Beihang University, 2017.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.parser;
package org.w3c.css.atrules.css;

import org.w3c.css.parser.AtRule;

public class AtRuleCounterStyle extends AtRule {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
* AtRuleFontFace.java
* $Id$
*/
package org.w3c.css.parser;
package org.w3c.css.atrules.css;

import org.w3c.css.parser.AtRule;

/**
* This class manages all media defines by CSS2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* AtRuleMedia.java
* $Id$
*/
package org.w3c.css.parser;
package org.w3c.css.atrules.css;

import org.w3c.css.media.AtRuleMedia;
import org.w3c.css.parser.AtRule;

/**
* This class manages all imports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
//
// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.parser;
package org.w3c.css.atrules.css;

import org.w3c.css.parser.AtRule;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssIdent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
// (c) COPYRIGHT MIT, ECIM and Keio University, 2011.
// Please first read the full copyright statement in file COPYRIGHT.html

package org.w3c.css.media;
package org.w3c.css.atrules.css;

import org.w3c.css.atrules.css.media.Media;
import org.w3c.css.atrules.css.media.MediaFeature;
import org.w3c.css.parser.AtRule;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.CssVersion;
Expand Down Expand Up @@ -60,7 +62,7 @@ public ArrayList<Media> getMediaList() {

public String getCurrentMedia() {
if (!allMedia.isEmpty()) {
return allMedia.get(allMedia.size() - 1).media;
return allMedia.get(allMedia.size()-1).getMedia();
}
return null;
}
Expand Down Expand Up @@ -90,15 +92,15 @@ public boolean canMatch(AtRuleMedia atRule) {
public static final AtRuleMedia getInstance(CssVersion version) {
switch (version) {
case CSS1:
return new org.w3c.css.media.css1.AtRuleMedia();
return new org.w3c.css.atrules.css1.AtRuleMedia();
case CSS2:
return new org.w3c.css.media.css2.AtRuleMedia();
return new org.w3c.css.atrules.css2.AtRuleMedia();
case CSS21:
return new org.w3c.css.media.css21.AtRuleMedia();
return new org.w3c.css.atrules.css21.AtRuleMedia();
case CSS3:
case CSS:
case CSS_2015:
return new org.w3c.css.media.css3.AtRuleMedia();
return new org.w3c.css.atrules.css3.AtRuleMedia();
default:
throw new IllegalArgumentException(
"AtRuleMedia.getInstance called with unhandled"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
* AtRuleMedia.java
* $Id$
*/
package org.w3c.css.parser;
package org.w3c.css.atrules.css;

import org.w3c.css.parser.AtRule;

/**
* This class manages all imports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
* AtRulePage.java
* $Id$
*/
package org.w3c.css.parser;
package org.w3c.css.atrules.css;

import org.w3c.css.parser.AtRule;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
* AtRulePhoneticAlphabet.java
* $Id$
*/
package org.w3c.css.parser;
package org.w3c.css.atrules.css;

import org.w3c.css.parser.AtRule;
import org.w3c.css.util.ApplContext;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
// Please first read the full copyright statement at
// http://www.w3.org/Consortium/Legal/copyright-software-19980720

package org.w3c.css.parser;
package org.w3c.css.atrules.css;

import org.w3c.css.parser.AtRule;

@Deprecated
public class AtRulePreference extends AtRule {
Expand Down
120 changes: 120 additions & 0 deletions org/w3c/css/atrules/css/AtRuleSupports.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// Author: Yves Lafon <ylafon@w3.org>
//
// (c) COPYRIGHT MIT, ERCIM, Keio, Beihang, 2018.
// Please first read the full copyright statement in file COPYRIGHT.html

package org.w3c.css.atrules.css;

import org.w3c.css.atrules.css.supports.SupportsFeature;
import org.w3c.css.parser.AtRule;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;

import java.util.ArrayList;


public class AtRuleSupports extends AtRule {

public ArrayList<SupportsFeature> allSupportsRule = null;

/**
* Adds a medium.
*
* @throws org.w3c.css.util.InvalidParamException
* the medium doesn't exist
*/
public void addFeature(SupportsFeature feature,
ApplContext ac) throws InvalidParamException {
if (allSupportsRule == null) {
allSupportsRule = new ArrayList<>();
}
allSupportsRule.add(feature);
}

/**
* Adds a media
*/
// public AtRuleSupports addMedia(Media m) {
// allMedia.add(m);
// return this;
// }

/**
* Add a media feature to the current media, like (color:1)
*
* @param feature, the CssProperty
* @since CSS3
*/
// public abstract void addMediaFeature(MediaFeature feature, ApplContext ac)
// throws InvalidParamException;

/**
* Returns the at rule keyword
*/
public final String keyword() {
return "supports";
}


public boolean isEmpty() {
return false;
}

// public ArrayList<Media> getMediaList() {
// return allMedia;
// }

// public String getCurrentMedia() {
// if (!allMedia.isEmpty()) {
// return allMedia.get(allMedia.size()-1).getMedia();
// }
// return null;
// }

/**
* The second must be exactly the same of this one
*/
public boolean canApply(AtRule atRule) {
return false;
}

/**
* See if two rules can match (ie: one have thing in common)
*/
public boolean canMatch(AtRule atRule) {
return false;
}

/**
* Returns a string representation of the object.
*/
public String toString() {
StringBuilder ret = new StringBuilder();

ret.append('@');
ret.append(keyword());
if (allSupportsRule != null) {
for (SupportsFeature feature : allSupportsRule) {
ret.append(' ');
ret.append(feature);
}
}
return ret.toString();
}

public String lookupPrefix() {
return "";
}

/**
* Use to display the value part of the @media rule
* used where the value is used, like as an option in @import
*
* @return a String
*/
// public abstract String getValueString();

}



Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.w3c.css.media;
package org.w3c.css.atrules.css.media;


import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.w3c.css.media;
package org.w3c.css.atrules.css.media;

import org.w3c.css.css.StyleSheetOrigin;
import org.w3c.css.util.ApplContext;
Expand Down
89 changes: 89 additions & 0 deletions org/w3c/css/atrules/css/supports/SupportsFeature.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Author: Yves Lafon <ylafon@w3.org>
//
// (c) COPYRIGHT MIT, ERCIM, Keio, Beihang, 2018.
// Please first read the full copyright statement in file COPYRIGHT.html

package org.w3c.css.atrules.css.supports;

import org.w3c.css.properties.css.CssProperty;

import java.util.ArrayList;

public class SupportsFeature {
boolean and = false;
boolean not = false;
boolean or = false;
CssProperty property = null;
ArrayList<SupportsFeature> features = null;

public SupportsFeature() {
}

public SupportsFeature(CssProperty property) {
this.property = property;
}

public void setAnd(boolean and) {
this.and = and;
}

public boolean getAnd() {
return and;
}

public void setOr(boolean or) {
this.or = or;
}

public boolean getOr() {
return or;
}

public void setNot(boolean not) {
this.not = not;
}

public boolean getNot() {
return not;
}

public void setProperty(CssProperty property) {
this.property = property;
}

public CssProperty getProperty() {
return property;
}

public void addFeature(SupportsFeature sf) {
if (features == null) {
features = new ArrayList<SupportsFeature>();
}
features.add(sf);
}

public String toString() {
StringBuilder sb = new StringBuilder();
boolean printAnd = false;

if (and) {
sb.append(" and ");
} else if (not) {
sb.append(" not ");
} else if (or) {
sb.append(" or ");
}
sb.append('(');
if (property != null) {
sb.append(property.getPropertyName());
sb.append(": ");
sb.append(property);
} else if (features != null) {
for (SupportsFeature sf : features) {
sb.append(sf);
}
}
sb.append(')');
return sb.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// (c) COPYRIGHT MIT, ERCIM and Keio University, 2011
// Please first read the full copyright statement in file COPYRIGHT.html

package org.w3c.css.media.css1;
package org.w3c.css.atrules.css1;

import org.w3c.css.media.MediaFeature;
import org.w3c.css.atrules.css.media.MediaFeature;
import org.w3c.css.parser.AtRule;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
Expand All @@ -14,15 +14,15 @@
* @spec http://www.w3.org/TR/2008/REC-CSS2-20080411/media.html#media-types
* @since CSS2
*/
public class AtRuleMedia extends org.w3c.css.media.AtRuleMedia {
public class AtRuleMedia extends org.w3c.css.atrules.css.AtRuleMedia {

/**
* Adds a medium.
*
* @throws org.w3c.css.util.InvalidParamException
* the medium doesn't exist
*/
public org.w3c.css.media.AtRuleMedia addMedia(String restrictor, String medium,
public org.w3c.css.atrules.css.AtRuleMedia addMedia(String restrictor, String medium,
ApplContext ac) throws InvalidParamException {
throw new InvalidParamException("media", medium, ac);
}
Expand Down
Loading