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

Unified Diff: client/html/frog/html_frog.dart

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
« no previous file with comments | « client/html/dartium/html_dartium.dart ('k') | client/html/release/html.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/html/frog/html_frog.dart
diff --git a/client/html/frog/html_frog.dart b/client/html/frog/html_frog.dart
index 410121dac94a99512f0d67839a3bcf11686bb6d4..71bb7e69a34ca9053df079263e56fddb28c4ecb6 100644
--- a/client/html/frog/html_frog.dart
+++ b/client/html/frog/html_frog.dart
@@ -804,12 +804,6 @@ class _CSSPrimitiveValueImpl extends _CSSValueImpl implements CSSPrimitiveValue
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;
_CounterImpl getCounterValue() native;
@@ -4692,6 +4686,8 @@ class _DocumentImpl extends _ElementImpl
_ElementImpl _createElement(String tagName) native "return this.parentNode.createElement(tagName);";
+ _ElementImpl _createElementNS(String namespaceURI, String qualifiedName) native "return this.parentNode.createElementNS(namespaceURI, qualifiedName);";
+
_EventImpl _createEvent(String eventType) native "return this.parentNode.createEvent(eventType);";
_RangeImpl createRange() native "return this.parentNode.createRange();";
@@ -5222,6 +5218,13 @@ class _DynamicsCompressorNodeImpl extends _AudioNodeImpl implements DynamicsComp
final _AudioParamImpl threshold;
}
+
+class _EXTTextureFilterAnisotropicImpl implements EXTTextureFilterAnisotropic native "*EXTTextureFilterAnisotropic" {
+
+ static final int MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
+
+ static final int TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE;
+}
// 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.
@@ -5321,7 +5324,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);
}
@@ -6312,6 +6315,10 @@ class _FieldSetElementImpl extends _ElementImpl implements FieldSetElement nativ
final _FormElementImpl form;
+ String name;
+
+ final String type;
+
final String validationMessage;
final _ValidityStateImpl validity;
@@ -10026,8 +10033,58 @@ class _SVGDocumentImpl extends _DocumentImpl implements SVGDocument native "*SVG
_EventImpl _createEvent(String eventType) native "return this.createEvent(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 native "*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;
+ }
+
// Shadowing definition.
String get id() native "return this.id;";
@@ -10039,6 +10096,7 @@ class _SVGElementImpl extends _ElementImpl implements SVGElement native "*SVGEle
final _SVGElementImpl viewportElement;
String xmlbase;
+
}
class _SVGElementInstanceImpl extends _EventTargetImpl implements SVGElementInstance native "*SVGElementInstance" {
@@ -13011,6 +13069,8 @@ class _SelectElementImpl extends _ElementImpl implements SelectElement native "*
int selectedIndex;
+ final _HTMLCollectionImpl selectedOptions;
+
int size;
final String type;
@@ -13039,6 +13099,8 @@ class _ShadowElementImpl extends _ElementImpl implements ShadowElement native "*
class _ShadowRootImpl extends _DocumentFragmentImpl implements ShadowRoot native "*ShadowRoot" {
+ final _ElementImpl activeElement;
+
final _ElementImpl host;
String innerHTML;
@@ -13713,8 +13775,6 @@ class _TrackElementImpl extends _ElementImpl implements TrackElement native "*HT
static final int NONE = 0;
- bool isDefault;
-
String kind;
String label;
@@ -17045,12 +17105,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();
@@ -20338,10 +20392,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);
@@ -20387,6 +20442,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.
@@ -21221,6 +21288,10 @@ interface FieldSetElement extends Element {
final FormElement form;
+ String name;
+
+ final String type;
+
final String validationMessage;
final ValidityState validity;
@@ -24805,9 +24876,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;
@@ -24816,6 +24891,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
@@ -26554,9 +26630,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;
@@ -26631,6 +26708,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
@@ -27164,6 +27242,8 @@ interface SelectElement extends Element {
int selectedIndex;
+ final HTMLCollection selectedOptions;
+
int size;
final String type;
@@ -27204,6 +27284,8 @@ interface ShadowRoot extends DocumentFragment default _ShadowRootFactoryProvider
ShadowRoot(Element host);
+ final Element activeElement;
+
final Element host;
String innerHTML;
@@ -27941,8 +28023,6 @@ interface TrackElement extends Element {
static final int NONE = 0;
- bool isDefault;
-
String kind;
String label;
@@ -31008,17 +31088,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/html/dartium/html_dartium.dart ('k') | client/html/release/html.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698