Implement SVG stylesheets.

Including SVG-specific elements and attributes and an initial
testsuite.
This commit is contained in:
Sascha Peilicke
2013-08-07 17:47:44 +02:00
parent 2b2a41751e
commit 81c4e765d6
5 changed files with 173 additions and 3 deletions

View File

@@ -272,6 +272,52 @@ css3 = [
'word-break',
'word-wrap'
]
# SVG only includes style not present in either css2 or css3:
svg = [
# clipping / masking / compositing:
'clip-path',
'clip-rule',
'mask',
# filter effects:
'enable-background',
'filter',
'flood-color',
'flood-opacity',
'lightning-color',
# gradient:
'stop-color',
'stop-opacity',
# interactivity:
'pointer-events',
# color / painting:
'color-interpolation',
'color-interpolation-filters',
'color-rendering',
'fill',
'fill-opacity',
'fill-rule',
'image-rendering',
'marker',
'marker-end',
'marker-mid',
'marker-start',
'shape-rendering',
'stroke',
'stroke-dasharray',
'stroke-dashoffset',
'stroke-linecap',
'stroke-linejoin',
'stroke-miterlimit',
'stroke-opacity',
'stroke-width',
'text-rendering',
# text:
'glyph-orientation-horizontal',
'glyph-orientation-vertical',
'kerning',
'text-anchor',
'writing-mode',
]
vendor_prefix = [
'-ms-',
'-moz-',
@@ -284,10 +330,8 @@ vendor_prefix = [
'mso-',
]
vendor_ugly = [
'filter',
'accelerator',
'behavior',
'filter',
'zoom',
]
propertys = css2 + css3 + vendor_ugly
propertys = css2 + css3 + svg + vendor_ugly

View File

@@ -140,5 +140,24 @@ html5 = [
'video',
'wbr',
]
svg = [
'altGlyph',
'altGlyphDef',
'altGlyphItem',
'circle',
'desc',
'ellipse',
'glyphRef',
'line',
'path',
'polygon',
'polyline',
'rect',
'text',
'textPath',
'tref',
'tspan',
]
html = html4
html.extend(html5)
html.extend(svg)

53
lesscpy/test/css/svg.css Normal file
View File

@@ -0,0 +1,53 @@
svg {
color: red;
}
circle {
stroke: #006600;
fill: #00cc00;
}
circle .green {
stroke: #006600;
stroke-width: 9;
fill: #00cc00;
}
rect {
fill: blue;
fill-opacity: 0.1;
stroke: green;
opacity: 0.5;
}
ellipse {
fill: yellow;
}
line {
stroke: red;
}
path {
stroke: blue;
}
polygon {
fill: lime;
fill-rule: nonzero;
}
polygon {
fill: lime;
fill-rule: evenodd;
}
polyline {
fill: none;
}
.node text {
font: 12px sans-serif;
}
tref {
font-weight: bold;
}
text tref {
font-weight: bold;
}
tspan {
font-weight: bold;
}
text tspan {
font-weight: bold;
}

15
lesscpy/test/css/svg.min.css vendored Normal file
View File

@@ -0,0 +1,15 @@
svg{color:red;}
circle{stroke:#006600;fill:#00cc00;}
circle .green{stroke:#006600;stroke-width:9;fill:#00cc00;}
rect{fill:blue;fill-opacity:0.1;stroke:green;opacity:0.5;}
ellipse{fill:yellow;}
line{stroke:red;}
path{stroke:blue;}
polygon{fill:lime;fill-rule:nonzero;}
polygon{fill:lime;fill-rule:evenodd;}
polyline{fill:none;}
.node text{font:12px sans-serif;}
tref{font-weight:bold;}
text tref{font-weight:bold;}
tspan{font-weight:bold;}
text tspan{font-weight:bold;}

View File

@@ -0,0 +1,39 @@
svg {color: red;}
circle {
stroke: #006600;
fill: #00cc00;
}
circle .green {
stroke: #006600;
stroke-width: 9;
fill: #00cc00;
}
rect {
fill: blue;
fill-opacity: 0.1;
stroke: green;
opacity: 0.5;
}
ellipse { fill: yellow; }
line { stroke: red; }
path { stroke: blue; }
polygon {
fill: lime;
fill-rule: nonzero;
}
polygon {
fill: lime;
fill-rule: evenodd;
}
polyline { fill: none; }
.node text { font: 12px sans-serif; }
tref { font-weight: bold; }
text tref { font-weight: bold; }
tspan { font-weight: bold; }
text tspan { font-weight: bold; }
/* NOTE(saschpe): TODO
textPath { font-weight: bold; }
text textPath { font-weight: bold; }
svg text textPath { font-weight: bold; } */