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

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

Issue 14018022: Fix model-tree-observer in html. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 _ModelTreeObserver { 7 class _ModelTreeObserver {
8 static bool _initialized = false; 8 static bool _initialized = false;
9 9
10 /** 10 /**
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 * Pushes model changes down through the tree. 72 * Pushes model changes down through the tree.
73 * 73 *
74 * Set fullTree to true if the state of the tree is unknown and model changes 74 * Set fullTree to true if the state of the tree is unknown and model changes
75 * should be propagated through the entire tree. 75 * should be propagated through the entire tree.
76 */ 76 */
77 static void propagateModel(Node node, model, bool fullTree) { 77 static void propagateModel(Node node, model, bool fullTree) {
78 // Calling into user code with the != call could generate exceptions. 78 // Calling into user code with the != call could generate exceptions.
79 // Catch and report them a global exceptions. 79 // Catch and report them a global exceptions.
80 try { 80 try {
81 if (node._hasLocalModel != true && node._model != model && 81 if (node._hasLocalModel != true && node._model != model &&
82 node._modelChangedStream != null) { 82 node._modelChangedStreams != null &&
83 !node._modelChangedStreams.isEmpty) {
83 node._model = model; 84 node._model = model;
84 node._modelChangedStream.add(node); 85 node._modelChangedStreams.toList()
86 .forEach((controller) => controller.add(node));
85 } 87 }
86 } catch (e, s) { 88 } catch (e, s) {
87 new Future.immediateError(e, s); 89 new Future.immediateError(e, s);
88 } 90 }
89 for (var child = node.$dom_firstChild; child != null; 91 for (var child = node.$dom_firstChild; child != null;
90 child = child.nextNode) { 92 child = child.nextNode) {
91 if (child._hasLocalModel != true) { 93 if (child._hasLocalModel != true) {
92 propagateModel(child, model, fullTree); 94 propagateModel(child, model, fullTree);
93 } else if (fullTree) { 95 } else if (fullTree) {
94 propagateModel(child, child._model, true); 96 propagateModel(child, child._model, true);
95 } 97 }
96 } 98 }
97 } 99 }
98 } 100 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/templates/html/impl/impl_Node.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698