OLD | NEW |
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 Loading... |
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 [Rectangle] class, this class's | 151 * In contrast to the more general purpose [Rect] class, this class's values are |
152 * values are mutable, so one can change the height of an element | 152 * mutable, so one can change the height of an element programmatically. |
153 * programmatically. | |
154 * | 153 * |
155 * _Important_ _note_: use of these methods will perform CSS calculations that | 154 * _Important_ _note_: use of these methods will perform CSS calculations that |
156 * can trigger a browser reflow. Therefore, use of these properties _during_ an | 155 * can trigger a browser reflow. Therefore, use of these properties _during_ an |
157 * animation frame is discouraged. See also: | 156 * animation frame is discouraged. See also: |
158 * [Browser Reflow](https://developers.google.com/speed/articles/reflow) | 157 * [Browser Reflow](https://developers.google.com/speed/articles/reflow) |
159 */ | 158 */ |
160 abstract class CssRect extends RectangleBase<num> implements Rectangle<num> { | 159 abstract class CssRect extends RectBase implements Rect { |
161 Element _element; | 160 Element _element; |
162 | 161 |
163 CssRect(this._element); | 162 CssRect(this._element); |
164 | 163 |
165 num get left; | 164 num get left; |
166 | 165 |
167 num get top; | 166 num get top; |
168 | 167 |
169 /** | 168 /** |
170 * The height of this rectangle. | 169 * The height of this rectangle. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 252 } |
254 return val; | 253 return val; |
255 } | 254 } |
256 } | 255 } |
257 | 256 |
258 final _HEIGHT = ['top', 'bottom']; | 257 final _HEIGHT = ['top', 'bottom']; |
259 final _WIDTH = ['right', 'left']; | 258 final _WIDTH = ['right', 'left']; |
260 final _CONTENT = 'content'; | 259 final _CONTENT = 'content'; |
261 final _PADDING = 'padding'; | 260 final _PADDING = 'padding'; |
262 final _MARGIN = 'margin'; | 261 final _MARGIN = 'margin'; |
OLD | NEW |