Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: third_party/WebKit/LayoutTests/svg/as-image/resources/synthesized-viewbox-par-helper.js

Issue 2290173005: Synthesize preserveAspectRatio='none' for non-viewBoxed <img> (Closed)
Patch Set: New baselines Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 'use strict';
2
3 function makeSvgImageUrl(width, height, viewBox, pAR) {
4 var data = '<svg xmlns="http://www.w3.org/2000/svg"';
5 data += ' width="' + width + '"';
6 data += ' height="' + height + '"'
7 if (viewBox)
8 data += ' viewBox="' + viewBox + '"';
9 if (pAR)
10 data += ' preserveAspectRatio="' + pAR + '"';
11 data += '><circle cx="100" cy="100" r="100" fill="blue"/></svg>';
12 return 'data:image/svg+xml,' + encodeURIComponent(data);
13 }
14
15 function makeImage(config) {
16 var img = new Image();
17 img.src = makeSvgImageUrl(config.svgWidthAttr, config.svgHeightAttr);
18 img.style.width = config.placeholderWidthAttr;
19 img.style.height = config.placeholderHeightAttr;
20 return img;
21 }
22
23 function makeReference(config) {
24 var testData = new TestData(config);
25 var intrinsic = testData.intrinsicInformation();
26 var rect = testData.computeInlineReplacedSize();
27 // Simplified for the case of percentages (assumes 100% in that case.)
28 var viewBox = "0 0 " + (intrinsic.width || rect.width) + " " + (intrinsic.heig ht || rect.height);
29 var img = new Image();
30 img.src = makeSvgImageUrl(rect.width, rect.height, viewBox, "none");
31 img.style.width = rect.width;
32 img.style.height = rect.height;
33 return img;
34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698