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

Unified Diff: client/html/dartium/html_dartium.dart

Side-by-side diff isn't available for this file because of its large size.
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:
Download patch
Index: client/html/dartium/html_dartium.dart
diff --git a/client/html/dartium/html_dartium.dart b/client/html/dartium/html_dartium.dart
index 61082dd47d042a7f617fb846e63d061803cc54ca..e677a682c2935543078b131ee8ab548cb31a2435 100644
--- a/client/html/dartium/html_dartium.dart
+++ b/client/html/dartium/html_dartium.dart
@@ -188,6 +188,7 @@ _wrap(raw) {
case "DocumentFragment": return new _DocumentFragmentImpl._wrap(domObject);
case "DocumentType": return new _DocumentTypeImpl._wrap(domObject);
case "DynamicsCompressorNode": return new _DynamicsCompressorNodeImpl._wrap(domObject);
+ case "EXTTextureFilterAnisotropic": return new _EXTTextureFilterAnisotropicImpl._wrap(domObject);
case "ElementTimeControl": return new _ElementTimeControlImpl._wrap(domObject);
case "HTMLEmbedElement": return new _EmbedElementImpl._wrap(domObject);
case "Entity": return new _EntityImpl._wrap(domObject);
@@ -6739,6 +6740,10 @@ class _DocumentImpl extends _ElementImpl
return _wrap(_documentPtr.createElement(_unwrap(tagName)));
}
+ Element _createElementNS(String namespaceURI, String qualifiedName) {
+ return _wrap(_documentPtr.createElementNS(_unwrap(namespaceURI), _unwrap(qualifiedName)));
+ }
+
Event _createEvent(String eventType) {
return _wrap(_documentPtr.createEvent(_unwrap(eventType)));
}
@@ -7323,6 +7328,10 @@ class _DynamicsCompressorNodeImpl extends _AudioNodeImpl implements DynamicsComp
AudioParam get threshold() => _wrap(_ptr.threshold);
}
+
+class _EXTTextureFilterAnisotropicImpl extends _DOMTypeBase implements EXTTextureFilterAnisotropic {
+ _EXTTextureFilterAnisotropicImpl._wrap(ptr) : super._wrap(ptr);
+}
// Copyright (c) 2012, 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.
@@ -7422,7 +7431,7 @@ class _ChildrenElementList implements ElementList {
Iterator<Element> iterator() => _toList().iterator();
- void addAll(Collection<_ElementImpl> collection) {
+ void addAll(Collection<Element> collection) {
for (_ElementImpl element in collection) {
_element._appendChild(element);
}
@@ -8689,6 +8698,12 @@ class _FieldSetElementImpl extends _ElementImpl implements FieldSetElement {
FormElement get form() => _wrap(_ptr.form);
+ String get name() => _wrap(_ptr.name);
+
+ void set name(String value) { _ptr.name = _unwrap(value); }
+
+ String get type() => _wrap(_ptr.type);
+
String get validationMessage() => _wrap(_ptr.validationMessage);
ValidityState get validity() => _wrap(_ptr.validity);
@@ -13836,8 +13851,58 @@ class _SVGDocumentImpl extends _DocumentImpl implements SVGDocument {
return _wrap(_ptr.createEvent(_unwrap(eventType)));
}
}
+// 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 _SVGElementImpl extends _ElementImpl implements SVGElement {
+ 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;
+ }
+
_SVGElementImpl._wrap(ptr) : super._wrap(ptr);
String get id() => _wrap(_ptr.id);
@@ -13851,6 +13916,7 @@ class _SVGElementImpl extends _ElementImpl implements SVGElement {
String get xmlbase() => _wrap(_ptr.xmlbase);
void set xmlbase(String value) { _ptr.xmlbase = _unwrap(value); }
+
}
class _SVGElementInstanceImpl extends _EventTargetImpl implements SVGElementInstance {
@@ -17477,6 +17543,8 @@ class _SelectElementImpl extends _ElementImpl implements SelectElement {
void set selectedIndex(int value) { _ptr.selectedIndex = _unwrap(value); }
+ HTMLCollection get selectedOptions() => _wrap(_ptr.selectedOptions);
+
int get size() => _wrap(_ptr.size);
void set size(int value) { _ptr.size = _unwrap(value); }
@@ -17523,6 +17591,8 @@ class _ShadowElementImpl extends _ElementImpl implements ShadowElement {
class _ShadowRootImpl extends _DocumentFragmentImpl implements ShadowRoot {
_ShadowRootImpl._wrap(ptr) : super._wrap(ptr);
+ Element get activeElement() => _wrap(_ptr.activeElement);
+
Element get host() => _wrap(_ptr.host);
String get innerHTML() => _wrap(_ptr.innerHTML);
@@ -18605,10 +18675,6 @@ class _TouchListImpl extends _DOMTypeBase implements TouchList {
class _TrackElementImpl extends _ElementImpl implements TrackElement {
_TrackElementImpl._wrap(ptr) : super._wrap(ptr);
- bool get isDefault() => _wrap(_ptr.isDefault);
-
- void set isDefault(bool value) { _ptr.isDefault = _unwrap(value); }
-
String get kind() => _wrap(_ptr.kind);
void set kind(String value) { _ptr.kind = _unwrap(value); }
@@ -22424,12 +22490,6 @@ interface CSSPrimitiveValue extends CSSValue {
static final int CSS_URI = 20;
- static final int CSS_VH = 27;
-
- static final int CSS_VMIN = 28;
-
- static final int CSS_VW = 26;
-
final int primitiveType;
Counter getCounterValue();
@@ -25717,10 +25777,11 @@ interface DocumentFragment extends Element default _DocumentFragmentFactoryProvi
DocumentFragment.html(String html);
- // TODO(nweiz): enable these when XML and/or SVG are ported
+ // TODO(nweiz): enable this when XML is ported
// /** WARNING: Currently this doesn't work on Dartium (issue 649). */
// DocumentFragment.xml(String xml);
- // DocumentFragment.svg(String svg);
+
+ DocumentFragment.svg(String svg);
DocumentFragment clone(bool deep);
@@ -25766,6 +25827,18 @@ interface DynamicsCompressorNode extends AudioNode {
final AudioParam threshold;
}
+// Copyright (c) 2012, 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.
+
+// WARNING: Do not edit - generated code.
+
+interface EXTTextureFilterAnisotropic {
+
+ static final int MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
+
+ static final int TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE;
+}
// 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.
@@ -26600,6 +26673,10 @@ interface FieldSetElement extends Element {
final FormElement form;
+ String name;
+
+ final String type;
+
final String validationMessage;
final ValidityState validity;
@@ -30184,9 +30261,13 @@ interface SVGDocument extends Document {
// 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.
-// WARNING: Do not edit - generated code.
+interface SVGElement extends Element default _SVGElementFactoryProvider {
+
+ SVGElement.tag(String tag);
+ SVGElement.svg(String svg);
+
+ SVGElement clone(bool deep);
-interface SVGElement extends Element {
String id;
@@ -30195,6 +30276,7 @@ interface SVGElement extends Element {
final SVGElement viewportElement;
String xmlbase;
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -31933,9 +32015,10 @@ interface SVGRenderingIntent {
// 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.
-// WARNING: Do not edit - generated code.
+interface SVGSVGElement extends SVGElement, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGStylable, SVGLocatable, SVGFitToViewBox, SVGZoomAndPan
+ default _SVGSVGElementFactoryProvider {
+ SVGSVGElement();
-interface SVGSVGElement extends SVGElement, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGStylable, SVGLocatable, SVGFitToViewBox, SVGZoomAndPan {
String contentScriptType;
@@ -32010,6 +32093,7 @@ interface SVGSVGElement extends SVGElement, SVGTests, SVGLangSpace, SVGExternalR
void unsuspendRedraw(int suspendHandleId);
void unsuspendRedrawAll();
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -32543,6 +32627,8 @@ interface SelectElement extends Element {
int selectedIndex;
+ final HTMLCollection selectedOptions;
+
int size;
final String type;
@@ -32583,6 +32669,8 @@ interface ShadowRoot extends DocumentFragment default _ShadowRootFactoryProvider
ShadowRoot(Element host);
+ final Element activeElement;
+
final Element host;
String innerHTML;
@@ -33320,8 +33408,6 @@ interface TrackElement extends Element {
static final int NONE = 0;
- bool isDefault;
-
String kind;
String label;
@@ -36267,17 +36353,46 @@ class _DocumentFragmentFactoryProvider {
// return fragment;
// }
- // TODO(nweiz): enable this when SVG is ported.
- // factory DocumentFragment.svg(String svg) {
- // final fragment = new DocumentFragment();
- // final e = new SVGSVGElement();
- // e.innerHTML = svg;
- //
- // // Copy list first since we don't want liveness during iteration.
- // final List nodes = new List.from(e.nodes);
- // fragment.nodes.addAll(nodes);
- // return fragment;
- // }
+ factory DocumentFragment.svg(String svg) {
+ final fragment = new DocumentFragment();
+ final e = new SVGSVGElement();
+ e.innerHTML = svg;
+
+ // Copy list first since we don't want liveness during iteration.
+ final List nodes = new List.from(e.nodes);
+ fragment.nodes.addAll(nodes);
+ return fragment;
+ }
+}
+
+class _SVGElementFactoryProvider {
+ factory SVGElement.tag(String tag) =>
+ _document._createElementNS("http://www.w3.org/2000/svg", tag);
+
+ factory SVGElement.svg(String svg) {
+ Element parentTag;
+ final match = _START_TAG_REGEXP.firstMatch(svg);
+ if (match != null && match.group(1).toLowerCase() == 'svg') {
+ parentTag = new Element.tag('div');
+ } else {
+ parentTag = new SVGSVGElement();
+ }
+
+ parentTag.innerHTML = svg;
+ if (parentTag.elements.length == 1) return parentTag.nodes.removeLast();
+
+ throw new IllegalArgumentException('SVG had ${parentTag.elements.length} ' +
+ 'top-level elements but 1 expected');
+ }
+}
+
+class _SVGSVGElementFactoryProvider {
+ factory SVGSVGElement() {
+ final el = new SVGElement.tag("svg");
+ // The SVG spec requires the version attribute to match the spec version
+ el.attributes['version'] = "1.1";
+ return el;
+ }
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
« no previous file with comments | « client/dom/templates/html/interface/interface_SVGSVGElement.darttemplate ('k') | client/html/frog/html_frog.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698