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

Side by Side Diff: sky/sdk/lib/widgets/widget.dart

Issue 1224133002: Remove dart:mirrors from Sky framework (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « sky/sdk/lib/widgets/basic.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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';
8 import 'dart:sky' as sky; 7 import 'dart:sky' as sky;
9 8
10 import 'package:sky/mojo/activity.dart' as activity; 9 import 'package:sky/mojo/activity.dart' as activity;
11 10
12 import '../base/hit_test.dart'; 11 import '../base/hit_test.dart';
13 import '../rendering/box.dart'; 12 import '../rendering/box.dart';
14 import '../rendering/object.dart'; 13 import '../rendering/object.dart';
15 import '../rendering/sky_binding.dart'; 14 import '../rendering/sky_binding.dart';
16 15
17 export '../rendering/box.dart' show BoxConstraints, BoxDecoration, Border, Borde rSide, EdgeDims; 16 export '../rendering/box.dart' show BoxConstraints, BoxDecoration, Border, Borde rSide, EdgeDims;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // This is called immediately before _sync(). 124 // This is called immediately before _sync().
126 // Component._retainStatefulNodeIfPossible() calls syncFields(). 125 // Component._retainStatefulNodeIfPossible() calls syncFields().
127 bool _retainStatefulNodeIfPossible(Widget old) => false; 126 bool _retainStatefulNodeIfPossible(Widget old) => false;
128 127
129 void _sync(Widget old, dynamic slot); 128 void _sync(Widget old, dynamic slot);
130 void updateSlot(dynamic newSlot); 129 void updateSlot(dynamic newSlot);
131 // 'slot' is the identifier that the ancestor RenderObjectWrapper uses to know 130 // 'slot' is the identifier that the ancestor RenderObjectWrapper uses to know
132 // where to put this descendant. If you just defer to a child, then make sure 131 // where to put this descendant. If you just defer to a child, then make sure
133 // to pass them the slot. 132 // to pass them the slot.
134 133
135 Widget findAncestor(Type targetType) { 134 Widget findAncestorRenderObjectWrapper() {
136 var ancestor = _parent; 135 var ancestor = _parent;
137 while (ancestor != null && !reflectClass(ancestor.runtimeType).isSubtypeOf(r eflectClass(targetType))) 136 while (ancestor != null && ancestor is! RenderObjectWrapper)
138 ancestor = ancestor._parent; 137 ancestor = ancestor._parent;
139 return ancestor; 138 return ancestor;
140 } 139 }
141 140
142 void remove() { 141 void remove() {
143 _root = null; 142 _root = null;
144 setParent(null); 143 setParent(null);
145 } 144 }
146 145
147 void removeChild(Widget node) { 146 void removeChild(Widget node) {
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 void insertChildRoot(RenderObjectWrapper child, dynamic slot); 656 void insertChildRoot(RenderObjectWrapper child, dynamic slot);
658 void detachChildRoot(RenderObjectWrapper child); 657 void detachChildRoot(RenderObjectWrapper child);
659 658
660 void _sync(RenderObjectWrapper old, dynamic slot) { 659 void _sync(RenderObjectWrapper old, dynamic slot) {
661 // TODO(abarth): We should split RenderObjectWrapper into two pieces so that 660 // TODO(abarth): We should split RenderObjectWrapper into two pieces so that
662 // RenderViewObject doesn't need to inherit all this code it 661 // RenderViewObject doesn't need to inherit all this code it
663 // doesn't need. 662 // doesn't need.
664 assert(parent != null || this is RenderViewWrapper); 663 assert(parent != null || this is RenderViewWrapper);
665 if (old == null) { 664 if (old == null) {
666 _root = createNode(); 665 _root = createNode();
667 _ancestor = findAncestor(RenderObjectWrapper); 666 _ancestor = findAncestorRenderObjectWrapper();
668 if (_ancestor is RenderObjectWrapper) 667 if (_ancestor is RenderObjectWrapper)
669 _ancestor.insertChildRoot(this, slot); 668 _ancestor.insertChildRoot(this, slot);
670 } else { 669 } else {
671 assert(old is RenderObjectWrapper); 670 assert(old is RenderObjectWrapper);
672 _root = old.root; 671 _root = old.root;
673 _ancestor = old._ancestor; 672 _ancestor = old._ancestor;
674 } 673 }
675 assert(_root == root); // in case a subclass reintroduces it 674 assert(_root == root); // in case a subclass reintroduces it
676 assert(root != null); 675 assert(root != null);
677 assert(mounted); 676 assert(mounted);
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 if (root.parent == null) { 1108 if (root.parent == null) {
1110 // we haven't attached it yet 1109 // we haven't attached it yet
1111 assert(_container.child == null); 1110 assert(_container.child == null);
1112 _container.child = root; 1111 _container.child = root;
1113 } 1112 }
1114 assert(root.parent == _container); 1113 assert(root.parent == _container);
1115 } 1114 }
1116 1115
1117 Widget build() => builder(); 1116 Widget build() => builder();
1118 } 1117 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/widgets/basic.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698