B2G/gecko/layout/reftests/svg/image/util.js
// preserveAspectRatio value on a bonus <image> element, added at the end.
preserveAspectRatio value on a bonus  element, added at the end.
preserveAspectRatio value on a bonus element added at the end .
function generateImageGrid(aHref, aWidth, aHeight, aBonusPARVal) {
  var grid = document.createElementNS(SVGNS, "g");
  var y = 0;
  var x = 0;
  for (var i = 0; i < ALIGN_VALS.length; i++) {
    if (i && i % 2 == 0) {
      y += IMAGE_OFFSET;
      x = 0;
    }
    var alignVal = ALIGN_VALS[i];
    for (var j = 0; j < MEETORSLICE_VALS.length; j++) {
      var meetorsliceVal = MEETORSLICE_VALS[j];
      var border = generateBorderRect(x, y, aWidth, aHeight);
      var image  = generateImageElementForParams(x, y, aWidth, aHeight,
                                                 aHref, alignVal,
                                                 meetorsliceVal);
      grid.appendChild(border);
      grid.appendChild(image);
      x += IMAGE_OFFSET;
    }
  }
  if (aBonusPARVal) {
    y += IMAGE_OFFSET;
    x = 0;
    var border = generateBorderRect(x, y, aWidth, aHeight);
    var image  = generateImageElementForParams(x, y, aWidth, aHeight,
                                               aHref, aBonusPARVal, "");
    grid.appendChild(border);
    grid.appendChild(image);
  }
  return grid;
}
function generateImageGrid ( aHref , aWidth , aHeight , aBonusPARVal ) { var grid = document . createElementNS ( SVGNS , "g" ) ; var y = 0 ; var x = 0 ; for ( var i = 0 ; i < ALIGN_VALS . length ; i ++ ) { if ( i && i % 2 == 0 ) { y += IMAGE_OFFSET ; x = 0 ; } var alignVal = ALIGN_VALS [ i ] ; for ( var j = 0 ; j < MEETORSLICE_VALS . length ; j ++ ) { var meetorsliceVal = MEETORSLICE_VALS [ j ] ; var border = generateBorderRect ( x , y , aWidth , aHeight ) ; var image = generateImageElementForParams ( x , y , aWidth , aHeight , aHref , alignVal , meetorsliceVal ) ; grid . appendChild ( border ) ; grid . appendChild ( image ) ; x += IMAGE_OFFSET ; } } if ( aBonusPARVal ) { y += IMAGE_OFFSET ; x = 0 ; var border = generateBorderRect ( x , y , aWidth , aHeight ) ; var image = generateImageElementForParams ( x , y , aWidth , aHeight , aHref , aBonusPARVal , "" ) ; grid . appendChild ( border ) ; grid . appendChild ( image ) ; } return grid ; }
preserveAspectRatio value on a bonus <image> element, added at the end.
preserveAspectRatio value on a bonus <image > element added at the end .
// Jump to next line of grid, for every other "i" value. // (every fourth entry) // Add one final entry with "bonus" pAR value.