MCPcopy Create free account
hub / github.com/HtmlUnit/htmlunit / webkitGradient

Function webkitGradient

src/test/resources/libraries/html2canvas/html2canvas.js:2229–2279  ·  view source on GitHub ↗
(context, tokens)

Source from the content-addressed store, hash-verified

2227 };
2228
2229 var webkitGradient = function (context, tokens) {
2230 var angle = deg(180);
2231 var stops = [];
2232 var type = 1 /* LINEAR_GRADIENT */;
2233 var shape = 0 /* CIRCLE */;
2234 var size = 3 /* FARTHEST_CORNER */;
2235 var position = [];
2236 parseFunctionArgs(tokens).forEach(function (arg, i) {
2237 var firstToken = arg[0];
2238 if (i === 0) {
2239 if (isIdentToken(firstToken) && firstToken.value === 'linear') {
2240 type = 1 /* LINEAR_GRADIENT */;
2241 return;
2242 }
2243 else if (isIdentToken(firstToken) && firstToken.value === 'radial') {
2244 type = 2 /* RADIAL_GRADIENT */;
2245 return;
2246 }
2247 }
2248 if (firstToken.type === 18 /* FUNCTION */) {
2249 if (firstToken.name === 'from') {
2250 var color = color$1.parse(context, firstToken.values[0]);
2251 stops.push({ stop: ZERO_LENGTH, color: color });
2252 }
2253 else if (firstToken.name === 'to') {
2254 var color = color$1.parse(context, firstToken.values[0]);
2255 stops.push({ stop: HUNDRED_PERCENT, color: color });
2256 }
2257 else if (firstToken.name === 'color-stop') {
2258 var values = firstToken.values.filter(nonFunctionArgSeparator);
2259 if (values.length === 2) {
2260 var color = color$1.parse(context, values[1]);
2261 var stop_1 = values[0];
2262 if (isNumberToken(stop_1)) {
2263 stops.push({
2264 stop: { type: 16 /* PERCENTAGE_TOKEN */, number: stop_1.number * 100, flags: stop_1.flags },
2265 color: color
2266 });
2267 }
2268 }
2269 }
2270 }
2271 });
2272 return type === 1 /* LINEAR_GRADIENT */
2273 ? {
2274 angle: (angle + deg(180)) % deg(360),
2275 stops: stops,
2276 type: type
2277 }
2278 : { size: size, shape: shape, stops: stops, position: position, type: type };
2279 };
2280
2281 var CLOSEST_SIDE = 'closest-side';
2282 var FARTHEST_SIDE = 'farthest-side';

Callers

nothing calls this directly

Calls 8

degFunction · 0.85
parseFunctionArgsFunction · 0.85
isIdentTokenFunction · 0.85
isNumberTokenFunction · 0.85
parseMethod · 0.65
forEachMethod · 0.45
pushMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…