B2G/gecko/layout/reftests/svg/smil/smil-grid.js
// the attribute values given in animationAttrHash.
the attribute values given in animationAttrHash.
the attribute values given in animationAttrHash .
function testAnimatedGrid(targetTagName,    targetAttrHash,
                          animationTagName, animationAttrHashList) {
  const numElementsToMake = START_TIMES.length;
  if (X_POSNS.length != numElementsToMake ||
      Y_POSNS.length != numElementsToMake) {
    return;
  }
  for (var i = 0; i < animationAttrHashList.length; i++) {
    var animationAttrHash = animationAttrHashList[i];
    if (!animationAttrHash["fill"]) {
      animationAttrHash["fill"] = "freeze";
    }
  }
  var svg = document.documentElement;
  for (var i = 0; i < numElementsToMake; i++) {
    var targetElem = buildElement(targetTagName, targetAttrHash);
    for (var j = 0; j < animationAttrHashList.length; j++) {
      var animationAttrHash = animationAttrHashList[j];
      var animElem = buildElement(animationTagName, animationAttrHash);
      targetElem.setAttribute("x", X_POSNS[i]);
      targetElem.setAttribute("y", Y_POSNS[i]);
      animElem.setAttribute("begin", START_TIMES[i]);
      animElem.setAttribute("dur", DURATION);
      targetElem.appendChild(animElem);
    }
    svg.appendChild(targetElem);
  }
  setTimeAndSnapshot(SNAPSHOT_TIME, true);
}
function testAnimatedGrid ( targetTagName , targetAttrHash , animationTagName , animationAttrHashList ) { const numElementsToMake = START_TIMES . length ; if ( X_POSNS . length != numElementsToMake || Y_POSNS . length != numElementsToMake ) { return ; } for ( var i = 0 ; i < animationAttrHashList . length ; i ++ ) { var animationAttrHash = animationAttrHashList [ i ] ; if ( ! animationAttrHash [ "fill" ] ) { animationAttrHash [ "fill" ] = "freeze" ; } } var svg = document . documentElement ; for ( var i = 0 ; i < numElementsToMake ; i ++ ) { var targetElem = buildElement ( targetTagName , targetAttrHash ) ; for ( var j = 0 ; j < animationAttrHashList . length ; j ++ ) { var animationAttrHash = animationAttrHashList [ j ] ; var animElem = buildElement ( animationTagName , animationAttrHash ) ; targetElem . setAttribute ( "x" , X_POSNS [ i ] ) ; targetElem . setAttribute ( "y" , Y_POSNS [ i ] ) ; animElem . setAttribute ( "begin" , START_TIMES [ i ] ) ; animElem . setAttribute ( "dur" , DURATION ) ; targetElem . appendChild ( animElem ) ; } svg . appendChild ( targetElem ) ; } setTimeAndSnapshot ( SNAPSHOT_TIME , true ) ; }
the attribute values given in animationAttrHash.
the attribute values given in animationAttrHash .
// SANITY CHECK // Default to fill="freeze" so we can test the final value of the animation // Build the grid! // Build target & animation elements // Customize them using global constant values // Append to target // Insert target into DOM // Take snapshot