| Index: sdk/lib/html/dartium/html_dartium.dart
|
| diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
|
| index d6678043caf4a89bd07ef334358af28bb972e942..b2a22d194b2741844e32998f735f1c11bead36cf 100644
|
| --- a/sdk/lib/html/dartium/html_dartium.dart
|
| +++ b/sdk/lib/html/dartium/html_dartium.dart
|
| @@ -3128,7 +3128,8 @@ class CssRule extends NativeFieldWrapperClass1 {
|
|
|
|
|
| @DomName('CSSStyleDeclaration')
|
| -class CssStyleDeclaration extends NativeFieldWrapperClass1 {
|
| + class CssStyleDeclaration extends NativeFieldWrapperClass1 with
|
| + CssStyleDeclarationMixin {
|
| factory CssStyleDeclaration() => new CssStyleDeclaration.css('');
|
|
|
| factory CssStyleDeclaration.css(String css) {
|
| @@ -3136,7 +3137,43 @@ class CssStyleDeclaration extends NativeFieldWrapperClass1 {
|
| style.cssText = css;
|
| return style;
|
| }
|
| +}
|
| +
|
| +/**
|
| + * A collection of [CssStyleDeclaration]s that are associated with an
|
| + * [ElementList].
|
| + *
|
| + * Grouping the style objects all together provides easy editing of specific
|
| + * properties of a collection of elements. Setting a specific property value
|
| + * will set that property in all [Element]s in the [ElementList]. Getting a
|
| + * specific property value will return the value of the property of the first
|
| + * element in the [ElementList].
|
| + */
|
| +class CssStyleDeclarationSet extends NativeFieldWrapperClass1 with CssStyleDeclarationMixin {
|
| + final Iterable<Element> _elementIterable;
|
| + Iterable<CssStyleDeclaration> _elementCssStyleDeclarationSetIterable;
|
| +
|
| + CssStyleDeclarationSet._(this._elementIterable) {
|
| + _elementCssStyleDeclarationSetIterable = new List.from(
|
| + _elementIterable).map((e) => e.style);
|
| + }
|
|
|
| + String getPropertyValue(String propertyName) =>
|
| + _elementCssStyleDeclarationSetIterable.first.getPropertyValue(
|
| + propertyName);
|
| +
|
| + void setProperty(String propertyName, String value, [String priority]) {
|
| + _elementCssStyleDeclarationSetIterable.forEach((e) =>
|
| + e.setProperty(propertyName, value, priority));
|
| + }
|
| + // Important note: CssStyleDeclarationSet does NOT implement every method
|
| + // available in CssStyleDeclaration. Some of the methods don't make so much
|
| + // sense in terms of having a resonable value to return when you're
|
| + // considering a list of Elements. You will need to manually add any of the
|
| + // items in the MEMBERS set if you want that functionality.
|
| +}
|
| +
|
| +abstract class CssStyleDeclarationMixin {
|
|
|
| @DomName('CSSStyleDeclaration.cssText')
|
| @DocsEditable()
|
| @@ -3178,7 +3215,6 @@ class CssStyleDeclaration extends NativeFieldWrapperClass1 {
|
| @DocsEditable()
|
| void _setProperty(String propertyName, String value, String priority) native "CSSStyleDeclaration_setProperty_Callback";
|
|
|
| -
|
| String getPropertyValue(String propertyName) {
|
| var propValue = _getPropertyValue(propertyName);
|
| return propValue != null ? propValue : '';
|
| @@ -8506,6 +8542,9 @@ abstract class ElementList<T extends Element> extends ListBase<T> {
|
| /** Replace the classes with `value` for every element in this list. */
|
| set classes(Iterable<String> value);
|
|
|
| + /** The union of all styles associated with the [Element]s in this list. */
|
| + CssStyleDeclarationSet get style;
|
| +
|
| /**
|
| * Access dimensions and position of the Elements in this list.
|
| *
|
| @@ -8601,6 +8640,9 @@ class _FrozenElementList<T extends Element> extends ListBase<T> implements Eleme
|
|
|
| CssClassSet get classes => new _MultiElementCssClassSet(_elementList);
|
|
|
| + CssStyleDeclarationSet get style =>
|
| + new CssStyleDeclarationSet._(_elementList);
|
| +
|
| void set classes(Iterable<String> value) {
|
| _elementList.forEach((e) => e.classes = value);
|
| }
|
|
|