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

Side by Side Diff: samples/total/client/HtmlUtils.dart

Issue 10635015: Delete proxy and total samples, which have bit-rotted. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
« no previous file with comments | « samples/total/client/HtmlTable.dart ('k') | samples/total/client/IdGenerator.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
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.
4
5 class HtmlUtils {
6
7 // Strips the 'px' (pixels) suffix from a string CSS value and parses the
8 // result as an integer.
9 static int fromPx(String px) => Math.parseInt(px.substring(0, px.length - 2));
10
11 // Workaround until String.replaceAll is functional
12 static String quoteHtml(String s) {
13 StringBuffer sb = new StringBuffer();
14 int last = 0;
15 for (int i = 0; i < s.length; i++) {
16 switch (s[i]) {
17 case "<":
18 sb.add(s.substring(last, i));
19 sb.add("&lt;");
20 last = i + 1;
21 break;
22 case ">":
23 sb.add(s.substring(last, i));
24 sb.add("&gt;");
25 last = i + 1;
26 break;
27 case "&":
28 sb.add(s.substring(last, i));
29 sb.add("&amp;");
30 last = i + 1;
31 break;
32 case "\"":
33 sb.add(s.substring(last, i));
34 sb.add("&quot;");
35 last = i + 1;
36 break;
37 }
38 }
39 sb.add(s.substring(last, s.length));
40 return sb.toString();
41 }
42
43 static void setIntegerProperty(Element element, String property, int value, St ring units) {
44 element.style.setProperty(property, "${value}${units}", "");
45 }
46
47 // Appends 'px' (pixels) to an integer for use in CSS values.
48 static String toPx(int length) => "${length}px";
49 }
OLDNEW
« no previous file with comments | « samples/total/client/HtmlTable.dart ('k') | samples/total/client/IdGenerator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698