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