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

Side by Side Diff: client/html/src/CssClassSet.dart

Issue 9145004: Revert "Example showing alternate async measurement solution" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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) 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 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 // TODO - figure out whether classList exists, and if so use that 5 // TODO - figure out whether classList exists, and if so use that
6 // rather than the className property that is being used here. 6 // rather than the className property that is being used here.
7 7
8 class _CssClassSet implements Set<String> { 8 class _CssClassSet implements Set<String> {
9 9
10 final _element; 10 final _element;
11 11
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 /** 98 /**
99 * Helper method used to modify the set of css classes on this element. 99 * Helper method used to modify the set of css classes on this element.
100 * 100 *
101 * f - callback with: 101 * f - callback with:
102 * s - a Set of all the css class name currently on this element. 102 * s - a Set of all the css class name currently on this element.
103 * 103 *
104 * After f returns, the modified set is written to the 104 * After f returns, the modified set is written to the
105 * className property of this element. 105 * className property of this element.
106 */ 106 */
107 void _modify( f(Set<String> s)) { 107 void _modify( f(Set<String> s)) {
108 assert(!_inMeasurementFrame || !_nodeInDocument(_element));
109 Set<String> s = _read(); 108 Set<String> s = _read();
110 f(s); 109 f(s);
111 _write(s); 110 _write(s);
112 } 111 }
113 112
114 /** 113 /**
115 * Read the class names from the HTMLElement class property, 114 * Read the class names from the HTMLElement class property,
116 * and put them into a set (duplicates are discarded). 115 * and put them into a set (duplicates are discarded).
117 */ 116 */
118 Set<String> _read() { 117 Set<String> _read() {
(...skipping 12 matching lines...) Expand all
131 * Read the class names as a space-separated string. This is meant to be 130 * Read the class names as a space-separated string. This is meant to be
132 * overridden by subclasses. 131 * overridden by subclasses.
133 */ 132 */
134 String _className() => _element.className; 133 String _className() => _element.className;
135 134
136 /** 135 /**
137 * Join all the elements of a set into one string and write 136 * Join all the elements of a set into one string and write
138 * back to the element. 137 * back to the element.
139 */ 138 */
140 void _write(Set s) { 139 void _write(Set s) {
141 assert(!_inMeasurementFrame || !_nodeInDocument(_element));
142 _element.className = _formatSet(s); 140 _element.className = _formatSet(s);
143 } 141 }
144 142
145 String _formatSet(Set<String> s) { 143 String _formatSet(Set<String> s) {
146 // TODO(mattsh) should be able to pass Set to String.joins http:/b/5398605 144 // TODO(mattsh) should be able to pass Set to String.joins http:/b/5398605
147 List list = new List.from(s); 145 List list = new List.from(s);
148 return Strings.join(list, ' '); 146 return Strings.join(list, ' ');
149 } 147 }
150 148
151 } 149 }
152 150
OLDNEW
« no previous file with comments | « client/html/src/CSSStyleDeclarationWrappingImplementation.dart ('k') | client/html/src/Document.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698