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

Side by Side Diff: tools/dom/templates/html/impl/impl_ClientRect.darttemplate

Issue 68513006: o/~ Y muchos maaaaaaas... o/~ (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 @DocsEditable() 7 @DocsEditable()
8 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS implements Rectangle$IM PLEMENTS$NATIVESPEC { 8 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS implements Rectangle$IM PLEMENTS$NATIVESPEC {
9 9
10 // NOTE! All code below should be common with RectangleBase. 10 // NOTE! All code below should be common with RectangleBase.
11 String toString() { 11 String toString() {
12 return 'Rectangle ($left, $top) $width x $height'; 12 return 'Rectangle ($left, $top) $width x $height';
13 } 13 }
14 14
15 bool operator ==(other) { 15 bool operator ==(other) {
16 if (other is !Rectangle) return false; 16 if (other is !Rectangle) return false;
17 return left == other.left && top == other.top && width == other.width && 17 return left == other.left && top == other.top && width == other.width &&
18 height == other.height; 18 height == other.height;
19 } 19 }
20 20
21 int get hashCode => _JenkinsSmiHash.hash4(left.hashCode, top.hashCode, 21 int get hashCode => _JenkinsSmiHash.hash4(left.hashCode, top.hashCode,
22 width.hashCode, height.hashCode); 22 width.hashCode, height.hashCode);
23 23
24 /** 24 /**
25 * Computes the intersection of `this` and [other]. 25 * Computes the intersection of `this` and [other].
26 * 26 *
27 * The intersection of two axis-aligned rectangles, if any, is always another 27 * The intersection of two axis-aligned rectangles, if any, is always another
28 * axis-aligned rectangle. 28 * axis-aligned rectangle.
29 * 29 *
30 * Returns the intersection of this and `other`, or `null` if they don't 30 * Returns the intersection of this and `other`, or null if they don't
31 * intersect. 31 * intersect.
32 */ 32 */
33 Rectangle intersection(Rectangle other) { 33 Rectangle intersection(Rectangle other) {
34 var x0 = max(left, other.left); 34 var x0 = max(left, other.left);
35 var x1 = min(left + width, other.left + other.width); 35 var x1 = min(left + width, other.left + other.width);
36 36
37 if (x0 <= x1) { 37 if (x0 <= x1) {
38 var y0 = max(top, other.top); 38 var y0 = max(top, other.top);
39 var y1 = min(top + height, other.top + other.height); 39 var y1 = min(top + height, other.top + other.height);
40 40
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); 127 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
128 hash = hash ^ (hash >> 11); 128 hash = hash ^ (hash >> 11);
129 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); 129 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
130 } 130 }
131 131
132 static int hash2(a, b) => finish(combine(combine(0, a), b)); 132 static int hash2(a, b) => finish(combine(combine(0, a), b));
133 133
134 static int hash4(a, b, c, d) => 134 static int hash4(a, b, c, d) =>
135 finish(combine(combine(combine(combine(0, a), b), c), d)); 135 finish(combine(combine(combine(combine(0, a), b), c), d));
136 } 136 }
OLDNEW
« no previous file with comments | « tools/dom/src/CssClassSet.dart ('k') | tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698