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

Side by Side Diff: sdk/lib/_internal/compiler/samples/leap/leap_leg.dart

Issue 11748016: Make ~/, round, ceil, floor, truncate return ints. Remove toInt. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Checked mode fixes. Created 7 years, 11 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 compilerIsolate(port) { 5 compilerIsolate(port) {
6 Runner runner = new Runner(); 6 Runner runner = new Runner();
7 runner.init(); 7 runner.init();
8 8
9 port.receive((msg, replyTo) { 9 port.receive((msg, replyTo) {
10 replyTo.send(runner.update(msg)); 10 replyTo.send(runner.update(msg));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // enough for now. 69 // enough for now.
70 handleUp(Event e) { 70 handleUp(Event e) {
71 var selection = html.window.getSelection(); 71 var selection = html.window.getSelection();
72 var range = selection.getRangeAt(0); 72 var range = selection.getRangeAt(0);
73 var rects = range.getClientRects(); 73 var rects = range.getClientRects();
74 if (rects.length < 1) { 74 if (rects.length < 1) {
75 hide(popup); 75 hide(popup);
76 return; 76 return;
77 } 77 }
78 html.ClientRect rect = rects.item(rects.length - 1); 78 html.ClientRect rect = rects.item(rects.length - 1);
79 if (rect.width.toInt() != 0) { 79 if (rect.width.truncate() != 0) {
Lasse Reichstein Nielsen 2013/01/04 10:29:42 Thast's silly. Just use: rect.width >= 1
80 // This is a selection of multiple characters, not a single 80 // This is a selection of multiple characters, not a single
81 // point of insertion. 81 // point of insertion.
82 hide(popup); 82 hide(popup);
83 return; 83 return;
84 } 84 }
85 popup.style.top = "${rect.bottom.toInt()}px"; 85 popup.style.top = "${rect.bottom.truncate()}px";
86 popup.style.left = "${rect.right.toInt()}px"; 86 popup.style.left = "${rect.right.truncate()}px";
87 // Instead of displaying this immediately, we could set up a timer 87 // Instead of displaying this immediately, we could set up a timer
88 // event and display it later. This is a matter of getting the UX 88 // event and display it later. This is a matter of getting the UX
89 // just right, for now it simply demonstrates that we know where 89 // just right, for now it simply demonstrates that we know where
90 // the insertion point is (in pixels) and what the character 90 // the insertion point is (in pixels) and what the character
91 // offset is. 91 // offset is.
92 show(popup); 92 show(popup);
93 popup.text = '''Code completion here... 93 popup.text = '''Code completion here...
94 Current character offset: ${range.startOffset}'''; 94 Current character offset: ${range.startOffset}''';
95 // TODO(ahe): Better detection of when [codeDiv] has changed. 95 // TODO(ahe): Better detection of when [codeDiv] has changed.
96 update(); 96 update();
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 mainApp = new LibraryElement(script); 278 mainApp = new LibraryElement(script);
279 279
280 universe.libraries.remove(script.uri.toString()); 280 universe.libraries.remove(script.uri.toString());
281 Element element; 281 Element element;
282 withCurrentElement(mainApp, () { 282 withCurrentElement(mainApp, () {
283 scanner.scan(mainApp); 283 scanner.scan(mainApp);
284 }); 284 });
285 return mainApp; 285 return mainApp;
286 } 286 }
287 } 287 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698