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

Unified Diff: tools/dom/src/dartium_CssClassSet.dart

Issue 2978213002: Removed DARTIUM codegen for IDLS (sdk/lib/dartium) (Closed)
Patch Set: Update generated darttemplate Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/dom/scripts/css_code_generator.py ('k') | tools/dom/src/dartium_CustomElementSupport.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/src/dartium_CssClassSet.dart
diff --git a/tools/dom/src/dartium_CssClassSet.dart b/tools/dom/src/dartium_CssClassSet.dart
deleted file mode 100644
index e483c376229c67ee9516407a9b0fe9275f3be18a..0000000000000000000000000000000000000000
--- a/tools/dom/src/dartium_CssClassSet.dart
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of html;
-
-/**
- * A set (union) of the CSS classes that are present in a set of elements.
- * Implemented separately from _ElementCssClassSet for performance.
- */
-class _MultiElementCssClassSet extends CssClassSetImpl {
- final Iterable<Element> _elementIterable;
- Iterable<_ElementCssClassSet> _elementCssClassSetIterable;
-
- _MultiElementCssClassSet(this._elementIterable) {
- _elementCssClassSetIterable =
- new List.from(_elementIterable).map((e) => new _ElementCssClassSet(e));
- }
-
- Set<String> readClasses() {
- var s = new LinkedHashSet<String>();
- _elementCssClassSetIterable
- .forEach((_ElementCssClassSet e) => s.addAll(e.readClasses()));
- return s;
- }
-
- void writeClasses(Set<String> s) {
- var classes = s.join(' ');
- for (Element e in _elementIterable) {
- e.className = classes;
- }
- }
-
- /**
- * Helper method used to modify the set of css classes on this element.
- *
- * f - callback with:
- * s - a Set of all the css class name currently on this element.
- *
- * After f returns, the modified set is written to the
- * className property of this element.
- */
- modify(f(Set<String> s)) {
- _elementCssClassSetIterable.forEach((_ElementCssClassSet e) => e.modify(f));
- }
-
- /**
- * Adds the class [value] to the element if it is not on it, removes it if it
- * is.
- */
- bool toggle(String value, [bool shouldAdd]) =>
- _elementCssClassSetIterable.fold(
- false,
- (bool changed, _ElementCssClassSet e) =>
- e.toggle(value, shouldAdd) || changed);
-
- /**
- * Remove the class [value] from element, and return true on successful
- * removal.
- *
- * This is the Dart equivalent of jQuery's
- * [removeClass](http://api.jquery.com/removeClass/).
- */
- bool remove(Object value) => _elementCssClassSetIterable.fold(false,
- (bool changed, _ElementCssClassSet e) => e.remove(value) || changed);
-}
-
-class _ElementCssClassSet extends CssClassSetImpl {
- final Element _element;
-
- _ElementCssClassSet(this._element);
-
- Set<String> readClasses() {
- var s = new LinkedHashSet<String>();
- var classname = _element.className;
- if (classname is svg.AnimatedString) {
- classname = classname.baseVal;
- }
-
- for (String name in classname.split(' ')) {
- String trimmed = name.trim();
- if (!trimmed.isEmpty) {
- s.add(trimmed);
- }
- }
- return s;
- }
-
- void writeClasses(Set<String> s) {
- _element.className = s.join(' ');
- }
-}
« no previous file with comments | « tools/dom/scripts/css_code_generator.py ('k') | tools/dom/src/dartium_CustomElementSupport.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698