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

Unified Diff: sky/sdk/lib/framework/fn2.dart

Issue 1153343004: Mark fn2's EventListenerNode work for PointerEvent (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 | « sky/sdk/lib/framework/app.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/framework/fn2.dart
diff --git a/sky/sdk/lib/framework/fn2.dart b/sky/sdk/lib/framework/fn2.dart
index 5305e8765daa628ef9c8dac7b04cef3350be6206..15dce299a68d4a5bd8bfaf927ed88be7c364f666 100644
--- a/sky/sdk/lib/framework/fn2.dart
+++ b/sky/sdk/lib/framework/fn2.dart
@@ -168,15 +168,13 @@ class ParentDataNode extends ContentNode {
ParentDataNode(UINode content, this.parentData): super(content);
}
-typedef GestureEventListener(sky.GestureEvent e);
-typedef PointerEventListener(sky.PointerEvent e);
-typedef EventListener(sky.Event e);
+typedef void GestureEventListener(sky.GestureEvent e);
+typedef void PointerEventListener(sky.PointerEvent e);
+typedef void EventListener(sky.Event e);
class EventListenerNode extends ContentNode {
final Map<String, sky.EventListener> listeners;
- static final Set<String> _registeredEvents = new HashSet<String>();
-
static Map<String, sky.EventListener> _createListeners({
EventListener onWheel,
GestureEventListener onGestureFlingCancel,
@@ -256,32 +254,6 @@ class EventListenerNode extends ContentNode {
listener(e);
}
}
-
- static void _dispatchEvent(sky.Event e) {
- UINode target = RenderNodeWrapper._getMounted(bridgeEventTargetToRenderNode(e.target));
-
- // TODO(rafaelw): StopPropagation?
- while (target != null) {
- if (target is EventListenerNode) {
- target._handleEvent(e);
- }
-
- target = target._parent;
- }
- }
-
- static void _ensureDocumentListener(String eventType) {
- if (_registeredEvents.add(eventType)) {
- sky.document.addEventListener(eventType, _dispatchEvent);
- }
- }
-
- void _sync(UINode old, dynamic slot) {
- for (var type in listeners.keys) {
- _ensureDocumentListener(type);
- }
- super._sync(old, slot);
- }
}
/*
@@ -898,10 +870,27 @@ abstract class Component extends UINode {
UINode build();
}
+class _AppView extends AppView {
eseidel 2015/06/02 19:12:47 FnAppView?
+ _AppView() : super(null);
+
+ void dispatchPointerEvent(sky.PointerEvent event, HitTestResult result) {
+ super.dispatchPointerEvent(event, result);
+
+ UINode target = RenderNodeWrapper._getMounted(result.path.first);
+
+ // TODO(rafaelw): StopPropagation?
+ while (target != null) {
+ if (target is EventListenerNode)
+ target._handleEvent(event);
+ target = target._parent;
+ }
+ }
+}
+
abstract class App extends Component {
App() : super(stateful: true) {
- _appView = new AppView(null);
+ _appView = new _AppView();
_scheduleComponentForRender(this);
}
@@ -934,7 +923,7 @@ class RenderSolidColor extends RenderDecoratedBox {
RenderSolidColor(int backgroundColor, { this.desiredSize })
: backgroundColor = backgroundColor,
- super(new BoxDecoration(backgroundColor: backgroundColor));
+ super(decoration: new BoxDecoration(backgroundColor: backgroundColor));
sky.Size getIntrinsicDimensions(BoxConstraints constraints) {
return constraints.constrain(desiredSize);
« no previous file with comments | « sky/sdk/lib/framework/app.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698