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

Side by Side Diff: tools/dom/src/shared_FactoryProviders.dart

Issue 12025027: Cleaning up event constructors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, 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 part of html; 5 part of html;
6 6
7 class _CustomEventFactoryProvider {
8 static CustomEvent createCustomEvent(String type, [bool canBubble = true,
9 bool cancelable = true, Object detail = null]) {
10 final CustomEvent e = document.$dom_createEvent("CustomEvent");
11 e.$dom_initCustomEvent(type, canBubble, cancelable, detail);
12 return e;
13 }
14 }
15
16 class _EventFactoryProvider {
17 static Event createEvent(String type, [bool canBubble = true,
18 bool cancelable = true]) {
19 final Event e = document.$dom_createEvent("Event");
20 e.$dom_initEvent(type, canBubble, cancelable);
21 return e;
22 }
23 }
24
25 class _MouseEventFactoryProvider {
26 static MouseEvent createMouseEvent(String type, Window view, int detail,
27 int screenX, int screenY, int clientX, int clientY, int button,
28 [bool canBubble = true, bool cancelable = true, bool ctrlKey = false,
29 bool altKey = false, bool shiftKey = false, bool metaKey = false,
30 EventTarget relatedTarget = null]) {
31 final e = document.$dom_createEvent("MouseEvent");
32 e.$dom_initMouseEvent(type, canBubble, cancelable, view, detail,
33 screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey,
34 button, relatedTarget);
35 return e;
36 }
37 }
38
39 class _CssStyleDeclarationFactoryProvider { 7 class _CssStyleDeclarationFactoryProvider {
40 static CssStyleDeclaration createCssStyleDeclaration_css(String css) { 8 static CssStyleDeclaration createCssStyleDeclaration_css(String css) {
41 final style = new Element.tag('div').style; 9 final style = new Element.tag('div').style;
42 style.cssText = css; 10 style.cssText = css;
43 return style; 11 return style;
44 } 12 }
45 13
46 static CssStyleDeclaration createCssStyleDeclaration() { 14 static CssStyleDeclaration createCssStyleDeclaration() {
47 return new CssStyleDeclaration.css(''); 15 return new CssStyleDeclaration.css('');
48 } 16 }
(...skipping 26 matching lines...) Expand all
75 final fragment = new DocumentFragment(); 43 final fragment = new DocumentFragment();
76 final e = new svg.SvgSvgElement(); 44 final e = new svg.SvgSvgElement();
77 e.innerHtml = svgContent; 45 e.innerHtml = svgContent;
78 46
79 // Copy list first since we don't want liveness during iteration. 47 // Copy list first since we don't want liveness during iteration.
80 final List nodes = new List.from(e.nodes); 48 final List nodes = new List.from(e.nodes);
81 fragment.nodes.addAll(nodes); 49 fragment.nodes.addAll(nodes);
82 return fragment; 50 return fragment;
83 } 51 }
84 } 52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698