OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
8 import 'dart:sky' as sky; | 8 import 'dart:sky' as sky; |
9 | 9 |
10 import '../app.dart'; | 10 import '../app.dart'; |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 oldNode = oldChildren[oldStartIndex]; | 737 oldNode = oldChildren[oldStartIndex]; |
738 removeChild(oldNode); | 738 removeChild(oldNode); |
739 advanceOldStartIndex(); | 739 advanceOldStartIndex(); |
740 } | 740 } |
741 | 741 |
742 assert(root == this.root); // TODO(ianh): Remove this once the analyzer is c
leverer | 742 assert(root == this.root); // TODO(ianh): Remove this once the analyzer is c
leverer |
743 } | 743 } |
744 | 744 |
745 } | 745 } |
746 | 746 |
747 | |
748 class UINodeAppView extends AppView { | 747 class UINodeAppView extends AppView { |
749 | 748 |
750 UINodeAppView({ RenderView renderViewOverride: null }) | 749 UINodeAppView({ RenderView renderViewOverride: null }) |
751 : super(renderViewOverride: renderViewOverride) { | 750 : super(renderViewOverride: renderViewOverride) { |
752 assert(_appView == null); | 751 assert(_appView == null); |
753 } | 752 } |
754 | 753 |
755 static UINodeAppView _appView; | 754 static UINodeAppView _appView; |
756 static AppView get appView => _appView; | 755 static AppView get appView => _appView; |
757 static void initUINodeAppView({ RenderView renderViewOverride: null }) { | 756 static void initUINodeAppView({ RenderView renderViewOverride: null }) { |
758 _appView = new UINodeAppView(renderViewOverride: renderViewOverride); | 757 _appView = new UINodeAppView(renderViewOverride: renderViewOverride); |
759 } | 758 } |
760 | 759 |
761 void dispatchEvent(sky.Event event, HitTestResult result) { | 760 void dispatchEvent(sky.Event event, HitTestResult result) { |
762 assert(_appView == this); | 761 assert(_appView == this); |
763 super.dispatchEvent(event, result); | 762 super.dispatchEvent(event, result); |
764 for (HitTestEntry entry in result.path.reversed) { | 763 for (HitTestEntry entry in result.path.reversed) { |
765 UINode target = RenderObjectWrapper._getMounted(entry.target); | 764 UINode target = RenderObjectWrapper._getMounted(entry.target); |
766 if (target == null) | 765 if (target == null) |
767 continue; | 766 continue; |
768 RenderObject targetRoot = target.root; | 767 RenderObject targetRoot = target.root; |
769 while (target != null && target.root == targetRoot) { | 768 while (target != null && target.root == targetRoot) { |
770 if (target is EventListenerNode) | 769 if (target is EventListenerNode) |
771 target._handleEvent(event); | 770 target._handleEvent(event); |
772 target = target._parent; | 771 target = target._parent; |
773 } | 772 } |
774 } | 773 } |
775 } | 774 } |
776 | 775 |
777 } | 776 } |
778 | 777 |
779 abstract class AbstractUINodeRoot extends Component { | 778 abstract class AbstractUINodeRoot extends Component { |
780 | 779 |
781 AbstractUINodeRoot({ RenderView renderViewOverride }) : super(stateful: true)
{ | 780 AbstractUINodeRoot({ RenderView renderViewOverride }) : super(stateful: true)
{ |
782 UINodeAppView.initUINodeAppView(renderViewOverride: renderViewOverride); | 781 UINodeAppView.initUINodeAppView(renderViewOverride: renderViewOverride); |
783 _mounted = true; | 782 _mounted = true; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 super._buildIfDirty(); | 847 super._buildIfDirty(); |
849 if (root.parent == null) { | 848 if (root.parent == null) { |
850 // we haven't attached it yet | 849 // we haven't attached it yet |
851 assert(_container.child == null); | 850 assert(_container.child == null); |
852 _container.child = root; | 851 _container.child = root; |
853 } | 852 } |
854 assert(root.parent == _container); | 853 assert(root.parent == _container); |
855 } | 854 } |
856 | 855 |
857 UINode build() => builder(); | 856 UINode build() => builder(); |
858 | 857 } |
859 } | |
OLD | NEW |