layout/reftests/svg/as-image/img-novb-width-all-1-ref.html

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4   <link rel="stylesheet" type="text/css" href="svg-image-util.css" />
     5   <script src="svg-image-util.js"></script>
     6 </head>
     7 <body style="height: 600px"><!-- height for pct vals to resolve against -->
     8   <script>
     9       var svgParams = {
    10         viewBox:  null,   // This gets set on a case-by-case basis below.
    11         width  :  "20px",
    12         height :  "20%",
    13         meetOrSlice: null // This means "use pAR=none"
    14       };
    16       // Descriptions below describe the behavior of the rows of <img> elements
    17       // in the corresponding test cases, which we mimic with specially-crafted
    18       // <embed> elements.
    20       // * FIRST TWO ROWS: <img> has width=auto height=auto
    21       //  - Each <img> renders w/ height = 150px (default)
    22       //  - Synthesized viewBox has height = 20% * viewport_height = .2*150 = 30
    23       //  - <img> & viewBox both get width=20px, from <svg> width attr
    24       svgParams.viewBox = [0, 0, 20, 30],
    25       appendSVGSubArrayWithParams(svgParams, "embed", "20px", "150px");
    27       // * SECOND TWO ROWS: <img> has width=auto, height=20px
    28       //  - <img> now renders w/ height = 20px (imposed by <img> height attr)
    29       //  - Synthesized viewBox has height = 20% * viewport_width = .2*20 = 4
    30       //  - <img> & viewBox both get width=20px, from <svg> width attr
    31       svgParams.viewBox = [0, 0, 20, 4],
    32       appendSVGSubArrayWithParams(svgParams, "embed", "20px", "20px");
    34       // * THIRD TWO ROWS: <img> has width=30px height=auto
    35       // Calculations are as with "FIRST TWO ROWS", except <img> now imposes
    36       // width="30px".
    37       svgParams.viewBox = [0, 0, 20, 30],
    38       appendSVGSubArrayWithParams(svgParams, "embed", "30px", "150px");
    40       // * FOURTH TWO ROWS: <img> has width=30px height=20px
    41       // Calculations are as with "SECOND TWO ROWS", except <img> now imposes
    42       // width="30px".
    43       svgParams.viewBox = [0, 0, 20, 4],
    44       appendSVGSubArrayWithParams(svgParams, "embed", "30px", "20px");
    46   </script>
    47   <!-- Body gets populated by script -->
    48 </body>
    49 </html>

mercurial