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

Unified Diff: client/dom/templates/html/impl/impl_SVGElement.darttemplate

Issue 9677012: Port the SVG code to the wrapperless DOM. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: client/dom/templates/html/impl/impl_SVGElement.darttemplate
diff --git a/client/dom/templates/html/impl/impl_SVGElement.darttemplate b/client/dom/templates/html/impl/impl_SVGElement.darttemplate
new file mode 100644
index 0000000000000000000000000000000000000000..5d30b11ecdde8ae22635f570e911abe966e1adf3
--- /dev/null
+++ b/client/dom/templates/html/impl/impl_SVGElement.darttemplate
@@ -0,0 +1,54 @@
+// Copyright (c) 2011, 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.
+
+class _AttributeClassSet extends _CssClassSet {
+ _AttributeClassSet(element) : super(element);
+
+ String _className() => _element.attributes['class'];
+
+ void _write(Set s) {
+ _element.attributes['class'] = _formatSet(s);
+ }
+}
+
+class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
+ Set<String> get classes() {
+ if (_cssClassSet === null) {
+ _cssClassSet = new _AttributeClassSet(_ptr);
+ }
+ return _cssClassSet;
+ }
+
+ ElementList get elements() => new FilteredElementList(this);
+
+ void set elements(Collection<Element> value) {
+ final elements = this.elements;
+ elements.clear();
+ elements.addAll(value);
+ }
+
+ String get outerHTML() {
+ final container = new Element.tag("div");
+ final SVGElement clone = this.clone(true);
+ container.elements.add(clone);
+ return container.innerHTML;
+ }
+
+ String get innerHTML() {
+ final container = new Element.tag("div");
+ final SVGElement clone = this.clone(true);
+ container.elements.addAll(clone.elements);
+ return container.innerHTML;
+ }
+
+ void set innerHTML(String svg) {
+ final container = new Element.tag("div");
+ // Wrap the SVG string in <svg> so that SVGElements are created, rather than
+ // HTMLElements.
+ container.innerHTML = '<svg version="1.1">$svg</svg>';
+ this.elements = container.elements.first.elements;
+ }
+
+$!MEMBERS
+}

Powered by Google App Engine
This is Rietveld 408576698