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

Side by Side Diff: lib/runtime/dart/math.js

Issue 1131143002: Angular workarounds (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebase on latest Created 5 years, 7 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
1 var math = dart.defineLibrary(math, {}); 1 var math = dart.defineLibrary(math, {});
2 var core = dart.import(core); 2 var core = dart.import(core);
3 var _js_helper = dart.lazyImport(_js_helper); 3 var _js_helper = dart.lazyImport(_js_helper);
4 (function(exports, core, _js_helper) { 4 (function(exports, core, _js_helper) {
5 'use strict'; 5 'use strict';
6 class _JenkinsSmiHash extends core.Object { 6 class _JenkinsSmiHash extends core.Object {
7 static combine(hash, value) { 7 static combine(hash, value) {
8 hash = 536870911 & dart.notNull(hash) + dart.notNull(value); 8 hash = 536870911 & dart.notNull(hash) + dart.notNull(value);
9 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) << 10); 9 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) << 10);
10 return dart.notNull(hash) ^ dart.notNull(hash) >> 6; 10 return dart.notNull(hash) ^ dart.notNull(hash) >> 6;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 let right = max(this.left['+'](this.width), other.left['+'](other.width) ); 117 let right = max(this.left['+'](this.width), other.left['+'](other.width) );
118 let bottom = max(this.top['+'](this.height), other.top['+'](other.height )); 118 let bottom = max(this.top['+'](this.height), other.top['+'](other.height ));
119 let left = min(this.left, other.left); 119 let left = min(this.left, other.left);
120 let top = min(this.top, other.top); 120 let top = min(this.top, other.top);
121 return new (Rectangle$(T))(dart.as(left, T), dart.as(top, T), dart.as(da rt.notNull(right) - dart.notNull(left), T), dart.as(dart.notNull(bottom) - dart. notNull(top), T)); 121 return new (Rectangle$(T))(dart.as(left, T), dart.as(top, T), dart.as(da rt.notNull(right) - dart.notNull(left), T), dart.as(dart.notNull(bottom) - dart. notNull(top), T));
122 } 122 }
123 containsRectangle(another) { 123 containsRectangle(another) {
124 return dart.notNull(this.left['<='](another.left)) && dart.notNull(this. left['+'](this.width)) >= dart.notNull(another.left) + dart.notNull(another.widt h) && dart.notNull(this.top['<='](another.top)) && dart.notNull(this.top['+'](th is.height)) >= dart.notNull(another.top) + dart.notNull(another.height); 124 return dart.notNull(this.left['<='](another.left)) && dart.notNull(this. left['+'](this.width)) >= dart.notNull(another.left) + dart.notNull(another.widt h) && dart.notNull(this.top['<='](another.top)) && dart.notNull(this.top['+'](th is.height)) >= dart.notNull(another.top) + dart.notNull(another.height);
125 } 125 }
126 containsPoint(another) { 126 containsPoint(another) {
127 return core.num['>='](another.x, this.left) && dart.notNull(another.x) < = dart.notNull(this.left['+'](this.width)) && core.num['>='](another.y, this.top ) && dart.notNull(another.y) <= dart.notNull(this.top['+'](this.height)); 127 return another.x['>='](this.left) && dart.notNull(another.x) <= dart.not Null(this.left['+'](this.width)) && another.y['>='](this.top) && dart.notNull(an other.y) <= dart.notNull(this.top['+'](this.height));
128 } 128 }
129 get topLeft() { 129 get topLeft() {
130 return new (Point$(T))(this.left, this.top); 130 return new (Point$(T))(this.left, this.top);
131 } 131 }
132 get topRight() { 132 get topRight() {
133 return new (Point$(T))(dart.as(this.left['+'](this.width), T), this.top) ; 133 return new (Point$(T))(dart.as(this.left['+'](this.width), T), this.top) ;
134 } 134 }
135 get bottomRight() { 135 get bottomRight() {
136 return new (Point$(T))(dart.as(this.left['+'](this.width), T), dart.as(t his.top['+'](this.height), T)); 136 return new (Point$(T))(dart.as(this.left['+'](this.width), T), dart.as(t his.top['+'](this.height), T));
137 } 137 }
138 get bottomLeft() { 138 get bottomLeft() {
139 return new (Point$(T))(this.left, dart.as(this.top['+'](this.height), T) ); 139 return new (Point$(T))(this.left, dart.as(this.top['+'](this.height), T) );
140 } 140 }
141 } 141 }
142 return _RectangleBase; 142 return _RectangleBase;
143 }); 143 });
144 let _RectangleBase = _RectangleBase$(); 144 let _RectangleBase = _RectangleBase$();
145 let Rectangle$ = dart.generic(function(T) { 145 let Rectangle$ = dart.generic(function(T) {
146 class Rectangle extends _RectangleBase$(T) { 146 class Rectangle extends _RectangleBase$(T) {
147 Rectangle(left, top, width, height) { 147 Rectangle(left, top, width, height) {
148 this.left = left; 148 this.left = left;
149 this.top = top; 149 this.top = top;
150 this.width = dart.as(width['<'](0) ? dart.notNull(width['unary-']()) * 0 : width, T); 150 this.width = dart.as(width['<'](0) ? dart.notNull(width['unary-']()) * 0 : width, T);
151 this.height = dart.as(height['<'](0) ? dart.notNull(height['unary-']()) * 0 : height, T); 151 this.height = dart.as(height['<'](0) ? dart.notNull(height['unary-']()) * 0 : height, T);
152 super._RectangleBase(); 152 super._RectangleBase();
153 } 153 }
154 fromPoints(a, b) { 154 fromPoints(a, b) {
155 let left = dart.as(min(a.x, b.x), T); 155 let left = dart.as(min(a.x, b.x), T);
156 let width = dart.as(core.num['-'](max(a.x, b.x), left), T); 156 let width = dart.as(max(a.x, b.x)['-'](left), T);
157 let top = dart.as(min(a.y, b.y), T); 157 let top = dart.as(min(a.y, b.y), T);
158 let height = dart.as(core.num['-'](max(a.y, b.y), top), T); 158 let height = dart.as(max(a.y, b.y)['-'](top), T);
159 return new (Rectangle$(T))(left, top, width, height); 159 return new (Rectangle$(T))(left, top, width, height);
160 } 160 }
161 } 161 }
162 dart.defineNamedConstructor(Rectangle, 'fromPoints'); 162 dart.defineNamedConstructor(Rectangle, 'fromPoints');
163 return Rectangle; 163 return Rectangle;
164 }); 164 });
165 let Rectangle = Rectangle$(); 165 let Rectangle = Rectangle$();
166 let _width = Symbol('_width'); 166 let _width = Symbol('_width');
167 let _height = Symbol('_height'); 167 let _height = Symbol('_height');
168 let MutableRectangle$ = dart.generic(function(T) { 168 let MutableRectangle$ = dart.generic(function(T) {
169 class MutableRectangle extends _RectangleBase$(T) { 169 class MutableRectangle extends _RectangleBase$(T) {
170 MutableRectangle(left, top, width, height) { 170 MutableRectangle(left, top, width, height) {
171 this.left = left; 171 this.left = left;
172 this.top = top; 172 this.top = top;
173 this[_width] = dart.as(width['<'](0) ? _clampToZero(width) : width, T); 173 this[_width] = dart.as(width['<'](0) ? _clampToZero(width) : width, T);
174 this[_height] = dart.as(height['<'](0) ? _clampToZero(height) : height, T); 174 this[_height] = dart.as(height['<'](0) ? _clampToZero(height) : height, T);
175 super._RectangleBase(); 175 super._RectangleBase();
176 } 176 }
177 fromPoints(a, b) { 177 fromPoints(a, b) {
178 let left = dart.as(min(a.x, b.x), T); 178 let left = dart.as(min(a.x, b.x), T);
179 let width = dart.as(core.num['-'](max(a.x, b.x), left), T); 179 let width = dart.as(max(a.x, b.x)['-'](left), T);
180 let top = dart.as(min(a.y, b.y), T); 180 let top = dart.as(min(a.y, b.y), T);
181 let height = dart.as(core.num['-'](max(a.y, b.y), top), T); 181 let height = dart.as(max(a.y, b.y)['-'](top), T);
182 return new (MutableRectangle$(T))(left, top, width, height); 182 return new (MutableRectangle$(T))(left, top, width, height);
183 } 183 }
184 get width() { 184 get width() {
185 return this[_width]; 185 return this[_width];
186 } 186 }
187 set width(width) { 187 set width(width) {
188 dart.as(width, T); 188 dart.as(width, T);
189 if (width['<'](0)) 189 if (width['<'](0))
190 width = dart.as(_clampToZero(width), T); 190 width = dart.as(_clampToZero(width), T);
191 this[_width] = width; 191 this[_width] = width;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 this[_nextState](); 423 this[_nextState]();
424 let bits27 = dart.notNull(this[_lo]) & (1 << 27) - 1; 424 let bits27 = dart.notNull(this[_lo]) & (1 << 27) - 1;
425 return (dart.notNull(bits26) * dart.notNull(_Random._POW2_27_D) + dart.not Null(bits27)) / dart.notNull(_Random._POW2_53_D); 425 return (dart.notNull(bits26) * dart.notNull(_Random._POW2_27_D) + dart.not Null(bits27)) / dart.notNull(_Random._POW2_53_D);
426 } 426 }
427 nextBool() { 427 nextBool() {
428 this[_nextState](); 428 this[_nextState]();
429 return (dart.notNull(this[_lo]) & 1) == 0; 429 return (dart.notNull(this[_lo]) & 1) == 0;
430 } 430 }
431 } 431 }
432 _Random[dart.implements] = () => [Random]; 432 _Random[dart.implements] = () => [Random];
433 _Random._POW2_53_D = 1.0 * 9007199254740992;
434 _Random._POW2_27_D = 1.0 * (1 << 27);
435 _Random._MASK32 = 4294967295; 433 _Random._MASK32 = 4294967295;
434 dart.defineLazyProperties(_Random, {
435 get _POW2_53_D() {
436 return 1.0 * 9007199254740992;
437 },
438 set _POW2_53_D(_) {},
439 get _POW2_27_D() {
440 return 1.0 * (1 << 27);
441 },
442 set _POW2_27_D(_) {}
443 });
436 // Exports: 444 // Exports:
437 exports.Point$ = Point$; 445 exports.Point$ = Point$;
438 exports.Point = Point; 446 exports.Point = Point;
439 exports.Random = Random; 447 exports.Random = Random;
440 exports.Rectangle$ = Rectangle$; 448 exports.Rectangle$ = Rectangle$;
441 exports.Rectangle = Rectangle; 449 exports.Rectangle = Rectangle;
442 exports.MutableRectangle$ = MutableRectangle$; 450 exports.MutableRectangle$ = MutableRectangle$;
443 exports.MutableRectangle = MutableRectangle; 451 exports.MutableRectangle = MutableRectangle;
444 exports.E = E; 452 exports.E = E;
445 exports.LN10 = LN10; 453 exports.LN10 = LN10;
(...skipping 10 matching lines...) Expand all
456 exports.sin = sin; 464 exports.sin = sin;
457 exports.cos = cos; 465 exports.cos = cos;
458 exports.tan = tan; 466 exports.tan = tan;
459 exports.acos = acos; 467 exports.acos = acos;
460 exports.asin = asin; 468 exports.asin = asin;
461 exports.atan = atan; 469 exports.atan = atan;
462 exports.sqrt = sqrt; 470 exports.sqrt = sqrt;
463 exports.exp = exp; 471 exports.exp = exp;
464 exports.log = log; 472 exports.log = log;
465 })(math, core, _js_helper); 473 })(math, core, _js_helper);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698