Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | <!DOCTYPE> |
michael@0 | 2 | <head> |
michael@0 | 3 | <style> |
michael@0 | 4 | body { |
michael@0 | 5 | border: 0px; |
michael@0 | 6 | margin: 0px; |
michael@0 | 7 | padding: 0px; |
michael@0 | 8 | } |
michael@0 | 9 | </style> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <img src="image-orientation-viewbox-no-size.svg"> |
michael@0 | 13 | |
michael@0 | 14 | <script> |
michael@0 | 15 | var orientation = location.search.substring(1).split("&"); |
michael@0 | 16 | var angle = orientation[0]; |
michael@0 | 17 | var flip = orientation[1] == "flip" ? true : false; |
michael@0 | 18 | |
michael@0 | 19 | // Construct a style. "from-image" is special-cased. |
michael@0 | 20 | var orientationStyle; |
michael@0 | 21 | if (angle == "from-image") { |
michael@0 | 22 | orientationStyle = "image-orientation: from-image;"; |
michael@0 | 23 | } else { |
michael@0 | 24 | orientationStyle = "image-orientation: " |
michael@0 | 25 | + angle + "deg" |
michael@0 | 26 | + (flip ? " flip" : "") |
michael@0 | 27 | + ";"; |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | // Since the SVG image has no intrinsic size, we need to apply an |
michael@0 | 31 | // appropriate size to the <img> element to match the reference. |
michael@0 | 32 | var boxStyle; |
michael@0 | 33 | if (angle == "90" || angle == "270") { |
michael@0 | 34 | boxStyle = "width: 200px; height: 100px;"; |
michael@0 | 35 | } else { |
michael@0 | 36 | boxStyle = "width: 100px; height: 200px;"; |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | var style = "img { " |
michael@0 | 40 | + orientationStyle |
michael@0 | 41 | + " " |
michael@0 | 42 | + boxStyle |
michael@0 | 43 | + " }\n"; |
michael@0 | 44 | |
michael@0 | 45 | // Apply the style to the document. |
michael@0 | 46 | var sheet = document.createElement('style'); |
michael@0 | 47 | sheet.innerHTML = style; |
michael@0 | 48 | document.body.appendChild(sheet); |
michael@0 | 49 | </script> |
michael@0 | 50 | </body> |