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

Side by Side Diff: sky/examples/fn/lib/style.dart

Issue 987463002: Move fn.dart into /sky/framework (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « sky/examples/fn/lib/reflect.dart ('k') | sky/examples/fn/widgets/item.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 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 part of fn;
6
7 class Style {
8 final String _className;
9 static final Map<String, Style> _cache = new HashMap<String, Style>();
10
11 static int nextStyleId = 1;
12
13 static String nextClassName(String styles) {
14 assert(sky.document != null);
15 String className = "style$nextStyleId";
16 nextStyleId++;
17
18 sky.Element styleNode = sky.document.createElement('style');
19 styleNode.setChild(new sky.Text(".$className { $styles }"));
20 sky.document.appendChild(styleNode);
21
22 return className;
23 }
24
25 factory Style(String styles) {
26 return _cache.putIfAbsent(styles, () {
27 return new Style._internal(nextClassName(styles));
28 });
29 }
30
31 Style._internal(this._className);
32 }
OLDNEW
« no previous file with comments | « sky/examples/fn/lib/reflect.dart ('k') | sky/examples/fn/widgets/item.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698