dom/smil/test/db_smilMappedAttrList.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial