Skip to content

Commit 3788c12

Browse files
committed
Custom properties, conditional and property rules, CSS-wide keywords, calc() and attr()
1 parent 06d8671 commit 3788c12

File tree

159 files changed

+5357
-1089
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+5357
-1089
lines changed

config/checkstyle/suppressions.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
<suppress files="Test\.java$" checks="LineLength"/>
5050

5151
<!-- Header -->
52+
<suppress files="[\\/]PropertyDefinition\.java$" checks="RegexpHeader"/>
5253
<suppress files="[\\/]NodeXBL\.java$" checks="RegexpHeader"/>
5354
<suppress files="[\\/]OriginalEvent\.java$" checks="RegexpHeader"/>
5455
<suppress files="[\\/]ShadowTreeEvent\.java$" checks="RegexpHeader"/>

echosvg-anim/src/main/java/io/sf/carte/echosvg/anim/dom/AbstractSVGLength.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,9 @@ public Element getElement() {
242242
return getAssociatedElement();
243243
}
244244

245-
/**
246-
* Returns the size of a px CSS unit in millimeters.
247-
*/
248245
@Override
249-
public float getPixelUnitToMillimeter() {
250-
return getAssociatedElement().getSVGContext().getPixelUnitToMillimeter();
246+
public float getResolution() {
247+
return getAssociatedElement().getSVGContext().getResolution();
251248
}
252249

253250
/**

echosvg-anim/src/main/java/io/sf/carte/echosvg/anim/dom/SVGOMAnimatedRect.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
*/
1919
package io.sf.carte.echosvg.anim.dom;
2020

21+
import org.w3c.css.om.unit.CSSUnit;
2122
import org.w3c.dom.Attr;
2223
import org.w3c.dom.DOMException;
2324
import org.w3c.dom.svg.SVGAnimatedRect;
2425
import org.w3c.dom.svg.SVGRect;
2526

26-
import io.sf.carte.doc.style.css.CSSUnit;
27+
import io.sf.carte.doc.style.css.CSSExpressionValue;
28+
import io.sf.carte.doc.style.css.CSSTypedValue;
2729
import io.sf.carte.doc.style.css.CSSValue.CssType;
2830
import io.sf.carte.doc.style.css.property.Evaluator;
29-
import io.sf.carte.doc.style.css.property.ExpressionValue;
3031
import io.sf.carte.doc.style.css.property.StyleValue;
31-
import io.sf.carte.doc.style.css.property.TypedValue;
3232
import io.sf.carte.doc.style.css.property.ValueFactory;
3333
import io.sf.carte.doc.style.css.property.ValueList;
3434
import io.sf.carte.echosvg.anim.values.AnimatableRectValue;
@@ -286,16 +286,16 @@ private boolean computeRectangle(StyleValue value, float[] numbers) throws DOMEx
286286
if (item.getCssValueType() != CssType.TYPED) {
287287
return false;
288288
}
289-
TypedValue typed = (TypedValue) item;
289+
CSSTypedValue typed = (CSSTypedValue) item;
290290
switch (item.getPrimitiveType()) {
291291
case NUMERIC:
292292
if (typed.getUnitType() != CSSUnit.CSS_NUMBER) {
293293
return false;
294294
}
295295
break;
296296
case EXPRESSION:
297-
Evaluator eval = new Evaluator();
298-
typed = eval.evaluateExpression((ExpressionValue) typed);
297+
Evaluator eval = new Evaluator(CSSUnit.CSS_NUMBER);
298+
typed = eval.evaluateExpression((CSSExpressionValue) typed);
299299
if (typed.getUnitType() != CSSUnit.CSS_NUMBER) {
300300
return false;
301301
}

echosvg-anim/src/main/java/io/sf/carte/echosvg/anim/dom/SVGOMElement.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -877,12 +877,9 @@ public Element getElement() {
877877
return SVGOMElement.this;
878878
}
879879

880-
/**
881-
* Returns the size of a px CSS unit in millimeters.
882-
*/
883880
@Override
884-
public float getPixelUnitToMillimeter() {
885-
return getSVGContext().getPixelUnitToMillimeter();
881+
public float getResolution() {
882+
return getSVGContext().getResolution();
886883
}
887884

888885
/**

echosvg-bridge/src/main/java/io/sf/carte/echosvg/bridge/AbstractGraphicsNodeBridge.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -490,12 +490,9 @@ protected void fireBBoxChangeEvent() {
490490

491491
// SVGContext implementation ///////////////////////////////////////////
492492

493-
/**
494-
* Returns the size of a px CSS unit in millimeters.
495-
*/
496493
@Override
497-
public float getPixelUnitToMillimeter() {
498-
return ctx.getUserAgent().getPixelUnitToMillimeter();
494+
public float getResolution() {
495+
return ctx.getUserAgent().getResolution();
499496
}
500497

501498
protected SoftReference<Shape> bboxShape = null;

echosvg-bridge/src/main/java/io/sf/carte/echosvg/bridge/AnimatableGenericSVGBridge.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,9 @@ public void handleElement(BridgeContext ctx, Element e) {
5959

6060
// SVGContext ////////////////////////////////////////////////////////////
6161

62-
/**
63-
* Returns the size of a px CSS unit in millimeters.
64-
*/
6562
@Override
66-
public float getPixelUnitToMillimeter() {
67-
return ctx.getUserAgent().getPixelUnitToMillimeter();
63+
public float getResolution() {
64+
return ctx.getUserAgent().getResolution();
6865
}
6966

7067
/**

echosvg-bridge/src/main/java/io/sf/carte/echosvg/bridge/BridgeContext.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
import io.sf.carte.echosvg.dom.events.NodeEventTarget;
7171
import io.sf.carte.echosvg.dom.svg.SVGContext;
7272
import io.sf.carte.echosvg.dom.xbl.XBLManager;
73-
import io.sf.carte.echosvg.ext.awt.color.StandardColorSpaces;
7473
import io.sf.carte.echosvg.ext.awt.color.ColorContext;
74+
import io.sf.carte.echosvg.ext.awt.color.StandardColorSpaces;
7575
import io.sf.carte.echosvg.gvt.CompositeGraphicsNode;
7676
import io.sf.carte.echosvg.gvt.GraphicsNode;
7777
import io.sf.carte.echosvg.script.Interpreter;
@@ -1830,12 +1830,23 @@ public float getBolderFontWeight(float f) {
18301830

18311831
/**
18321832
* Returns the size of a px CSS unit in millimeters.
1833+
*
1834+
* @deprecated Use {@link #getResolution()}.
18331835
*/
1836+
@Deprecated
18341837
@Override
18351838
public float getPixelUnitToMillimeter() {
18361839
return userAgent.getPixelUnitToMillimeter();
18371840
}
18381841

1842+
/**
1843+
* Returns the resolution in dpi.
1844+
*/
1845+
@Override
1846+
public float getResolution() {
1847+
return userAgent.getResolution();
1848+
}
1849+
18391850
/**
18401851
* Returns the medium font size.
18411852
*/
@@ -1877,6 +1888,14 @@ public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL) t
18771888
userAgent.checkLoadExternalResource(resourceURL, docURL);
18781889
}
18791890

1891+
/**
1892+
* Get prefers-color-scheme.
1893+
*/
1894+
@Override
1895+
public String getPrefersColorScheme() {
1896+
return userAgent.getPrefersColorScheme();
1897+
}
1898+
18801899
/**
18811900
* Tells whether the given SVG document is dynamic.
18821901
*/

echosvg-bridge/src/main/java/io/sf/carte/echosvg/bridge/CSSFontFace.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import java.util.LinkedList;
2222
import java.util.List;
2323

24-
import io.sf.carte.echosvg.css.dom.CSSValue.CssType;
25-
import io.sf.carte.echosvg.css.dom.CSSValue.Type;
24+
import io.sf.carte.doc.style.css.CSSValue.CssType;
25+
import io.sf.carte.doc.style.css.CSSValue.Type;
2626
import io.sf.carte.echosvg.css.engine.CSSEngine;
2727
import io.sf.carte.echosvg.css.engine.FontFaceRule;
2828
import io.sf.carte.echosvg.css.engine.SVGCSSEngine;

echosvg-bridge/src/main/java/io/sf/carte/echosvg/bridge/CSSUtilities.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828

2929
import org.w3c.dom.Element;
3030

31+
import io.sf.carte.doc.style.css.CSSValue.CssType;
32+
import io.sf.carte.doc.style.css.CSSValue.Type;
3133
import io.sf.carte.echosvg.anim.dom.SVGOMDocument;
3234
import io.sf.carte.echosvg.constants.XMLConstants;
33-
import io.sf.carte.echosvg.css.dom.CSSValue.CssType;
34-
import io.sf.carte.echosvg.css.dom.CSSValue.Type;
3535
import io.sf.carte.echosvg.css.engine.CSSEngine;
3636
import io.sf.carte.echosvg.css.engine.CSSStylableElement;
3737
import io.sf.carte.echosvg.css.engine.SVGCSSEngine;

echosvg-bridge/src/main/java/io/sf/carte/echosvg/bridge/CursorManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
import org.w3c.dom.svg.SVGDocument;
4141
import org.w3c.dom.svg.SVGPreserveAspectRatio;
4242

43-
import io.sf.carte.echosvg.css.dom.CSSValue.CssType;
44-
import io.sf.carte.echosvg.css.dom.CSSValue.Type;
43+
import io.sf.carte.doc.style.css.CSSValue.CssType;
44+
import io.sf.carte.doc.style.css.CSSValue.Type;
4545
import io.sf.carte.echosvg.css.engine.SVGCSSEngine;
4646
import io.sf.carte.echosvg.css.engine.value.Value;
4747
import io.sf.carte.echosvg.dom.AbstractNode;

0 commit comments

Comments
 (0)