tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

db_smilMappedAttrList.js (6462B)


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