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

Side by Side Diff: tools/dom/src/CssRectangle.dart

Issue 25808002: Move Rectangle and Point into dart:math. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of html; 5 part of html;
6 6
7 /** 7 /**
8 * A rectangle representing all the content of the element in the 8 * A rectangle representing all the content of the element in the
9 * [box model](http://www.w3.org/TR/CSS2/box.html). 9 * [box model](http://www.w3.org/TR/CSS2/box.html).
10 */ 10 */
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 num get left => _element.getBoundingClientRect().left - 142 num get left => _element.getBoundingClientRect().left -
143 _addOrSubtractToBoxModel(['left'], _MARGIN); 143 _addOrSubtractToBoxModel(['left'], _MARGIN);
144 num get top => _element.getBoundingClientRect().top - 144 num get top => _element.getBoundingClientRect().top -
145 _addOrSubtractToBoxModel(['top'], _MARGIN); 145 _addOrSubtractToBoxModel(['top'], _MARGIN);
146 } 146 }
147 147
148 /** 148 /**
149 * A class for representing CSS dimensions. 149 * A class for representing CSS dimensions.
150 * 150 *
151 * In contrast to the more general purpose [Rect] class, this class's values are 151 * In contrast to the more general purpose [Rectangle] class, this class's
152 * mutable, so one can change the height of an element programmatically. 152 * values are mutable, so one can change the height of an element
153 * programmatically.
153 * 154 *
154 * _Important_ _note_: use of these methods will perform CSS calculations that 155 * _Important_ _note_: use of these methods will perform CSS calculations that
155 * can trigger a browser reflow. Therefore, use of these properties _during_ an 156 * can trigger a browser reflow. Therefore, use of these properties _during_ an
156 * animation frame is discouraged. See also: 157 * animation frame is discouraged. See also:
157 * [Browser Reflow](https://developers.google.com/speed/articles/reflow) 158 * [Browser Reflow](https://developers.google.com/speed/articles/reflow)
158 */ 159 */
159 abstract class CssRect extends RectBase implements Rect { 160 abstract class CssRect extends MutableRectangle<num> implements Rectangle<num> {
160 Element _element; 161 Element _element;
161 162
162 CssRect(this._element); 163 CssRect(this._element) : super(0, 0, 0, 0);
163 164
164 num get left; 165 num get left;
165 166
166 num get top; 167 num get top;
167 168
168 /** 169 /**
169 * The height of this rectangle. 170 * The height of this rectangle.
170 * 171 *
171 * This is equivalent to the `height` function in jQuery and the calculated 172 * This is equivalent to the `height` function in jQuery and the calculated
172 * `height` CSS value, converted to a dimensionless num in pixels. Unlike 173 * `height` CSS value, converted to a dimensionless num in pixels. Unlike
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 } 253 }
253 return val; 254 return val;
254 } 255 }
255 } 256 }
256 257
257 final _HEIGHT = ['top', 'bottom']; 258 final _HEIGHT = ['top', 'bottom'];
258 final _WIDTH = ['right', 'left']; 259 final _WIDTH = ['right', 'left'];
259 final _CONTENT = 'content'; 260 final _CONTENT = 'content';
260 final _PADDING = 'padding'; 261 final _PADDING = 'padding';
261 final _MARGIN = 'margin'; 262 final _MARGIN = 'margin';
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698