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

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 onto 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
« no previous file with comments | « lib/runtime/dart/core.js ('k') | lib/runtime/dart_runtime.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 exports.sin = sin; 456 exports.sin = sin;
457 exports.cos = cos; 457 exports.cos = cos;
458 exports.tan = tan; 458 exports.tan = tan;
459 exports.acos = acos; 459 exports.acos = acos;
460 exports.asin = asin; 460 exports.asin = asin;
461 exports.atan = atan; 461 exports.atan = atan;
462 exports.sqrt = sqrt; 462 exports.sqrt = sqrt;
463 exports.exp = exp; 463 exports.exp = exp;
464 exports.log = log; 464 exports.log = log;
465 })(math, core, _js_helper); 465 })(math, core, _js_helper);
OLDNEW
« no previous file with comments | « lib/runtime/dart/core.js ('k') | lib/runtime/dart_runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698