1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ts=2 sw=2 sts=2 et: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* List of SVG presentational attributes in the SVG 1.1 spec, for use in
mochitests. (These are the attributes that are mapped to CSS properties) */
var gMappedAttrList = {
// NOTE: The list here should match the MappedAttributeEntry arrays in
// SVGElement.cpp
// PresentationAttributes-FillStroke
fill: new AdditiveAttribute("fill", "XML", "rect"),
fill_opacity: new AdditiveAttribute("fill-opacity", "XML", "rect"),
fill_rule: new NonAdditiveAttribute("fill-rule", "XML", "rect"),
stroke: new AdditiveAttribute("stroke", "XML", "rect"),
stroke_dasharray: new NonAdditiveAttribute("stroke-dasharray", "XML", "rect"),
stroke_dashoffset: new AdditiveAttribute("stroke-dashoffset", "XML", "rect"),
stroke_linecap: new NonAdditiveAttribute("stroke-linecap", "XML", "rect"),
stroke_linejoin: new NonAdditiveAttribute("stroke-linejoin", "XML", "rect"),
stroke_miterlimit: new AdditiveAttribute("stroke-miterlimit", "XML", "rect"),
stroke_opacity: new AdditiveAttribute("stroke-opacity", "XML", "rect"),
stroke_width: new AdditiveAttribute("stroke-width", "XML", "rect"),
// PresentationAttributes-Graphics
clip_path: new NonAdditiveAttribute("clip-path", "XML", "rect"),
clip_rule: new NonAdditiveAttribute("clip-rule", "XML", "circle"),
color_interpolation: new NonAdditiveAttribute(
"color-interpolation",
"XML",
"rect"
),
cursor: new NonAdditiveAttribute("cursor", "XML", "rect"),
display: new NonAdditiveAttribute("display", "XML", "rect"),
filter: new NonAdditiveAttribute("filter", "XML", "rect"),
image_rendering: NonAdditiveAttribute("image-rendering", "XML", "image"),
mask: new NonAdditiveAttribute("mask", "XML", "line"),
pointer_events: new NonAdditiveAttribute("pointer-events", "XML", "rect"),
shape_rendering: new NonAdditiveAttribute("shape-rendering", "XML", "rect"),
text_rendering: new NonAdditiveAttribute("text-rendering", "XML", "text"),
visibility: new NonAdditiveAttribute("visibility", "XML", "rect"),
// PresentationAttributes-TextContentElements
// SKIP 'alignment-baseline' property: animatable but not supported by Mozilla
// SKIP 'baseline-shift' property: animatable but not supported by Mozilla
direction: new NonAnimatableAttribute("direction", "XML", "text"),
dominant_baseline: new NonAdditiveAttribute(
"dominant-baseline",
"XML",
"text"
),
glyph_orientation_horizontal:
// NOTE: Not supported by Mozilla, but explicitly non-animatable
NonAnimatableAttribute("glyph-orientation-horizontal", "XML", "text"),
glyph_orientation_vertical:
// NOTE: Not supported by Mozilla, but explicitly non-animatable
NonAnimatableAttribute("glyph-orientation-horizontal", "XML", "text"),
// SKIP 'kerning' property: animatable but not supported by Mozilla
letter_spacing: new AdditiveAttribute("letter-spacing", "XML", "text"),
text_anchor: new NonAdditiveAttribute("text-anchor", "XML", "text"),
text_decoration_line: new NonAdditiveAttribute(
"text-decoration-line",
"XML",
"text"
),
unicode_bidi: new NonAnimatableAttribute("unicode-bidi", "XML", "text"),
word_spacing: new AdditiveAttribute("word-spacing", "XML", "text"),
// PresentationAttributes-FontSpecification
font_family: new NonAdditiveAttribute("font-family", "XML", "text"),
font_size: new AdditiveAttribute("font-size", "XML", "text"),
font_size_adjust: new NonAdditiveAttribute("font-size-adjust", "XML", "text"),
font_stretch: new NonAdditiveAttribute("font-stretch", "XML", "text"),
font_style: new NonAdditiveAttribute("font-style", "XML", "text"),
font_variant: new NonAdditiveAttribute("font-variant", "XML", "text"),
font_weight: new NonAdditiveAttribute("font-weight", "XML", "text"),
// PresentationAttributes-GradientStop
stop_color: new AdditiveAttribute("stop-color", "XML", "stop"),
stop_opacity: new AdditiveAttribute("stop-opacity", "XML", "stop"),
// PresentationAttributes-Viewports
overflow: new NonAdditiveAttribute("overflow", "XML", "marker"),
clip: new AdditiveAttribute("clip", "XML", "marker"),
// PresentationAttributes-Makers
marker_end: new NonAdditiveAttribute("marker-end", "XML", "line"),
marker_mid: new NonAdditiveAttribute("marker-mid", "XML", "line"),
marker_start: new NonAdditiveAttribute("marker-start", "XML", "line"),
// PresentationAttributes-Color
color: new AdditiveAttribute("color", "XML", "rect"),
// PresentationAttributes-Filters
color_interpolation_filters: new NonAdditiveAttribute(
"color-interpolation-filters",
"XML",
"feFlood"
),
// PresentationAttributes-feFlood
flood_color: new AdditiveAttribute("flood-color", "XML", "feFlood"),
flood_opacity: new AdditiveAttribute("flood-opacity", "XML", "feFlood"),
// PresentationAttributes-LightingEffects
lighting_color: new AdditiveAttribute(
"lighting-color",
"XML",
"feDiffuseLighting"
),
};
// Utility method to copy a list of TestcaseBundle objects for CSS properties
// into a list of TestcaseBundles for the corresponding mapped attributes.
function convertCSSBundlesToMappedAttr(bundleList) {
// Create mapping of property names to the corresponding
// mapped-attribute object in gMappedAttrList.
var propertyNameToMappedAttr = {};
for (attributeLabel in gMappedAttrList) {
var propName = gMappedAttrList[attributeLabel].attrName;
propertyNameToMappedAttr[propName] = gMappedAttrList[attributeLabel];
}
var convertedBundles = [];
for (var bundleIdx in bundleList) {
var origBundle = bundleList[bundleIdx];
var propName = origBundle.animatedAttribute.attrName;
if (propertyNameToMappedAttr[propName]) {
// There's a mapped attribute by this name! Duplicate the TestcaseBundle,
// using the Mapped Attribute instead of the CSS Property.
is(
origBundle.animatedAttribute.attrType,
"CSS",
"expecting to be converting from CSS to XML"
);
convertedBundles.push(
new TestcaseBundle(
propertyNameToMappedAttr[propName],
origBundle.testcaseList,
origBundle.skipReason
)
);
}
}
return convertedBundles;
}
|