Thu, 15 Jan 2015 21:13:52 +0100
Remove forgotten relic of ABI crash risk averse overloaded method change.
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 | img { |
michael@0 | 10 | width: 100px; |
michael@0 | 11 | height: 200px; |
michael@0 | 12 | } |
michael@0 | 13 | </style> |
michael@0 | 14 | </head> |
michael@0 | 15 | <body> |
michael@0 | 16 | <img src="image-orientation-no-viewbox-no-size.svg"> |
michael@0 | 17 | |
michael@0 | 18 | <script> |
michael@0 | 19 | var orientation = location.search.substring(1).split("&"); |
michael@0 | 20 | var angle = orientation[0]; |
michael@0 | 21 | var flip = orientation[1] == "flip" ? true : false; |
michael@0 | 22 | |
michael@0 | 23 | // Construct a style. "from-image" is special-cased. |
michael@0 | 24 | var orientationStyle; |
michael@0 | 25 | if (angle == "from-image") { |
michael@0 | 26 | orientationStyle = "image-orientation: from-image;"; |
michael@0 | 27 | } else { |
michael@0 | 28 | orientationStyle = "image-orientation: " |
michael@0 | 29 | + angle + "deg" |
michael@0 | 30 | + (flip ? " flip" : "") |
michael@0 | 31 | + ";"; |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | // Since the SVG image has no intrinsic size, we need to apply an |
michael@0 | 35 | // appropriate size to the <img> element to match the reference. |
michael@0 | 36 | var boxStyle; |
michael@0 | 37 | if (angle == "90" || angle == "270") { |
michael@0 | 38 | boxStyle = "width: 200px; height: 100px;"; |
michael@0 | 39 | } else { |
michael@0 | 40 | boxStyle = "width: 100px; height: 200px;"; |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | var style = "img { " |
michael@0 | 44 | + orientationStyle |
michael@0 | 45 | + " " |
michael@0 | 46 | + boxStyle |
michael@0 | 47 | + " }\n"; |
michael@0 | 48 | |
michael@0 | 49 | // Apply the style to the document. |
michael@0 | 50 | var sheet = document.createElement('style'); |
michael@0 | 51 | sheet.innerHTML = style; |
michael@0 | 52 | document.body.appendChild(sheet); |
michael@0 | 53 | </script> |
michael@0 | 54 | </body> |