contain: size;"></canvas>
<script>
function assert_ratio(img, expected) {
  let epsilon = 0.001;
  assert_approx_equals(parseInt(getComputedStyle(img).width, 10) / parseInt(getComputedStyle(img).height, 10), expected, epsilon);
}

function test_computed_style(width, height, expected) {
  test_computed_style_aspect_ratio("canvas", {width: width, height: height}, expected);
}

test(function() {
  canvas = document.getElementById("contained");
  assert_ratio(canvas, 2.5);
}, "Canvas width and height attributes