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

Side by Side Diff: polymer_0.5.0/bower_components/web-animations-js/src/shape-handler.js

Issue 786953007: npm_modules: Fork bower_components into Polymer 0.4.0 and 0.5.0 versions (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 11 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 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 (function(scope) {
16
17 var consumeLengthOrPercent = scope.consumeParenthesised.bind(null, scope.parse LengthOrPercent);
18 var consumeLengthOrPercentPair = scope.consumeRepeated.bind(undefined, consume LengthOrPercent, /^/);
19
20 var mergeSizePair = scope.mergeNestedRepeated.bind(undefined, scope.mergeDimen sions, ' ');
21 var mergeSizePairList = scope.mergeNestedRepeated.bind(undefined, mergeSizePai r, ',');
22
23 function parseShape(input) {
24 var circle = scope.consumeToken(/^circle/, input);
25 if (circle && circle[0]) {
26 return ['circle'].concat(scope.consumeList([
27 scope.ignore(scope.consumeToken.bind(undefined, /^\(/)),
28 consumeLengthOrPercent,
29 scope.ignore(scope.consumeToken.bind(undefined, /^at/)),
30 scope.consumePosition,
31 scope.ignore(scope.consumeToken.bind(undefined, /^\)/))
32 ], circle[1]));
33 }
34 var ellipse = scope.consumeToken(/^ellipse/, input);
35 if (ellipse && ellipse[0]) {
36 return ['ellipse'].concat(scope.consumeList([
37 scope.ignore(scope.consumeToken.bind(undefined, /^\(/)),
38 consumeLengthOrPercentPair,
39 scope.ignore(scope.consumeToken.bind(undefined, /^at/)),
40 scope.consumePosition,
41 scope.ignore(scope.consumeToken.bind(undefined, /^\)/))
42 ], ellipse[1]));
43 }
44 var polygon = scope.consumeToken(/^polygon/, input);
45 if (polygon && polygon[0]) {
46 return ['polygon'].concat(scope.consumeList([
47 scope.ignore(scope.consumeToken.bind(undefined, /^\(/)),
48 scope.optional(scope.consumeToken.bind(undefined, /^nonzero\s*,|^evenodd \s*,/), 'nonzero,'),
49 scope.consumeSizePairList,
50 scope.ignore(scope.consumeToken.bind(undefined, /^\)/))
51 ], polygon[1]));
52 }
53 }
54
55 function mergeShapes(left, right) {
56 if (left[0] !== right[0])
57 return;
58 if (left[0] == 'circle') {
59 return scope.mergeList(left.slice(1), right.slice(1), [
60 'circle(',
61 scope.mergeDimensions,
62 ' at ',
63 scope.mergeOffsetList,
64 ')']);
65 }
66 if (left[0] == 'ellipse') {
67 return scope.mergeList(left.slice(1), right.slice(1), [
68 'ellipse(',
69 scope.mergeNonNegativeSizePair,
70 ' at ',
71 scope.mergeOffsetList,
72 ')']);
73 }
74 if (left[0] == 'polygon' && left[1] == right[1]) {
75 return scope.mergeList(left.slice(2), right.slice(2), [
76 'polygon(',
77 left[1],
78 mergeSizePairList,
79 ')']);
80 }
81 }
82
83 scope.addPropertiesHandler(parseShape, mergeShapes, ['shape-outside']);
84
85 })(webAnimationsMinifill);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698