OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 class _SVGClassSet extends _CssClassSet { | 5 class _SVGClassSet extends _CssClassSet { |
6 _SVGClassSet(element) : super(element); | 6 _SVGClassSet(element) : super(element); |
7 | 7 |
8 String _className() => _element.className.baseVal; | 8 String _className() => _element.className.baseVal; |
9 | 9 |
10 void _write(Set s) { | 10 void _write(Set s) { |
11 _element.className.baseVal = _formatSet(s); | 11 _element.className.baseVal = _formatSet(s); |
(...skipping 25 matching lines...) Expand all Loading... |
37 | 37 |
38 Set<String> get classes() { | 38 Set<String> get classes() { |
39 if (_cssClassSet === null) { | 39 if (_cssClassSet === null) { |
40 _cssClassSet = new _SVGClassSet(_ptr); | 40 _cssClassSet = new _SVGClassSet(_ptr); |
41 } | 41 } |
42 return _cssClassSet; | 42 return _cssClassSet; |
43 } | 43 } |
44 | 44 |
45 String get id() { return _ptr.id; } | 45 String get id() { return _ptr.id; } |
46 | 46 |
47 void set id(String value) { _ptr.id = value; } | 47 void set id(String value) { |
| 48 assert(!_inMeasurementFrame || !_inDocument); |
| 49 _ptr.id = value; |
| 50 } |
48 | 51 |
49 SVGSVGElement get ownerSVGElement() { return LevelDom.wrapSVGSVGElement(_ptr.o
wnerSVGElement); } | 52 SVGSVGElement get ownerSVGElement() { return LevelDom.wrapSVGSVGElement(_ptr.o
wnerSVGElement); } |
50 | 53 |
51 SVGElement get viewportElement() { return LevelDom.wrapSVGElement(_ptr.viewpor
tElement); } | 54 SVGElement get viewportElement() { return LevelDom.wrapSVGElement(_ptr.viewpor
tElement); } |
52 | 55 |
53 String get xmlbase() { return _ptr.xmlbase; } | 56 String get xmlbase() { return _ptr.xmlbase; } |
54 | 57 |
55 void set xmlbase(String value) { _ptr.xmlbase = value; } | 58 void set xmlbase(String value) { |
| 59 assert(!_inMeasurementFrame || !_inDocument); |
| 60 _ptr.xmlbase = value; |
| 61 } |
56 | 62 |
57 ElementList get elements() { | 63 ElementList get elements() { |
58 if (_elements == null) { | 64 if (_elements == null) { |
59 _elements = new FilteredElementList(this); | 65 _elements = new FilteredElementList(this); |
60 } | 66 } |
61 return _elements; | 67 return _elements; |
62 } | 68 } |
63 | 69 |
64 // TODO: The type of value should be Collection<Element>. See http://b/5392897 | 70 // TODO: The type of value should be Collection<Element>. See http://b/5392897 |
65 void set elements(value) { | 71 void set elements(value) { |
| 72 assert(!_inMeasurementFrame || !_inDocument); |
66 final elements = this.elements; | 73 final elements = this.elements; |
67 elements.clear(); | 74 elements.clear(); |
68 elements.addAll(value); | 75 elements.addAll(value); |
69 } | 76 } |
70 | 77 |
71 String get outerHTML() { | 78 String get outerHTML() { |
72 final container = new Element.tag("div"); | 79 final container = new Element.tag("div"); |
73 container.elements.add(this.clone(true)); | 80 container.elements.add(this.clone(true)); |
74 return container.innerHTML; | 81 return container.innerHTML; |
75 } | 82 } |
76 | 83 |
77 String get innerHTML() { | 84 String get innerHTML() { |
78 final container = new Element.tag("div"); | 85 final container = new Element.tag("div"); |
79 container.elements.addAll(this.clone(true).elements); | 86 container.elements.addAll(this.clone(true).elements); |
80 return container.innerHTML; | 87 return container.innerHTML; |
81 } | 88 } |
82 | 89 |
83 void set innerHTML(String svg) { | 90 void set innerHTML(String svg) { |
| 91 assert(!_inMeasurementFrame || !_inDocument); |
84 var container = new Element.tag("div"); | 92 var container = new Element.tag("div"); |
85 // Wrap the SVG string in <svg> so that SVGElements are created, rather than | 93 // Wrap the SVG string in <svg> so that SVGElements are created, rather than |
86 // HTMLElements. | 94 // HTMLElements. |
87 container.innerHTML = '<svg version="1.1">$svg</svg>'; | 95 container.innerHTML = '<svg version="1.1">$svg</svg>'; |
88 this.elements = container.elements.first.elements; | 96 this.elements = container.elements.first.elements; |
89 } | 97 } |
90 | 98 |
91 SVGElement clone(bool deep) => super.clone(deep); | 99 SVGElement clone(bool deep) => super.clone(deep); |
92 } | 100 } |
OLD | NEW |